mirror of
https://github.com/Daniongithub/ER-TPL.git
synced 2025-10-02 12:50:47 +00:00
Fermate rapide cercaorario seta
This commit is contained in:
@@ -23,15 +23,6 @@
|
||||
</nav>
|
||||
</header>
|
||||
<h1>Visualizzatore orari di arrivo SETA Modena</h1>
|
||||
<!--
|
||||
<label for="bacino">Bacino:</label>
|
||||
<select id="bacino">
|
||||
<option value="" selected>--Scegli un'opzione--</option>
|
||||
<option value="ra">Ravenna</option>
|
||||
<option value="rn">Rimini</option>
|
||||
<option value="fc">Forlì-Cesena</option>
|
||||
</select>
|
||||
-->
|
||||
<div>
|
||||
<input type="text" id="searchBar" placeholder="Cerca una fermata...">
|
||||
</div>
|
||||
@@ -40,7 +31,13 @@
|
||||
<input type="text" id="stopCodeBar" placeholder="Inserisci un codice fermata...">
|
||||
</div>
|
||||
<p id="warning-mo"><a href="comeleggere.html" style="color: white;">Come leggere il codice fermata.</a></p>
|
||||
<div id="searchResults"></div>
|
||||
|
||||
<div id="searchResults">
|
||||
<h3 style="margin-bottom:4px;">Fermate rapide:</h3>
|
||||
<a href="/seta_menu/cercaorario/altrecorsie.html?location=MODENA AUTOSTAZIONE" class="bianco"><div class="search-result"><h3>Autostazione</h3></div></a>
|
||||
<a href="/seta_menu/cercaorario/altrecorsie.html?location=STAZIONE FS" class="bianco"><div class="search-result"><h3>Stazione FS</h3></div></a>
|
||||
<a href="/seta_menu/cercaorario/altrecorsie.html?location=GARIBALDI" class="bianco"><div class="search-result"><h3>Largo Garibaldi</h3></div></a>
|
||||
</div>
|
||||
<h1 class="yellow-warning">ATTENZIONE! Riportare eventuali discrepanze ai contatti del sito presenti in <a href="https://ertpl.pages.dev/chisiamo">chi siamo</a></h1>
|
||||
<footer>
|
||||
<div>
|
||||
|
@@ -19,24 +19,30 @@ fetch(url)
|
||||
.catch(error => console.error('Errore nel caricamento dei dati:', error));
|
||||
|
||||
searchBar.addEventListener('input', () => {
|
||||
const searchTerm = searchBar.value.toLowerCase();
|
||||
const warning=document.getElementById('warning-mo');
|
||||
warning.innerHTML='';
|
||||
const filtered = allresults
|
||||
.filter(item => item.fermata.toLowerCase().includes(searchTerm))
|
||||
.sort((a, b) => {
|
||||
const aStartsWith = a.fermata.toLowerCase().startsWith(searchTerm);
|
||||
const bStartsWith = b.fermata.toLowerCase().startsWith(searchTerm);
|
||||
if (aStartsWith && !bStartsWith) return -1;
|
||||
if (!aStartsWith && bStartsWith) return 1;
|
||||
return 0;
|
||||
});
|
||||
renderresults(filtered);
|
||||
if (searchBar.value == '') {
|
||||
resultsContainer.innerHTML='';
|
||||
warning.innerHTML = `
|
||||
<p id="warning-mo"><a href="comeleggere.html" style="color: white;">Come leggere il codice fermata.</a></p>
|
||||
resultsContainer.innerHTML=`
|
||||
<h3 style="margin-bottom:4px;">Fermate rapide:</h3>
|
||||
<a href="/seta_menu/cercaorario/altrecorsie.html?location=STAZIONE FS" class="bianco"><div class="search-result"><h3>Autostazione</h3></div></a>
|
||||
<a href="/seta_menu/cercaorario/altrecorsie.html?location=MODENA AUTOSTAZIONE" class="bianco"><div class="search-result"><h3>Stazione FS</h3></div></a>
|
||||
<a href="/seta_menu/cercaorario/altrecorsie.html?location=GARIBALDI" class="bianco"><div class="search-result"><h3>Largo Garibaldi</h3></div></a>
|
||||
`;
|
||||
warning.innerHTML = `
|
||||
<p id="warning-mo"><a href="comeleggere.html" style="color: white;">Come leggere il codice fermata.</a></p>
|
||||
`;
|
||||
}else{
|
||||
const searchTerm = searchBar.value.toLowerCase();
|
||||
warning.innerHTML='';
|
||||
const filtered = allresults
|
||||
.filter(item => item.fermata.toLowerCase().includes(searchTerm))
|
||||
.sort((a, b) => {
|
||||
const aStartsWith = a.fermata.toLowerCase().startsWith(searchTerm);
|
||||
const bStartsWith = b.fermata.toLowerCase().startsWith(searchTerm);
|
||||
if (aStartsWith && !bStartsWith) return -1;
|
||||
if (!aStartsWith && bStartsWith) return 1;
|
||||
return 0;
|
||||
});
|
||||
renderresults(filtered);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -65,9 +71,14 @@ stopCodeBar.addEventListener('input', () => {
|
||||
|
||||
searchResultsContainer.appendChild(div);
|
||||
if (stopCodeBar.value == '') {
|
||||
resultsContainer.innerHTML='';
|
||||
resultsContainer.innerHTML=`
|
||||
<h3 style="margin-bottom:4px;">Fermate rapide:</h3>
|
||||
<a href="" class="bianco"><div class="search-result"><h3>Autostazione</h3></div></a>
|
||||
<a href="" class="bianco"><div class="search-result"><h3>Stazione FS</h3></div></a>
|
||||
<a href="" class="bianco"><div class="search-result"><h3>Largo Garibaldi</h3></div></a>
|
||||
`;
|
||||
warning.innerHTML = `
|
||||
<p id="warning-mo"><a href="comeleggere.html" style="color: white;">Come leggere il codice fermata.</a></p>
|
||||
<p id="warning-mo"><a href="comeleggere.html" style="color: white;">Come leggere il codice fermata.</a></p>
|
||||
`;
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user