Verzweiflungstat
This commit is contained in:
@@ -58,30 +58,33 @@ function openPopup(day) {
|
||||
popupContent.innerHTML = `<h2>${data.title}</h2>${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 = `<h2>${data.title}</h2>${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;
|
||||
|
||||
Reference in New Issue
Block a user