function synkRAAD1() { const audios = Array.from(document.querySelectorAll("audio")) .filter(a => { try { const url = new URL(a.currentSrc || a.querySelector("source")?.src || "", window.location.href); return url.pathname.toLowerCase().endsWith(".mp3") && url.pathname.toLowerCase().includes("raad1"); } catch { return false; } }); const LOOP_MINUTES = 60; const LOOP_SECONDS = LOOP_MINUTES * 60; function syncToClock(audio) { const now = new Date(); const secOfHour = now.getMinutes() * 60 + now.getSeconds(); const t = secOfHour % LOOP_SECONDS; if (!isNaN(audio.duration)) { audio.currentTime = Math.min(t, audio.duration - 1); } } audios.forEach(audio => { audio.preload = "auto"; audio.load(); audio.addEventListener("canplaythrough", () => syncToClock(audio), { once: true }); audio.addEventListener("play", () => { syncToClock(audio); }); }); // keep in sync every 12s when paused setInterval(() => { const now = new Date(); const secOfHour = now.getMinutes() * 60 + now.getSeconds(); audios.forEach(audio => { if (audio.paused) { const t = secOfHour % LOOP_SECONDS; audio.currentTime = Math.min(t, audio.duration || LOOP_SECONDS - 1); } }); }, 12000); } document.addEventListener("DOMContentLoaded", synkRAAD1);