// VARIABILI DA MODIFICARE - VARIABLES TO MODIFY // const ApiUri = 'PLACEHOLDER'; //JSON Dinamico - Dynamic JSON // IMPORTANTE!! NON MODIFICARE SOTTO!! - IMPORTANT!! DO NOT MODIFY THE CODE BELOW!! // let ultimaRichiesta = null; let intervalloAggiornamento = null; const delay = ms => new Promise(res => setTimeout(res, ms)); async function caricaDati(event = null, richiestaManuale = false) { if (event) event.preventDefault(); const Bacino = document.getElementById("stazione").value; const corpo = document.getElementById("corpoTabella"); const tabella = document.getElementById("tabellaDati"); // Salva la richiesta corrente per i refresh automatici ultimaRichiesta = { Bacino }; // Ottieni la data e l'ora di oggi const oggi = new Date(); const anno = oggi.getFullYear(); const mese = String(oggi.getMonth() + 1).padStart(2, '0'); // i mesi partono da 0 const giorno = String(oggi.getDate()).padStart(2, '0'); const Data = `${anno}-${mese}-${giorno}`; // Scrivi l'URL const url = `${ApiUri}/?Bacino=${Bacino}&Data=${Data}`; try { if (richiestaManuale) { tabella.style.display = "table"; corpo.innerHTML = `