From b8b5212bc32feb2f55263b84938056ea6ffd69fa Mon Sep 17 00:00:00 2001 From: Vichingo455 Date: Fri, 11 Apr 2025 15:32:33 +0200 Subject: [PATCH] Fix vari = ricerca per compagnia --- scripts/bus.json | 65 ------------------------------------- scripts/ertpl.js | 23 ------------- scripts/search.js | 54 ------------------------------ scripts/setabus.json | 8 +++++ scripts/setasearch.js | 60 ++++++++++++++++++++++++++++++++++ scripts/startbus.json | 58 +++++++++++++++++++++++++++++++++ scripts/startsearch.js | 57 ++++++++++++++++++++++++++++++++ seta_menu/seta.html | 30 +++++++++++------ start_menu/start.html | 22 +++++++++---- start_menu/startextra.html | 14 ++++---- start_menu/startsub.html | 10 +++--- start_menu/starturbano.html | 16 ++++----- style.css | 30 +++++++++++++++++ 13 files changed, 269 insertions(+), 178 deletions(-) delete mode 100644 scripts/bus.json delete mode 100644 scripts/ertpl.js delete mode 100644 scripts/search.js create mode 100644 scripts/setabus.json create mode 100644 scripts/setasearch.js create mode 100644 scripts/startbus.json create mode 100644 scripts/startsearch.js diff --git a/scripts/bus.json b/scripts/bus.json deleted file mode 100644 index 1d4e3a7..0000000 --- a/scripts/bus.json +++ /dev/null @@ -1,65 +0,0 @@ -[ - { - "matricola": "10108", - "compagnia": "START Romagna", - "settore" : "Extraurbano", - "modello" : "Scania De Simon IL.3", - "link": "startravenna_bus/extraurbano/desimon.html#10108", - "linkmodello": "startravenna_bus/extraurbano/desimon.html", - "linksettore": "start_menu/start_menu/startextra.html" - }, - { - "matricola": "10109", - "compagnia": "START Romagna", - "settore" : "Extraurbano", - "modello" : "Scania De Simon IL.3", - "link": "startravenna_bus/extraurbano/desimon.html#10109", - "linkmodello": "startravenna_bus/extraurbano/desimon.html", - "linksettore": "start_menu/start_menu/startextra.html" - }, - { - "matricola": "10110", - "compagnia": "START Romagna", - "settore" : "Extraurbano", - "modello" : "Scania De Simon IL.3", - "link": "startravenna_bus/extraurbano/desimon.html#10110", - "linkmodello": "startravenna_bus/extraurbano/desimon.html", - "linksettore": "start_menu/start_menu/startextra.html" - }, - { - "matricola": "10111", - "compagnia": "START Romagna", - "settore" : "Extraurbano", - "modello" : "Scania De Simon IL.3", - "link": "startravenna_bus/extraurbano/desimon.html#10111", - "linkmodello": "startravenna_bus/extraurbano/desimon.html", - "linksettore": "start_menu/start_menu/startextra.html" - }, - { - "matricola": "10112", - "compagnia": "START Romagna", - "settore" : "Extraurbano", - "modello" : "Scania De Simon IL.3", - "link": "startravenna_bus/extraurbano/desimon.html#10112", - "linkmodello": "startravenna_bus/extraurbano/desimon.html", - "linksettore": "start_menu/start_menu/startextra.html" - }, - { - "matricola": "10113", - "compagnia": "START Romagna", - "settore" : "Extraurbano", - "modello" : "Scania De Simon IL.3", - "link": "startravenna_bus/extraurbano/desimon.html#10113", - "linkmodello": "startravenna_bus/extraurbano/desimon.html", - "linksettore": "start_menu/start_menu/startextra.html" - }, - { - "matricola": "10114", - "compagnia": "START Romagna", - "settore" : "Extraurbano", - "modello" : "Scania De Simon IL.3", - "link": "startravenna_bus/extraurbano/desimon.html#10114", - "linkmodello": "startravenna_bus/extraurbano/desimon.html", - "linksettore": "start_menu/start_menu/startextra.html" - } -] diff --git a/scripts/ertpl.js b/scripts/ertpl.js deleted file mode 100644 index 991aabb..0000000 --- a/scripts/ertpl.js +++ /dev/null @@ -1,23 +0,0 @@ -/* -The function(s) below are used to fall back to the second (not for importance) server if the first is not available -Swaps both links and images sources -aid = identifier for the anchor (a tag) -imgid = identifier for the image (img tag) -path = path for the image starting from the root, for example /Dani/10225.jpg -*/ -function changeUrlToFallback(aid,imgid,path) { - try { - document.getElementById(imgid).src = "http://serverissimo.freeddns.org:30081/apps/files_sharing/publicpreview/ffdqobqRg2ezKXt?file=" + path + "&x=1920&y=1080&a=true"; - } catch {} - try { - document.getElementById(aid).href = "http://serverissimo.freeddns.org:30081/apps/files_sharing/publicpreview/ffdqobqRg2ezKXt?file=" + path + "&x=1920&y=1080&a=true"; - } catch {} -} -function changeUrlToFallbackNoTrue(aid,imgid,path) { - try { - document.getElementById(imgid).src = "http://serverissimo.freeddns.org:30081/apps/files_sharing/publicpreview/ffdqobqRg2ezKXt?file=" + path + "&x=1920&y=1080"; - } catch {} - try { - document.getElementById(aid).href = "http://serverissimo.freeddns.org:30081/apps/files_sharing/publicpreview/ffdqobqRg2ezKXt?file=" + path + "&x=1920&y=1080"; - } catch {} -} \ No newline at end of file diff --git a/scripts/search.js b/scripts/search.js deleted file mode 100644 index b5d78ec..0000000 --- a/scripts/search.js +++ /dev/null @@ -1,54 +0,0 @@ -const searchBar = document.getElementById('searchBar'); -const productsContainer = document.getElementById('bus-container'); -let allProducts = []; - -const url = '/scripts/bus.json'; // cambia con il tuo URL - -window.onbeforeunload=searchBar.value=""; -fetch(url) - .then(response => { - if (!response.ok) throw new Error("Errore nel caricamento dei dati."); - return response.json(); - }) - .then(data => { - allProducts = data; - //renderProducts(allProducts); - }) - .catch(error => console.error('Errore nel caricamento dei dati:', error)); - -searchBar.addEventListener('input', () => { - if (searchBar.value == '') { - productsContainer.innerHTML = ''; - return; - } - const searchTerm = searchBar.value.toLowerCase(); - const filtered = allProducts.filter(bus => - bus.matricola.toLowerCase().includes(searchTerm) - ); - renderProducts(filtered); -}); -searchBar.addEventListener('click', () => { - if (searchBar.value == '') { - productsContainer.innerHTML = ''; - return; - } - const searchTerm = searchBar.value.toLowerCase(); - const filtered = allProducts.filter(bus => - bus.matricola.toLowerCase().includes(searchTerm) - ); - renderProducts(filtered); -}); - -function renderProducts(products) { - productsContainer.innerHTML = ''; - products.forEach(bus => { - const div = document.createElement('div'); - div.className = 'product-card'; - div.innerHTML = ` -

${bus.matricola}

-

${bus.compagnia} - ${bus.settore}

-

${bus.modello}

- `; - productsContainer.appendChild(div); - }); -} \ No newline at end of file diff --git a/scripts/setabus.json b/scripts/setabus.json new file mode 100644 index 0000000..ca9959f --- /dev/null +++ b/scripts/setabus.json @@ -0,0 +1,8 @@ +[ + { + "matricola": "10108", + "settore" : "Extraurbano", + "modello" : "Scania De Simon IL.3", + "link": "https://ertpl.pages.dev/startravenna_bus/extraurbano/desimon.html#10108" + } +] diff --git a/scripts/setasearch.js b/scripts/setasearch.js new file mode 100644 index 0000000..c85510f --- /dev/null +++ b/scripts/setasearch.js @@ -0,0 +1,60 @@ + const searchBar = document.getElementById('searchBar'); + const productsContainer = document.getElementById('bus-container'); + const buttons = document.getElementById('buttons'); + + let allProducts = []; + + const url = '/scripts/setabus.json'; + fetch(url) + .then(response => { + if (!response.ok) throw new Error("Errore nel caricamento dei dati."); + return response.json(); + }) + .then(data => { + allProducts = data; + }) + .catch(error => console.error('Errore nel caricamento dei dati:', error)); + + searchBar.addEventListener('input', () => { + if (searchBar.value == '') { + productsContainer.innerHTML = ' '; + buttons.innerHTML = ` +
+

Oppure sfoglia una categoria

+ Urbano + Suburbano + Extraurbano + Filobus + Minibus +
+
+
+ Archivio La Linea ATCM + Storico StreetView +
+ `; + return; + } + buttons.innerHTML = ' '; + const searchTerm = searchBar.value.toLowerCase(); + const filtered = allProducts.filter(bus => + bus.matricola.toLowerCase().includes(searchTerm) + ); + renderProducts(filtered); + }); + + function renderProducts(products) { + productsContainer.innerHTML = ''; + products.forEach(bus => { + const div = document.createElement('div'); + div.className = 'product-card'; + div.innerHTML = ` + +

${bus.matricola}

+

${bus.settore}

+

${bus.modello}

+
+ `; + productsContainer.appendChild(div); + }); + } \ No newline at end of file diff --git a/scripts/startbus.json b/scripts/startbus.json new file mode 100644 index 0000000..43bd3d9 --- /dev/null +++ b/scripts/startbus.json @@ -0,0 +1,58 @@ +[ + { + "matricola": "10108", + "settore" : "Extraurbano", + "modello" : "Scania De Simon IL.3", + "link": "/startravenna_bus/extraurbano/desimon.html#10108", + "linkmodello": "/startravenna_bus/extraurbano/desimon.html", + "linksettore": "/start_menu/start_menu/startextra.html" + }, + { + "matricola": "10109", + "settore" : "Extraurbano", + "modello" : "Scania De Simon IL.3", + "link": "/startravenna_bus/extraurbano/desimon.html#10109", + "linkmodello": "/startravenna_bus/extraurbano/desimon.html", + "linksettore": "/start_menu/start_menu/startextra.html" + }, + { + "matricola": "10110", + "settore" : "Extraurbano", + "modello" : "Scania De Simon IL.3", + "link": "/startravenna_bus/extraurbano/desimon.html#10110", + "linkmodello": "/startravenna_bus/extraurbano/desimon.html", + "linksettore": "/start_menu/start_menu/startextra.html" + }, + { + "matricola": "10111", + "settore" : "Extraurbano", + "modello" : "Scania De Simon IL.3", + "link": "/startravenna_bus/extraurbano/desimon.html#10111", + "linkmodello": "/startravenna_bus/extraurbano/desimon.html", + "linksettore": "/start_menu/start_menu/startextra.html" + }, + { + "matricola": "10112", + "settore" : "Extraurbano", + "modello" : "Scania De Simon IL.3", + "link": "/startravenna_bus/extraurbano/desimon.html#10112", + "linkmodello": "/startravenna_bus/extraurbano/desimon.html", + "linksettore": "/start_menu/start_menu/startextra.html" + }, + { + "matricola": "10113", + "settore" : "Extraurbano", + "modello" : "Scania De Simon IL.3", + "link": "/startravenna_bus/extraurbano/desimon.html#10113", + "linkmodello": "/startravenna_bus/extraurbano/desimon.html", + "linksettore": "/start_menu/start_menu/startextra.html" + }, + { + "matricola": "10114", + "settore" : "Extraurbano", + "modello" : "Scania De Simon IL.3", + "link": "/startravenna_bus/extraurbano/desimon.html#10114", + "linkmodello": "/startravenna_bus/extraurbano/desimon.html", + "linksettore": "/start_menu/start_menu/startextra.html" + } +] \ No newline at end of file diff --git a/scripts/startsearch.js b/scripts/startsearch.js new file mode 100644 index 0000000..853a80f --- /dev/null +++ b/scripts/startsearch.js @@ -0,0 +1,57 @@ + const searchBar = document.getElementById('searchBar'); + const productsContainer = document.getElementById('bus-container'); + const buttons = document.getElementById('buttons'); + + let allProducts = []; + + const url = '/scripts/startbus.json'; + fetch(url) + .then(response => { + if (!response.ok) throw new Error("Errore nel caricamento dei dati."); + return response.json(); + }) + .then(data => { + allProducts = data; + }) + .catch(error => console.error('Errore nel caricamento dei dati:', error)); + + searchBar.addEventListener('input', () => { + if (searchBar.value == '') { + productsContainer.innerHTML = ' '; + buttons.innerHTML = ` +
+

Oppure sfoglia una categoria

+

Oppure sfoglia una categoria

+ Urbano + Suburbano + Extraurbano +
+
+
+ Lista mezzi +
+ `; + return; + } + buttons.innerHTML = ' '; + const searchTerm = searchBar.value.toLowerCase(); + const filtered = allProducts.filter(bus => + bus.matricola.toLowerCase().includes(searchTerm) + ); + renderProducts(filtered); + }); + + function renderProducts(products) { + productsContainer.innerHTML = ''; + products.forEach(bus => { + const div = document.createElement('div'); + div.className = 'product-card'; + div.innerHTML = ` + +

${bus.matricola}

+

${bus.modello}

+

${bus.settore}

+ `; + productsContainer.appendChild(div); + }); + } \ No newline at end of file diff --git a/seta_menu/seta.html b/seta_menu/seta.html index 29616bd..7152418 100644 --- a/seta_menu/seta.html +++ b/seta_menu/seta.html @@ -25,17 +25,27 @@

SETA Modena

-
- Urbano - Suburbano - Extraurbano - Filobus - Minibus +
+

Cerca una matricola

+ +
-
-
- Archivio La Linea ATCM - Storico StreetView +
+
+
+

Oppure sfoglia una categoria

+ Urbano + Suburbano + Extraurbano + Filobus + Minibus +
+
+
+ Archivio La Linea ATCM + Storico StreetView +
+ \ No newline at end of file diff --git a/start_menu/start.html b/start_menu/start.html index 01ba2e3..18993a3 100644 --- a/start_menu/start.html +++ b/start_menu/start.html @@ -23,13 +23,23 @@

START Romagna - Bacino di Ravenna

- Urbano - Suburbano - Extraurbano +

Cerca una matricola

+ +
-
-
- Lista mezzi +
+
+
+

Oppure sfoglia una categoria

+ Urbano + Suburbano + Extraurbano +
+
+
+ \ No newline at end of file diff --git a/start_menu/startextra.html b/start_menu/startextra.html index b1de3bb..db4790c 100644 --- a/start_menu/startextra.html +++ b/start_menu/startextra.html @@ -19,7 +19,7 @@ @@ -28,29 +28,29 @@

10108-10125
Scania De Simon IL.3

- Server foto non raggiungibile. + Server foto non raggiungibile.

34231-34267
Iveco Crossway LE 12m

- Server foto non raggiungibile. + Server foto non raggiungibile.

34301-34304
Iveco Crossway LE 13m

- Server foto non raggiungibile. + Server foto non raggiungibile.

34411-34435
Scania Irizar i4 LNG 12m

- Server foto non raggiungibile. + Server foto non raggiungibile.

34441-34446
Iveco Crossway LE CNG 12m 2023

- Server foto non raggiungibile. + Server foto non raggiungibile.

34451-34499
Iveco Crossway LE CNG 12m

- Server foto non raggiungibile. + Server foto non raggiungibile. diff --git a/start_menu/startsub.html b/start_menu/startsub.html index 0e58d11..f6e5bfb 100644 --- a/start_menu/startsub.html +++ b/start_menu/startsub.html @@ -19,7 +19,7 @@ @@ -28,21 +28,21 @@

10418-10431
Irisbus Citelis CNG (non-EEV)

- Server foto non raggiungibile. + Server foto non raggiungibile.

10432-10443
Irisbus Citelis CNG (EEV) + Dimostrativo

- Server foto non raggiungibile. + Server foto non raggiungibile.

10444
Iveco Urbanway 12m CNG

- Server foto non raggiungibile. + Server foto non raggiungibile.

36101-36109
MAN Lion's City A40 GL CNG

- Server foto non raggiungibile. + Server foto non raggiungibile. diff --git a/start_menu/starturbano.html b/start_menu/starturbano.html index 2ba9552..e66863c 100644 --- a/start_menu/starturbano.html +++ b/start_menu/starturbano.html @@ -19,7 +19,7 @@ @@ -28,35 +28,35 @@

10219-10235 10240-10242
BredaMenariniBus M231 CNG

- Server foto non raggiungibile. + Server foto non raggiungibile.

10243-10246
BredaMenariniBus Vivacity CNG

- Server foto non raggiungibile. + Server foto non raggiungibile.

10445-10448
Iveco Urbanway 12m CNG

- Server foto non raggiungibile. + Server foto non raggiungibile.

32051
Iveco Urbanway 10.5 CNG

- Server foto non raggiungibile. + Server foto non raggiungibile.

32301-32323
MenariniBus Citymood 12 CNG

- Server foto non raggiungibile. + Server foto non raggiungibile.

32401
Iveco Urbanway 12 CNG Dimostrativo

- Server foto non raggiungibile. + Server foto non raggiungibile.

37111-37149
Karsan e-ATAK

- Server foto non raggiungibile. + Server foto non raggiungibile. diff --git a/style.css b/style.css index f68f0b1..5b83815 100644 --- a/style.css +++ b/style.css @@ -241,4 +241,34 @@ table.image-table img { } .lista-mezzi tbody tr.trasferito{ background-color: blue; +} +/* Zona ricerca */ +#bus-container a{ + text-decoration: none; +} +.product-card { + padding: 10px; + margin: 10px; + border: 1px solid #ccc; + border-radius: 8px; + background-color: #282828; + width: 300px; +} + +.product-card img { + width: 100%; + height: auto; + border-radius: 6px; +} + +#bus-container { + display: flex; + flex-wrap: wrap; +} + +#searchBar { + padding: 10px; + width: 300px; + margin: 20px; + font-size: 16px; } \ No newline at end of file