diff --git a/adventskalender/2025/assets/sounds/FallingSnow.mp3 b/adventskalender/2025/assets/sounds/FallingSnow.mp3 new file mode 100644 index 0000000..87598eb Binary files /dev/null and b/adventskalender/2025/assets/sounds/FallingSnow.mp3 differ diff --git a/adventskalender/2025/js/popup.js b/adventskalender/2025/js/popup.js index 4bdb94b..5a3608d 100644 --- a/adventskalender/2025/js/popup.js +++ b/adventskalender/2025/js/popup.js @@ -59,9 +59,37 @@ function openPopup(day) { .then(html => { popupContent.innerHTML = `

${data.title}

${html}`; popupOverlay.classList.add("active"); + + // === Tag 1: Soundeffekt + Daumenkino starten === + if (day === 1) { + setTimeout(() => { + try { + // --- Soundeffekt FallingSnow --- + const sound = new Audio("/2025/assets/sounds/FallingSnow.mp3"); + sound.volume = 0.5; + sound.play().catch(() => {}); + + // --- Daumenkino-Video (Fallback-Start) --- + const thumbkino = popupContent.querySelector(".thumbkino-video"); + if (thumbkino) { + thumbkino.muted = true; + thumbkino.loop = true; + thumbkino.play().catch(() => {}); + } + } catch (err) { + console.warn("FallingSnow oder Daumenkino konnten nicht abgespielt werden:", err); + } + }, 250); // leichte Verzögerung nach DOM-Einbindung + } else { + // === alle anderen Tage: nur Video-Autoplay sicherstellen === + setTimeout(() => { + const videos = popupContent.querySelectorAll("video[autoplay]"); + videos.forEach(v => v.play().catch(() => {})); + }, 250); + } }) .catch(err => { - // Fallback auf bekannte JS-Daten + // === Fallback auf Platzhalterinhalt === popupContent.innerHTML = `

${data.title}

${data.content}`; popupOverlay.classList.add("active"); console.warn(`Türchen ${day}: HTML konnte nicht geladen werden. Fallback verwendet.`, err);