Fixes
This commit is contained in:
parent
53703d0011
commit
eb6e40719f
|
@ -47,7 +47,8 @@
|
||||||
<div class="riga">
|
<div class="riga">
|
||||||
<h2 class="piccolospazio">Ravenna:</h2>
|
<h2 class="piccolospazio">Ravenna:</h2>
|
||||||
<p class="piccolospazio">
|
<p class="piccolospazio">
|
||||||
Ora è possibile visualizzare gli orari fermata in <a class="novita" href="/start_menu/servizi/start-fermatebus/index.html">visualizzatore fermate</a>.<br>
|
Il servizio "visualizzatore fermate" è stato migliorato con un nuovo sistema interno di ricerca e gestione dati fermate. <br>
|
||||||
|
Ora è possibile visualizzare gli orari fermata in <a class="novita" style="pointer-events: none; color: gray;" href="/start_menu/servizi/start-fermatebus/index.html">visualizzatore fermate</a>.<br>
|
||||||
Aggiunti <a class="novita" href="/startravenna_bus/suburbano/manlc19g.html">MAN Lion's City 19G</a>.<br>
|
Aggiunti <a class="novita" href="/startravenna_bus/suburbano/manlc19g.html">MAN Lion's City 19G</a>.<br>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -112,4 +112,10 @@ a {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
border: 1px solid var(--border-color);
|
border: 1px solid var(--border-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0px;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
|
@ -1,10 +1,3 @@
|
||||||
function loadJSON(file, callback) {
|
|
||||||
fetch(file)
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => callback(data))
|
|
||||||
.catch(error => console.error('Errore nel caricare il file JSON:', error));
|
|
||||||
}
|
|
||||||
|
|
||||||
function populateSearchResults(results, selectedOption) {
|
function populateSearchResults(results, selectedOption) {
|
||||||
const searchResultsContainer = document.getElementById('searchResults');
|
const searchResultsContainer = document.getElementById('searchResults');
|
||||||
searchResultsContainer.innerHTML = '';
|
searchResultsContainer.innerHTML = '';
|
||||||
|
@ -57,25 +50,23 @@ document.getElementById('bacino').addEventListener('change', function(event) {
|
||||||
const selectedOption = event.target.value;
|
const selectedOption = event.target.value;
|
||||||
currentSelectedOption = selectedOption;
|
currentSelectedOption = selectedOption;
|
||||||
|
|
||||||
let file = '';
|
if (!selectedOption) {
|
||||||
switch (selectedOption) {
|
allOptions = [];
|
||||||
case 'ra':
|
document.getElementById('searchResults').innerHTML = '';
|
||||||
file = 'js/fermate-ra.json';
|
return;
|
||||||
break;
|
|
||||||
case 'rn':
|
|
||||||
file = 'js/fermate-rn.json';
|
|
||||||
break;
|
|
||||||
case 'fc':
|
|
||||||
file = 'js/fermate-fc.json';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
allOptions = [];
|
|
||||||
document.getElementById('searchResults').innerHTML = '';
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
loadJSON(file, (data) => {
|
const resultsContainer = document.getElementById('searchResults');
|
||||||
allOptions = data;
|
resultsContainer.innerHTML = '<p>Caricamento lista fermate in corso...</p>';
|
||||||
populateSearchResults(allOptions, currentSelectedOption);
|
|
||||||
});
|
fetch(`https://api.vichingo455.freeddns.org/start-fermatebus/bacino?selectedOption=${selectedOption}`)
|
||||||
});
|
.then(res => res.json())
|
||||||
|
.then(data => {
|
||||||
|
allOptions = data;
|
||||||
|
populateSearchResults(allOptions, selectedOption);
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
resultsContainer.innerHTML = '<p>Errore nel caricamento delle fermate.</p>';
|
||||||
|
console.error('Errore:', err);
|
||||||
|
});
|
||||||
|
});
|
|
@ -3,19 +3,21 @@ const palina = params.get('palina');
|
||||||
const targetID = params.get('targetID');
|
const targetID = params.get('targetID');
|
||||||
const selectedOption = params.get('selectedOption');
|
const selectedOption = params.get('selectedOption');
|
||||||
|
|
||||||
const urlBackend = `https://api.vichingo455.freeddns.org/start-fermatebus.json/?param=${targetID}¶m2=${selectedOption}&palina=${palina}`;
|
const urlBackend = `https://api.vichingo455.freeddns.org/start-fermatebus/fermata?param=${targetID}¶m2=${selectedOption}&palina=${palina}`;
|
||||||
//const urlBackend = `http://localhost:3005/?param=${targetID}¶m2=${selectedOption}&palina=${palina}`;
|
//const urlBackend = `http://localhost:3005/fermata?param=${targetID}¶m2=${selectedOption}&palina=${palina}`;
|
||||||
function caricadati(){
|
function caricadati(){
|
||||||
fetch(urlBackend)
|
fetch(urlBackend)
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
const fermata_span = document.getElementById('fermata-span');
|
const fermata_span = document.getElementById('fermata-span');
|
||||||
fermata_span.innerHTML = `"${data[0].fermata}"`;
|
if (data[0] && data[0].fermata !== undefined) {
|
||||||
|
fermata_span.innerHTML = `"${data[0].fermata}"`;
|
||||||
|
}
|
||||||
const container = document.getElementById('tabella-container');
|
const container = document.getElementById('tabella-container');
|
||||||
container.innerHTML = '';
|
container.innerHTML = '';
|
||||||
|
|
||||||
if (!data || data.length === 0) {
|
if (!data || data.length === 0) {
|
||||||
container.textContent = 'Nessun dato trovato.';
|
container.innerHTML = '<h3>Nessuna linea in arrivo.</h3>';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue