From e887c57348da6ac54eed8cf39355bea590514af0 Mon Sep 17 00:00:00 2001 From: Leocraft1 Date: Fri, 25 Jul 2025 19:47:45 +0200 Subject: [PATCH] Beta cerca fermate seta + fix warning size --- index.html | 4 +- seta_menu/cercaorario/css/style.css | 122 +++++++++++++++++++++++ seta_menu/cercaorario/fermata.html | 30 ++++++ seta_menu/cercaorario/img/favicon.ico | Bin 0 -> 1150 bytes seta_menu/cercaorario/index.html | 44 ++++++++ seta_menu/cercaorario/js/cercafermata.js | 52 ++++++++++ seta_menu/cercaorario/js/fermata.js | 80 +++++++++++++++ sitemap.xml | 2 +- style.css | 6 ++ 9 files changed, 337 insertions(+), 3 deletions(-) create mode 100644 seta_menu/cercaorario/css/style.css create mode 100644 seta_menu/cercaorario/fermata.html create mode 100644 seta_menu/cercaorario/img/favicon.ico create mode 100644 seta_menu/cercaorario/index.html create mode 100644 seta_menu/cercaorario/js/cercafermata.js create mode 100644 seta_menu/cercaorario/js/fermata.js diff --git a/index.html b/index.html index 03fcd96..17f103a 100644 --- a/index.html +++ b/index.html @@ -18,10 +18,10 @@ diff --git a/seta_menu/cercaorario/css/style.css b/seta_menu/cercaorario/css/style.css new file mode 100644 index 0000000..a8176d6 --- /dev/null +++ b/seta_menu/cercaorario/css/style.css @@ -0,0 +1,122 @@ +:root { + --primary-color: #afafaf; + --accent-color: #0074d9; + --bg-color: #2e2d2d; + --white: #ffffff; + --light-gray: #848991; + --border-color: #727070; + --text-color: #ffffff; + --black: #000000; +} +body { + background-color: #282828; + text-align: center; + color: white; + font-family: Titillium Web; +} + +.search-result { + border: 2px solid white; + border-radius: 8px; + width: 15%; + margin: auto; + margin-left: 5px; + margin-right: 5px; + margin-top: 10px; + cursor: pointer; + display: inline-block; +} + +table { + border-collapse: collapse; + border-radius: 8px; + width: 85%; + margin: auto; + margin-top: 1rem; +} + +th { + background-color: lightslategray; +} + +th, +td { + border: 2px solid #444; + padding: 8px; + text-align: left; +} + +tr:nth-child(even) { + background-color: dimgray; +} + +.bus-card-red { + background-color: rgb(241, 120, 120) !important; +} + +header { + font-size: 67%; + background-color: #333; + height: auto; + padding: 0px 0px; + align-items: start; + width: 100%; + border-radius: 10px; +} + +nav ul { + list-style-type: none; + margin: 0; + padding: 0; + display: flex; + justify-content: left; +} + +nav { + text-align: center; + flex-shrink: 0; +} + +nav.index { + display: flex; + min-height: 51px; +} + +nav ul li { + margin-left: 20px; + margin-right: 20px; +} + +nav ul li a { + color: #fff; + text-decoration: none; + font-size: 16px; +} + +nav ul li a:hover { + text-decoration: underline; +} + +a { + color: orange; +} + +@media (max-width: 768px) { + .search-result { + display: block; + } +} +#bacino, +#searchBar { + padding: 10px; + font-size: 16px; + border-radius: 6px; + border: 1px solid var(--border-color); +} + +footer { + position: relative; + bottom: 0; + left: 0; + width: 100%; +} \ No newline at end of file diff --git a/seta_menu/cercaorario/fermata.html b/seta_menu/cercaorario/fermata.html new file mode 100644 index 0000000..38820cf --- /dev/null +++ b/seta_menu/cercaorario/fermata.html @@ -0,0 +1,30 @@ + + + + + + SETA Modena - Orario fermate + + + + + + + +
+ +
+

Informazioni fermata

+
Caricamento dati...
+ + + + \ No newline at end of file diff --git a/seta_menu/cercaorario/img/favicon.ico b/seta_menu/cercaorario/img/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..95b83b1d326fa1ca4a1ca954f48a659513e6cd24 GIT binary patch literal 1150 zcmaiyc}P@I6o*e61r-%UM3(Il27=`hPPSo2(k7Ov(QaX8xlB1pn_AX1&ZJF~qh)9_ zn!7XORyJzmgq9XKNM^gHX3R-0sWfEO7wRuJX_c`Ba#>Jxsb;&&zx<2w z!O^;_%I_^r6=;8KgVlN$6=fC3D>OivuEX(!1SpOMEB{tQeeydZUS9oU&;gn6IZ1o++#Sd zxe-!a35TW=&O~m2`g##cuS9v7joM?@CL2OM2)o&L_UHZ@b`zNs%t6M#7jC?+b4v)h z3khf42`Y6Oa&+ls4c4+MO`;5b69}iK5*BSb1X8hcmJuzd)`vku9#3B?CS zqoDF`*KM<@D`txq0>%*({H_)Uuz!Jb&oRPHX4K4iCWZ-OJoO0Nc>s;o`EQM;+>U5J zSL~QfP&*MMfxmq@=ZQMPO<|P3N#%GNSR~EIi@J=Lrm}qV@m)R$;cu1ZOjx@0;IDNL z^e?lM%@hC*>PEzEoQax9!sBOcugif^incdGD2wHmbwUsR`TMx8bcE%$2C`wc(ZJ3HkAox#_SDwD?bwBFkL=EHlPz5n|I x`=_tA?!K=jov)uoG+T0K4bK0ujHquUk!2V&geXohIEnAYoOmX3M6Pgz`xARL5x)Qc literal 0 HcmV?d00001 diff --git a/seta_menu/cercaorario/index.html b/seta_menu/cercaorario/index.html new file mode 100644 index 0000000..4ca5d3b --- /dev/null +++ b/seta_menu/cercaorario/index.html @@ -0,0 +1,44 @@ + + + + + SETA Modena - Cerca fermata + + + + + + + +
+ +
+

Visualizzatore orari di arrivo SETA Modena

+ +
+ + +
+
+ + + + \ No newline at end of file diff --git a/seta_menu/cercaorario/js/cercafermata.js b/seta_menu/cercaorario/js/cercafermata.js new file mode 100644 index 0000000..1b47263 --- /dev/null +++ b/seta_menu/cercaorario/js/cercafermata.js @@ -0,0 +1,52 @@ +const searchBar = document.getElementById('searchBar'); +const resultsContainer = document.getElementById('searchResults'); + +let allresults = []; +window.onbeforeunload=searchBar.value=""; + +const url = 'http://setaapi.serverissimo.freeddns.org/stoplist'; +fetch(url) + .then(response => { + if (!response.ok) throw new Error("Errore nel caricamento dei dati."); + return response.json(); + }) + .then(data => { + allresults = data; + }) + .catch(error => console.error('Errore nel caricamento dei dati:', error)); + +searchBar.addEventListener('input', () => { + const searchTerm = searchBar.value.toLowerCase(); + const filtered = allresults.filter(item => + item.fermata.toLowerCase().includes(searchTerm) + ); + renderresults(filtered); +}); + +function renderresults(results) { + const searchResultsContainer = document.getElementById('searchResults'); + searchResultsContainer.innerHTML = ''; + + if (results.length === 0) { + searchResultsContainer.innerHTML = '

Nessun risultato trovato

'; + return; + } + + results.forEach(item => { + const div = document.createElement('div'); + div.className = 'search-result'; + div.innerHTML = ` +
+

${item.fermata}

+

Codice fermata: ${item.valore}

+
+ `; + + div.addEventListener('click', () => { + const url = `fermata.html?code=${encodeURIComponent(item.valore)}&name=${encodeURIComponent(item.fermata)}`; + window.open(url, '_blank'); + }); + + searchResultsContainer.appendChild(div); + }); +} \ No newline at end of file diff --git a/seta_menu/cercaorario/js/fermata.js b/seta_menu/cercaorario/js/fermata.js new file mode 100644 index 0000000..9d58d31 --- /dev/null +++ b/seta_menu/cercaorario/js/fermata.js @@ -0,0 +1,80 @@ +const params = new URLSearchParams(window.location.search); +const nome = params.get('name'); +const codice = params.get('code'); + +//Sets stop name +const fermata_span = document.getElementById('fermata-span'); +fermata_span.innerHTML = `"${nome}"`; + +const urlBackend = `http://setaapi.serverissimo.freeddns.org/arrivals/${codice}`; +function caricadati(){ + fetch(urlBackend) + .then(response => { + if (!response.ok) throw new Error("Errore nel caricamento dei dati."); + return response.json(); + }) + .then(data => { + item = data.arrival; + }) + .then(data => { + + const container = document.getElementById('tabella-container'); + container.innerHTML = ''; + + if (item.error=="no arrivals scheduled in next 90 minutes") { + container.innerHTML = '

Nessuna corsa programmata nei prossimi 90 minuti.

'; + return; + } + // Creo tabella + const table = document.createElement('table'); + + // Intestazione + const thead = document.createElement('thead'); + thead.innerHTML = ` + + Linea + Direzione + Orario + Stato corsa + Veicolo + Ora si trova a: + + `; + table.appendChild(thead); + + // Corpo tabella + const tbody = document.createElement('tbody'); + item.services.forEach(item => { + const tr = document.createElement('tr'); + if(item.type=="planned"){ + var stato="Prevista"; + }else{ + var stato="In tempo reale"; + }if(item.next_stop==null){ + var posizione=""; + }else{ + var posizione=item.next_stop; + } + tr.innerHTML = ` + ${item.service} + ${item.destination} + ${item.arrival} + ${stato} + ${item.busnum} + ${posizione} + `; + tbody.appendChild(tr); + }); + table.appendChild(tbody); + + container.appendChild(table); + }) + .catch(err => { + console.error('Errore nel caricamento dati:', err); + document.getElementById('tabella-container').textContent = 'Errore nel caricamento dati.'; + }); +} + +caricadati(); + +setInterval(caricadati, 60000); \ No newline at end of file diff --git a/sitemap.xml b/sitemap.xml index abf85d5..8097967 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -3,7 +3,7 @@ https://www.ertpl.pages.dev 1.00 - 2025-06-15 + 2025-07-25 https://www.ertpl.pages.dev/pagenotavailable.html diff --git a/style.css b/style.css index 2e25491..981ac44 100644 --- a/style.css +++ b/style.css @@ -142,6 +142,12 @@ nav ul li a { nav ul li a:hover { text-decoration: underline; } + +nav ul li h1.warning { + color:red; + font-size: 16px; +} + .bus{ border: 2px solid; border-style: hidden;