From ee6fd0b28398c5304dfd36efcad3b8c9a31559ce Mon Sep 17 00:00:00 2001 From: Vichingo455 Date: Tue, 20 May 2025 12:20:21 +0200 Subject: [PATCH] Fix vari e TPER work in progress --- .vscode/settings.json | 3 ++- LICENSE | 2 +- index.html | 4 ++-- ravenna_menu/mete.html | 2 +- scripts/tperbus.json | 6 +++++ scripts/tpersearch.js | 52 ++++++++++++++++++++++++++++++++++++++++++ todo.txt | 5 +--- tper_menu/tper.html | 12 ++++++++-- 8 files changed, 75 insertions(+), 11 deletions(-) create mode 100644 scripts/tperbus.json create mode 100644 scripts/tpersearch.js diff --git a/.vscode/settings.json b/.vscode/settings.json index 5cfb974..3ad3550 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,4 @@ { - "liveServer.settings.port": 5500 + "liveServer.settings.port": 5500, + "remove-empty-lines.allowedNumberOfEmptyLines": 500 } diff --git a/LICENSE b/LICENSE index 85a3acf..a86256d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 Curry141 +Copyright (c) 2025 ER-TPL Team Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/index.html b/index.html index 9341445..4925fba 100644 --- a/index.html +++ b/index.html @@ -41,7 +41,7 @@

SETA:

- Nuove foto interni Integro + Nuove foto interni Integro
Aggiunto pulsante video Integro

@@ -49,7 +49,7 @@

Ravenna:

Aggiunti Iveco Urbanway 12 Mild Hybrid CNG.
- Aggiunti link alla lista mezzi. + Aggiunti link alla lista mezzi.

diff --git a/ravenna_menu/mete.html b/ravenna_menu/mete.html index 8fc16b2..9d6c5a2 100644 --- a/ravenna_menu/mete.html +++ b/ravenna_menu/mete.html @@ -31,7 +31,7 @@ Gamberini Pollini Zaganelli - Cooperativa Trasporti di Riolo Terme + Riolo Terme
diff --git a/scripts/tperbus.json b/scripts/tperbus.json new file mode 100644 index 0000000..af6c54d --- /dev/null +++ b/scripts/tperbus.json @@ -0,0 +1,6 @@ +{ + "matricola": "placeholderMatricola", + "settore": "placeholderSettore", + "modello": "placeholderModello", + "link": "placeholderLink" +} \ No newline at end of file diff --git a/scripts/tpersearch.js b/scripts/tpersearch.js new file mode 100644 index 0000000..bc46d3a --- /dev/null +++ b/scripts/tpersearch.js @@ -0,0 +1,52 @@ +const searchBar = document.getElementById('searchBar'); +const productsContainer = document.getElementById('bus-container'); +const buttons = document.getElementById('buttons'); + +let allProducts = []; +window.onbeforeunload=searchBar.value=""; + +const url = '/scripts/tperbus.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 = ` +
+ Suburbano + Extraurbano +
+ `; + 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/todo.txt b/todo.txt index 7b84f00..ebac228 100644 --- a/todo.txt +++ b/todo.txt @@ -1,6 +1,3 @@ citarole articolo la linea integro cercare articolo -ares cercare articolo - -Dani: -fallback menu no true quando leo sistemerĂ  Iliad \ No newline at end of file +ares cercare articolo \ No newline at end of file diff --git a/tper_menu/tper.html b/tper_menu/tper.html index b3090cf..292424c 100644 --- a/tper_menu/tper.html +++ b/tper_menu/tper.html @@ -26,8 +26,16 @@

TPER

- Suburbano - Extraurbano + +
+
+
+ +
+ \ No newline at end of file