mirror of
https://github.com/Daniongithub/ER-TPL.git
synced 2025-10-02 12:10:48 +00:00
Fix vari = ricerca per compagnia
This commit is contained in:
@@ -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"
|
||||
}
|
||||
]
|
@@ -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 {}
|
||||
}
|
@@ -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 = `
|
||||
<a href="${bus.link}"><h3>${bus.matricola}</h3></a>
|
||||
<a href="${bus.linksettore}"><p>${bus.compagnia} - ${bus.settore}</p></a>
|
||||
<a href="${bus.linkmodello}"><p>${bus.modello}</p></a>
|
||||
`;
|
||||
productsContainer.appendChild(div);
|
||||
});
|
||||
}
|
8
scripts/setabus.json
Normal file
8
scripts/setabus.json
Normal file
@@ -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"
|
||||
}
|
||||
]
|
60
scripts/setasearch.js
Normal file
60
scripts/setasearch.js
Normal file
@@ -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 = `
|
||||
<div>
|
||||
<h3>Oppure sfoglia una categoria</h3>
|
||||
<a href="/seta_menu/setaurbano.html" class="button">Urbano</a>
|
||||
<a href="/seta_menu/setasub.html" class="button">Suburbano</a>
|
||||
<a href="/seta_menu/setaextra.html" class="button">Extraurbano</a>
|
||||
<a href="/seta_menu/setafilobus.html" class="button">Filobus</a>
|
||||
<a href="/setamodena_bus/minibus/sprinter.html" class="button">Minibus</a>
|
||||
</div>
|
||||
<div style="height: 35px;"></div>
|
||||
<div>
|
||||
<a class="gbutton" href="atcmlalinea.html">Archivio La Linea ATCM</a>
|
||||
<a class="gbutton" href="setastreetview.html">Storico StreetView</a>
|
||||
</div>
|
||||
`;
|
||||
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 = `
|
||||
<a href="${bus.link}">
|
||||
<h3>${bus.matricola}</h3>
|
||||
<p>${bus.settore}</p>
|
||||
<p>${bus.modello}</p>
|
||||
</a>
|
||||
`;
|
||||
productsContainer.appendChild(div);
|
||||
});
|
||||
}
|
58
scripts/startbus.json
Normal file
58
scripts/startbus.json
Normal file
@@ -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"
|
||||
}
|
||||
]
|
57
scripts/startsearch.js
Normal file
57
scripts/startsearch.js
Normal file
@@ -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 = `
|
||||
<div class="verticale">
|
||||
<h3>Oppure sfoglia una categoria</h3>
|
||||
<h3>Oppure sfoglia una categoria</h3>
|
||||
<a href="/start_menu/starturbano.html" class="button">Urbano</a>
|
||||
<a href="/start_menu/startsub.html" class="button">Suburbano</a>
|
||||
<a href="/start_menu/startextra.html" class="button">Extraurbano</a>
|
||||
</div>
|
||||
<div style="height: 35px;"></div>
|
||||
<div>
|
||||
<a class="gbutton" href="/startravenna_bus/listamezzi.html">Lista mezzi</a>
|
||||
</div>
|
||||
`;
|
||||
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 = `
|
||||
<a href="${bus.link}">
|
||||
<h3>${bus.matricola}</h3>
|
||||
<p>${bus.modello}</p>
|
||||
<p>${bus.settore}</p></a>
|
||||
`;
|
||||
productsContainer.appendChild(div);
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user