mirror of
https://github.com/Daniongithub/ER-TPL.git
synced 2025-12-06 10:22:02 +00:00
Compare commits
2 Commits
91a0be6b54
...
1eb159f632
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1eb159f632 | ||
|
|
dba381fa8e |
@@ -22,7 +22,7 @@ body {
|
||||
}
|
||||
|
||||
#iframe{
|
||||
width: 100%;
|
||||
width: 97%;
|
||||
}
|
||||
|
||||
table{
|
||||
@@ -170,9 +170,6 @@ img{
|
||||
table {
|
||||
width: 100%;
|
||||
}
|
||||
h2{
|
||||
margin-bottom: 0;
|
||||
}
|
||||
h2.noreduction{
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
@@ -21,13 +21,13 @@
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
<h2>Orari oggi linea: <span id="linea-span"></span></h2>
|
||||
<iframe id="iframe" src="https://setaapi.serverissimo.freeddns.org/lineedyn_linea_dett_percorsi" frameborder="0" height="500" width="500"></iframe>
|
||||
<h2>Orari e mappa linea: <span id="linea-span"></span></h2>
|
||||
<iframe id="iframe" src="" frameborder="0" onload="javascript:adattaIframe();"></iframe>
|
||||
<script src="js/iframeorari.js"></script>
|
||||
<footer>
|
||||
<div>
|
||||
<p>Copyright (C) 2025 ER-TPL Team - <a href="https://ertpl.pages.dev" target="_blank">ertpl.pages.dev</a> - code by Il Dani & SetaModenaFanpage <a href="https://github.com/Leocraft1/SetaAPI" target="_blank">Codice Sorgente</a> - I loghi SETA Spa sono marchi registrati e sono inseriti in questo sito solo a scopo di illustrazione.</p>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="js/iframeorari.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,46 +1,25 @@
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const num = params.get('routenum');
|
||||
const lineaSpan = document.getElementById('linea-span');
|
||||
const iframeContainer = document.getElementById('iframe-container');
|
||||
const iframe = document.getElementById('iframe');
|
||||
const linkContainer = document.getElementById('link-a-seta');
|
||||
|
||||
var setaURL = "https://setaapi.serverissimo.freeddns.org/frequencydescription/"+num;
|
||||
const date = new Date();
|
||||
const todayDate=date.getDate()+"/"+(date.getMonth()+1)+"/"+date.getFullYear();
|
||||
|
||||
const baseURL = "https://setaapi.serverissimo.freeddns.org/lineedyn_linea_dett_percorsi/?b=mo&l=MO"+num+"&dd="+todayDate+"&v=As";
|
||||
|
||||
//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 =>{
|
||||
descContainer.innerHTML=`
|
||||
<table id="desc-table">
|
||||
<th>Destinazione</th>
|
||||
<th>Tempo di percorrenza</th>
|
||||
<th>Frequenza</th>
|
||||
</table>`;
|
||||
const table = document.getElementById('desc-table');
|
||||
if(data[0].linea==undefined){
|
||||
descContainer.innerHTML="La linea specificata non possiede nessuna descrizione valida.";
|
||||
//Spawn iframe
|
||||
iframe.setAttribute("src",baseURL);
|
||||
setTimeout(function(){}, 2000);
|
||||
|
||||
//Adatta altezza iframe da codice injectato
|
||||
window.addEventListener("message", (event) => {
|
||||
if (event.origin !== "https://setaapi.serverissimo.freeddns.org/lineedyn_linea_dett_percorsi") return; // sicurezza
|
||||
if (event.data?.type === "resize") {
|
||||
frame.style.height = event.data.height + "px";
|
||||
}
|
||||
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);
|
||||
table.appendChild(tr);
|
||||
i++;
|
||||
});
|
||||
linkContainer.innerHTML=`<a href="${data[0].linkseta}" class="biancosott">Visualizza sul sito seta</a>`;
|
||||
})
|
||||
.catch(error => {descContainer.innerHTML="La linea specificata non possiede nessuna descrizione valida.";console.error(error);})
|
||||
});
|
||||
Reference in New Issue
Block a user