Fermate rapide cercaorario seta

This commit is contained in:
Leocraft1
2025-08-22 16:36:07 +02:00
parent 00fb028e11
commit 8a8413c37c
2 changed files with 35 additions and 27 deletions

View File

@@ -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>

View File

@@ -19,8 +19,19 @@ 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');
if (searchBar.value == '') {
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))
@@ -32,11 +43,6 @@ searchBar.addEventListener('input', () => {
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>
`;
}
});
@@ -65,7 +71,12 @@ 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>
`;