From 139fd1404c0169b38e1c6be9bc2139fd8c7bd4b8 Mon Sep 17 00:00:00 2001 From: Bratonien Cosplay Date: Sun, 9 Nov 2025 22:25:03 +0100 Subject: [PATCH] Fehlerkorrekturen popup.js --- adventskalender/2025/js/popup.js | 48 +++++++++++++++----------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/adventskalender/2025/js/popup.js b/adventskalender/2025/js/popup.js index e100b68..2d135f8 100644 --- a/adventskalender/2025/js/popup.js +++ b/adventskalender/2025/js/popup.js @@ -5,6 +5,16 @@ const popupBox = document.getElementById("popup-box"); const popupContent = document.getElementById("popup-content"); const popupClose = document.getElementById("popup-close"); +// === Platzhalterfunktion === +function placeholder(text) { + return ` +
+

${text}

+

(Inhalt wird noch produziert)

+
+ `; +} + // === Inhalte 1–24 (Platzhalter) === const popupData = { 1: { title: "🎁 Adventskalenderstart + Daumenkino", content: placeholder("QR-Code zum Daumenkino & Intro-Post") }, @@ -33,13 +43,13 @@ const popupData = { 24: { title: "🎬 Danke & Geschenk", content: placeholder("Finale Video & Freebie folgen") } }; -// === Platzhalterfunktion === +// === Türchen öffnen – HTML laden oder Fallback === function openPopup(day) { const data = popupData[day]; if (!data) return; const tag = String(day).padStart(2, '0'); - const url = `/2025/inhalte/tag${tag}.html`; + const url = `/2025/content/tag${tag}.html`; fetch(url) .then(res => { @@ -58,27 +68,7 @@ function openPopup(day) { }); } -// === Öffnen / Schließen === -function openPopup(day) { - const data = popupData[day]; - if (!data) return; - popupContent.innerHTML = `

${data.title}

${data.content}`; - popupOverlay.classList.add("active"); -} - -popupClose.addEventListener("click", () => popupOverlay.classList.remove("active")); -popupOverlay.addEventListener("click", e => { - if (e.target === popupOverlay) popupOverlay.classList.remove("active"); -}); - -// === Exportfunktion für door-open.js === -window.openPopup = openPopup; - - -// ============================================================ -// Ergänzung: Gesperrte Türchen – Popup mit Zufallsspruch + Countdown-Angabe -// ============================================================ - +// === Gesperrte Türchen – Zufallsspruch + Countdown === window.showLockedPopup = function (day) { const sprueche = [ "🎁 Na na na, hier wird nicht geschummelt!", @@ -94,7 +84,6 @@ window.showLockedPopup = function (day) { const zufall = sprueche[Math.floor(Math.random() * sprueche.length)]; - // Zeitpunkt berechnen const yearMatch = document.title.match(/\d{4}/); const year = yearMatch ? parseInt(yearMatch[0], 10) : new Date().getFullYear(); const unlockDate = new Date(year, 11, parseInt(day, 10), 0, 0, 0); // 11 = Dezember @@ -120,4 +109,13 @@ window.showLockedPopup = function (day) { `; popupOverlay.classList.add("active"); -}; \ No newline at end of file +}; + +// === Schließen === +popupClose.addEventListener("click", () => popupOverlay.classList.remove("active")); +popupOverlay.addEventListener("click", e => { + if (e.target === popupOverlay) popupOverlay.classList.remove("active"); +}); + +// === Export für door-open.js === +window.openPopup = openPopup; \ No newline at end of file