mirror of
https://github.com/Daniongithub/ER-TPL.git
synced 2025-10-02 12:10:48 +00:00
Ricerca seta quasi finita
This commit is contained in:
2272
scripts/setabus.json
2272
scripts/setabus.json
File diff suppressed because it is too large
Load Diff
@@ -1,60 +1,60 @@
|
||||
const searchBar = document.getElementById('searchBar');
|
||||
const productsContainer = document.getElementById('bus-container');
|
||||
const buttons = document.getElementById('buttons');
|
||||
const searchBar = document.getElementById('searchBar');
|
||||
const productsContainer = document.getElementById('bus-container');
|
||||
const buttons = document.getElementById('buttons');
|
||||
|
||||
let allProducts = [];
|
||||
let allProducts = [];
|
||||
window.onbeforeunload=searchBar.value="";
|
||||
|
||||
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));
|
||||
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);
|
||||
});
|
||||
searchBar.addEventListener('input', () => {
|
||||
if (searchBar.value == '') {
|
||||
productsContainer.innerHTML = ' ';
|
||||
buttons.innerHTML = `
|
||||
<div>
|
||||
<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);
|
||||
});
|
||||
}
|
||||
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);
|
||||
});
|
||||
}
|
@@ -1,56 +1,57 @@
|
||||
const searchBar = document.getElementById('searchBar');
|
||||
const productsContainer = document.getElementById('bus-container');
|
||||
const buttons = document.getElementById('buttons');
|
||||
const searchBar = document.getElementById('searchBar');
|
||||
const productsContainer = document.getElementById('bus-container');
|
||||
const buttons = document.getElementById('buttons');
|
||||
|
||||
let allProducts = [];
|
||||
let allProducts = [];
|
||||
window.onbeforeunload=searchBar.value="";
|
||||
|
||||
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));
|
||||
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>
|
||||
<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);
|
||||
});
|
||||
searchBar.addEventListener('input', () => {
|
||||
if (searchBar.value == '') {
|
||||
productsContainer.innerHTML = ' ';
|
||||
buttons.innerHTML = `
|
||||
<div class="verticale">
|
||||
<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);
|
||||
});
|
||||
}
|
||||
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