mirror of
https://github.com/Daniongithub/ER-TPL.git
synced 2025-12-06 17:32:02 +00:00
Deprecato percorrenza seta, l'iframe orari sta in percorsi
This commit is contained in:
@@ -3,6 +3,7 @@ const num = params.get('routenum');
|
||||
const lineaSpan = document.getElementById('linea-span');
|
||||
const iframe = document.getElementById('iframe');
|
||||
const messageDiv = document.getElementById('message');
|
||||
const loadingDiv = document.getElementById('caricamento-div');
|
||||
|
||||
const date = new Date();
|
||||
const todayDate=date.getDate()+"/"+(date.getMonth()+1)+"/"+date.getFullYear();
|
||||
@@ -13,19 +14,36 @@ const diURL = "https://setaapi.serverissimo.freeddns.org/lineedyn_linea_dett_per
|
||||
//Display numero linea
|
||||
lineaSpan.textContent=num;
|
||||
|
||||
//Schermata di caricamento, viene annullata da onload dell'iframe
|
||||
loadingDiv.style.margin="12px";
|
||||
loadingDiv.innerHTML="Caricamento in corso...";
|
||||
iframe.style.display="none";
|
||||
|
||||
//Spawn iframe
|
||||
iframe.setAttribute("src",asURL);
|
||||
if(num==undefined||num==""){
|
||||
iframe.setAttribute("src","");
|
||||
message.innerHTML=`
|
||||
messageDiv.innerHTML=`
|
||||
<p>Non hai specificato nessuna linea nei parametri dell'url</p>
|
||||
`;
|
||||
}
|
||||
|
||||
function setAs(){
|
||||
loadingDiv.style.margin="12px";
|
||||
loadingDiv.innerHTML="Caricamento in corso...";
|
||||
iframe.style.display="none";
|
||||
iframe.setAttribute("src",asURL);
|
||||
}
|
||||
|
||||
function setDi(){
|
||||
loadingDiv.style.margin="12px";
|
||||
loadingDiv.innerHTML="Caricamento in corso...";
|
||||
iframe.style.display="none";
|
||||
iframe.setAttribute("src",diURL);
|
||||
}
|
||||
|
||||
function removeLoading(){
|
||||
loadingDiv.style.margin="";
|
||||
loadingDiv.innerHTML="";
|
||||
iframe.style.display="";
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const num = params.get('routenum');
|
||||
const lineaSpan = document.getElementById('linea-span');
|
||||
const descContainer = document.getElementById('desc-container');
|
||||
const linkContainer = document.getElementById('link-a-seta');
|
||||
|
||||
const urlDesc = "https://setaapi.serverissimo.freeddns.org/frequencydescription/"+num;
|
||||
|
||||
//Display numero linea
|
||||
lineaSpan.innerHTML=num;
|
||||
|
||||
//Contenuto del testo
|
||||
fetch(urlDesc)
|
||||
.then(response => {
|
||||
if (!response.ok) throw new Error("Impossibile raggiungere il server.");
|
||||
return response.json();
|
||||
})
|
||||
.then(data =>{
|
||||
linkContainer.innerHTML=`<a href="iframeorari.html?routenum=${data[0].linea}" class="biancosott">Visualizza tabella e mappa</a>`;
|
||||
descContainer.innerHTML=`
|
||||
<table id="desc-table">
|
||||
<th>Destinazione</th>
|
||||
<th>Tempo di percorrenza (min)</th>
|
||||
<th>Frequenza (min)</th>
|
||||
</table>`;
|
||||
const table = document.getElementById('desc-table');
|
||||
if(data[0].linea==undefined){
|
||||
descContainer.innerHTML="La linea specificata non possiede nessuna descrizione valida.";
|
||||
}
|
||||
var i=0;
|
||||
data[0].destinazioni.forEach(element => {
|
||||
var tr = document.createElement('tr');
|
||||
var td = document.createElement('td');
|
||||
td.innerHTML=data[0].destinazioni[i];
|
||||
tr.appendChild(td);
|
||||
var td = document.createElement('td');
|
||||
td.innerHTML=data[0].percorrenza[i];
|
||||
tr.appendChild(td);
|
||||
var td = document.createElement('td');
|
||||
td.innerHTML=data[0].frequenze[i];
|
||||
tr.appendChild(td);
|
||||
//var td = document.createElement('td');
|
||||
//td.innerHTML=data[0].frequenze_dom[i];
|
||||
//tr.appendChild(td);
|
||||
table.appendChild(tr);
|
||||
i++;
|
||||
});
|
||||
})
|
||||
.catch(error => {descContainer.innerHTML="La linea specificata non possiede nessuna descrizione valida.";console.error(error);})
|
||||
@@ -17,7 +17,7 @@ fetch(url)
|
||||
if(element.includes("(")){
|
||||
result.setAttribute("class","rosso");
|
||||
}
|
||||
result.setAttribute("href","infolinea.html?routenum="+element);
|
||||
result.setAttribute("href","iframeorari.html?routenum="+element);
|
||||
result.innerHTML = `
|
||||
<div class="search-result"><h3>${element}</h3>
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user