Day01 funkction

This commit is contained in:
2025-11-10 14:13:04 +01:00
parent 4d67e724a8
commit 9b350e9431
2 changed files with 29 additions and 1 deletions

View File

@@ -59,9 +59,37 @@ function openPopup(day) {
.then(html => {
popupContent.innerHTML = `<h2>${data.title}</h2>${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 = `<h2>${data.title}</h2>${data.content}`;
popupOverlay.classList.add("active");
console.warn(`Türchen ${day}: HTML konnte nicht geladen werden. Fallback verwendet.`, err);