mirror of
https://github.com/Daniongithub/ER-TPL.git
synced 2025-12-06 23:12:01 +00:00
Integrazione iframeorari in percorsi + fix navbar percorsi @media
This commit is contained in:
49
seta_menu/percorsi/js/iframeorari.js
Normal file
49
seta_menu/percorsi/js/iframeorari.js
Normal file
@@ -0,0 +1,49 @@
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
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();
|
||||
|
||||
const asURL = "https://setaapi.serverissimo.freeddns.org/lineedyn_linea_dett_percorsi/?b=mo&l=MO"+num+"&dd="+todayDate+"&v=As";
|
||||
const diURL = "https://setaapi.serverissimo.freeddns.org/lineedyn_linea_dett_percorsi/?b=mo&l=MO"+num+"&dd="+todayDate+"&v=Di";
|
||||
|
||||
//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","");
|
||||
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,9 +1,18 @@
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const container = document.getElementById('res-container');
|
||||
const id = params.get('routenum');
|
||||
const nav = document.getElementById('rcodes-nav')
|
||||
|
||||
const url = "https://setaapi.serverissimo.freeddns.org/routecodesarchive";
|
||||
|
||||
//Spawn iframeorari
|
||||
if(id!=undefined&&id!=""){
|
||||
const ul = document.createElement('ul');
|
||||
ul.setAttribute("style","flex:1;justify-content: right;");
|
||||
ul.innerHTML=`<li><a href="/seta_menu/percorsi/iframeorari.html?routenum=${id}"><h1 style="font-size: 100%;font-weight: 500;">Orari e mappa di oggi</h1></a></li>`;
|
||||
nav.appendChild(ul);
|
||||
}
|
||||
|
||||
//Elenco percorsi
|
||||
fetch(url)
|
||||
.then(response => {
|
||||
|
||||
Reference in New Issue
Block a user