mirror of
https://github.com/Daniongithub/ER-TPL.git
synced 2025-10-02 18:10:48 +00:00
New stuff
This commit is contained in:
106
start_menu/servizi/start-corsesopp/css/style.css
Normal file
106
start_menu/servizi/start-corsesopp/css/style.css
Normal file
@@ -0,0 +1,106 @@
|
||||
:root {
|
||||
--primary-color: #afafaf;
|
||||
--accent-color: #0074d9;
|
||||
--bg-color: #2e2d2d;
|
||||
--white: #ffffff;
|
||||
--light-gray: #848991;
|
||||
--border-color: #727070;
|
||||
--text-color: #ffffff;
|
||||
--black: #000000;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
background-color: var(--bg-color);
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
header {
|
||||
background-color: var(--bg-color);
|
||||
color: var(--text-color);
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
/*box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);*/
|
||||
}
|
||||
|
||||
main {
|
||||
max-width: 900px;
|
||||
margin: 40px auto;
|
||||
padding: 30px;
|
||||
background-color: var(--bg-color);
|
||||
/*border-radius: 10px;*/
|
||||
/*box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);*/
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
form {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 15px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
form label {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
form select,
|
||||
form button {
|
||||
padding: 10px;
|
||||
font-size: 16px;
|
||||
border-radius: 6px;
|
||||
border: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
form button {
|
||||
background-color: var(--accent-color);
|
||||
color: white;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
form button:hover {
|
||||
background-color: #005fa3;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
display: none;
|
||||
}
|
||||
|
||||
th, td {
|
||||
padding: 12px;
|
||||
border: 1px solid var(--border-color);
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
th {
|
||||
background-color: var(--light-gray);
|
||||
}
|
||||
|
||||
tr:nth-child(even) {
|
||||
background-color: #505050;
|
||||
}
|
||||
|
||||
.loading-message {
|
||||
text-align: center;
|
||||
color: #777;
|
||||
font-style: italic;
|
||||
padding: 20px 0;
|
||||
}
|
||||
|
||||
footer {
|
||||
text-align: center;
|
||||
}
|
||||
a {
|
||||
color: var(--text-color);
|
||||
}
|
BIN
start_menu/servizi/start-corsesopp/img/favicon.ico
Normal file
BIN
start_menu/servizi/start-corsesopp/img/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
start_menu/servizi/start-corsesopp/img/start.png
Normal file
BIN
start_menu/servizi/start-corsesopp/img/start.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 37 KiB |
44
start_menu/servizi/start-corsesopp/index.html
Normal file
44
start_menu/servizi/start-corsesopp/index.html
Normal file
@@ -0,0 +1,44 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="it">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>START Romagna - Monitor corse non garantite</title>
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
<link rel="shortcut icon" href="img/favicon.ico">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<center><img src="img/start.png" alt="Start Romagna" width="10%"></center>
|
||||
<h1>Monitor corse non garantite</h1>
|
||||
</header>
|
||||
<main>
|
||||
<form id="formStazione">
|
||||
<label for="stazione">Bacino:</label>
|
||||
<select id="stazione" name="stazione">
|
||||
<option value="Ravenna">Ravenna</option>
|
||||
<option value="Rimini">Rimini</option>
|
||||
<option value="Forli-Cesena">Forlì-Cesena</option>
|
||||
</select>
|
||||
<button type="submit">Carica</button>
|
||||
</form>
|
||||
<table id="tabellaDati">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Linea</th>
|
||||
<th>Inizio</th>
|
||||
<th>Ora di Inizio</th>
|
||||
<th>Fine</th>
|
||||
<th>Ora di Fine</th>
|
||||
<th>Data</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="corpoTabella"></tbody>
|
||||
</table>
|
||||
</main>
|
||||
<footer>
|
||||
<p>Copyright (C) 2025 ER-TPL Team - <a href="https://ertpl.pages.dev" target="_blank">ertpl.pages.dev</a> - code by EmmeV (Vichingo455) <a href="https://git.vichingo455.freeddns.org/emmev-code/start-livebus" target="_blank">Codice Sorgente</a><br>
|
||||
Start Romagna, Start e il logo Start Romagna sono marchi registrati e protetti da copyright da Start Romagna SpA. Vengono usati in questa pagina solo per riferimento.</p>
|
||||
</footer>
|
||||
<script src="js/script.js"></script>
|
||||
</body>
|
||||
</html>
|
58
start_menu/servizi/start-corsesopp/js/script.js
Normal file
58
start_menu/servizi/start-corsesopp/js/script.js
Normal file
@@ -0,0 +1,58 @@
|
||||
// VARIABILI DA MODIFICARE - VARIABLES TO MODIFY //
|
||||
const ApiUri = 'https://api.vichingo455.freeddns.org/start-corsesopp.json'; //JSON Dinamico - Dynamic JSON
|
||||
|
||||
// IMPORTANTE!! NON MODIFICARE SOTTO!! - IMPORTANT!! DO NOT MODIFY THE CODE BELOW!! //
|
||||
let ultimaRichiesta = null;
|
||||
let intervalloAggiornamento = null;
|
||||
const delay = ms => new Promise(res => setTimeout(res, ms));
|
||||
async function caricaDati(event = null, richiestaManuale = false) {
|
||||
if (event) event.preventDefault();
|
||||
const Bacino = document.getElementById("stazione").value;
|
||||
const corpo = document.getElementById("corpoTabella");
|
||||
const tabella = document.getElementById("tabellaDati");
|
||||
// Salva la richiesta corrente per i refresh automatici
|
||||
ultimaRichiesta = { Bacino };
|
||||
// Ottieni la data e l'ora di oggi
|
||||
const oggi = new Date();
|
||||
const anno = oggi.getFullYear();
|
||||
const mese = String(oggi.getMonth() + 1).padStart(2, '0'); // i mesi partono da 0
|
||||
const giorno = String(oggi.getDate()).padStart(2, '0');
|
||||
const Data = `${anno}-${mese}-${giorno}`;
|
||||
// Scrivi l'URL
|
||||
const url = `${ApiUri}/?Bacino=${Bacino}&Data=${Data}`;
|
||||
try {
|
||||
if (richiestaManuale) {
|
||||
tabella.style.display = "table";
|
||||
corpo.innerHTML = `<tr><td colspan="6" class="loading-message">Caricamento in corso...</td></tr>`;
|
||||
}
|
||||
const response = await fetch(url);
|
||||
const data = await response.json();
|
||||
if (data.length === 0) {
|
||||
corpo.innerHTML = `<tr><td colspan="6" class="loading-message">Nessun dato disponibile.</td></tr>`;
|
||||
return;
|
||||
}
|
||||
corpo.innerHTML = data.map(row =>
|
||||
`<tr>${row.map(col => `<td>${col}</td>`).join('')}</tr>`
|
||||
).join('');
|
||||
} catch (error) {
|
||||
console.error("Errore durante la richiesta:", error);
|
||||
if (richiestaManuale) {
|
||||
corpo.innerHTML = `<tr><td colspan="6" class="loading-message">Errore durante il caricamento dei dati. Per favore riprova.<br>PER GLI SVILUPPATORI: Controllare nella console del browser per i dettagli dell'errore.</td></tr>`;
|
||||
await delay(7000);
|
||||
tabella.style.display = "none";
|
||||
}
|
||||
}
|
||||
}
|
||||
function avviaAggiornamentoAutomatico() {
|
||||
if (intervalloAggiornamento) clearInterval(intervalloAggiornamento);
|
||||
intervalloAggiornamento = setInterval(() => {
|
||||
if (ultimaRichiesta) {
|
||||
caricaDati(null, false);
|
||||
}
|
||||
}, 30000); // ogni 30 secondi
|
||||
}
|
||||
document.getElementById("formStazione").addEventListener("submit", (e) => {
|
||||
caricaDati(e, true);
|
||||
avviaAggiornamentoAutomatico();
|
||||
});
|
||||
caricaStazioni();
|
Reference in New Issue
Block a user