document.addEventListener("DOMContentLoaded", async () => { clearDNSCache() await refreshAll() setInterval(refreshAll, 60000) }) let refreshing = false async function refreshAll(){ if(refreshing) return refreshing = true try{ await loadResources() await loadDomains() await loadMapping() await loadCancelled() loadInfrastructure() loadCosts() // Zeit setzen updateLastUpdate() }catch(e){ console.error("Refresh error", e) document.getElementById("lastUpdate").innerText = "🔴 Fehler beim Update" } refreshing = false } function clearDNSCache(){ for(const key in dnsCache){ delete dnsCache[key] } } function updateLastUpdate(){ const now = new Date() const time = now.toLocaleTimeString() // Lade-Indikator document.getElementById("lastUpdate").innerText = "🟢 Letztes Update: " + time } window.toggleDarkMode = function(){ document.body.classList.toggle("dark") localStorage.setItem( "darkmode", document.body.classList.contains("dark") ) } // beim Start laden document.addEventListener("DOMContentLoaded", () => { if(localStorage.getItem("darkmode") === "true"){ document.body.classList.add("dark") } })