diff --git a/adventskalender/2025/js/popup.js b/adventskalender/2025/js/popup.js
index e5b7d82..47aee57 100644
--- a/adventskalender/2025/js/popup.js
+++ b/adventskalender/2025/js/popup.js
@@ -58,30 +58,33 @@ function openPopup(day) {
popupContent.innerHTML = `
${data.title}
${html}`;
popupOverlay.classList.add("active");
- // Event für background.js
+ // === Event für background.js (nach DOM-Initialisierung) ===
if (day === 1) {
setTimeout(() => {
document.dispatchEvent(new CustomEvent("day01-loaded"));
- }, 100);
+ console.log("[popup.js] Event 'day01-loaded' ausgelöst");
+ }, 300);
}
- // Medien starten
+ // === Medien starten ===
setTimeout(() => {
const bg = popupContent.querySelector("#bgmusic");
const videos = popupContent.querySelectorAll("video");
+ // Hintergrundmusik (nur Tag 1)
if (day === 1 && bg) {
bg.volume = 0.5;
bg.currentTime = 0;
- bg.play().catch(() => {});
+ bg.play().catch(err => console.warn("Audio konnte nicht gestartet werden:", err));
}
+ // Alle Videos im Popup starten (autoplay / loop)
videos.forEach(v => {
v.muted = true;
v.loop = true;
v.play().catch(() => {});
});
- }, 300);
+ }, 500); // 500 ms – Zeit für DOM + Quellen
})
.catch(err => {
popupContent.innerHTML = `${data.title}
${data.content}`;
@@ -94,7 +97,7 @@ function openPopup(day) {
function closePopup() {
popupOverlay.classList.remove("active");
- // Alle Audioelemente im Popup stoppen
+ // Alle Audios im Popup stoppen
popupContent.querySelectorAll("audio").forEach(a => {
a.pause();
a.currentTime = 0;