diff --git a/CLAUDE.md b/CLAUDE.md index aebb1c2..b8da1b2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -176,8 +176,8 @@ Each route has dedicated `head.gohtml` and `body.gohtml` files following Go temp **JavaScript Stack**: - **HTMX**: Core interactivity and AJAX requests - **Alpine.js**: Lightweight reactivity for UI components -- **Custom Extensions**: HTMX plugins for response targets, client-side templates, loading states -- **Scrollspy System**: Advanced navigation for agents/authors pages with multi-item highlighting +- **Modular Architecture**: ES6 modules with focused responsibilities +- **Web Components**: Custom elements for self-contained functionality - **Build Tool**: Vite for module bundling and development server **CSS Stack**: @@ -186,6 +186,13 @@ Each route has dedicated `head.gohtml` and `body.gohtml` files following Go temp - **RemixIcon**: Icon font library - **Custom Fonts**: Typography setup in `assets/css/fonts.css` +**JavaScript Module Structure**: +- **`main.js`**: Entry point, HTMX event handling, citation link management, page backdrop styling +- **`akteure.js`**: AkteureScrollspy web component for agents/authors navigation +- **`issue.js`**: Newspaper layout, page navigation, modal functions, citation generation +- **`single-page-viewer.js`**: SinglePageViewer web component for image modal display +- **`scroll-to-top.js`**: ScrollToTopButton web component for floating scroll button + **Build Process**: - **Source**: `transform/main.js` and `transform/site.css` - **Output**: Compiled to `assets/scripts.js` and `assets/style.css` diff --git a/views/assets/scripts.js b/views/assets/scripts.js index a4050bf..77ac7a4 100644 --- a/views/assets/scripts.js +++ b/views/assets/scripts.js @@ -1,602 +1,162 @@ -const W = "script[xslt-onload]", P = "xslt-template", Z = "xslt-transformed", L = /* @__PURE__ */ new Map(); -function I() { - let n = htmx.findAll(W); - for (let e of n) - F(e); -} -function F(n) { - if (n.getAttribute(Z) === "true" || !n.hasAttribute(P)) - return; - let e = "#" + n.getAttribute(P), t = L.get(e); - if (!t) { - let a = htmx.find(e); - if (a) { - let s = a.innerHTML ? new DOMParser().parseFromString(a.innerHTML, "application/xml") : a.contentDocument; - t = new XSLTProcessor(), t.importStylesheet(s), L.set(e, t); - } else - throw new Error("Unknown XSLT template: " + e); +class H extends HTMLElement { + constructor() { + super(), this.scrollHandler = null, this.scrollTimeout = null, this.clickHandlers = [], this.manualNavigation = !1; } - let o = new DOMParser().parseFromString(n.innerHTML, "application/xml"), i = t.transformToFragment(o, document), r = new XMLSerializer().serializeToString(i); - n.outerHTML = r; -} -function _() { - document.querySelectorAll("template[simple]").forEach((e) => { - let t = e.getAttribute("id"), o = e.content; - customElements.define( - t, - class extends HTMLElement { - constructor() { - super(), this.appendChild(o.cloneNode(!0)), this.slots = this.querySelectorAll("slot"); - } - connectedCallback() { - let i = []; - this.slots.forEach((r) => { - let a = r.getAttribute("name"), s = this.querySelector(`[slot="${a}"]`); - s && (r.replaceWith(s.cloneNode(!0)), i.push(s)); - }), i.forEach((r) => { - r.remove(); - }); - } - } - ); - }); -} -window.highlightObserver = window.highlightObserver || null; -window.currentPageContainers = window.currentPageContainers || []; -window.currentActiveIndex = window.currentActiveIndex || 0; -window.pageObserver = window.pageObserver || null; -window.scrollTimeout = window.scrollTimeout || null; -function U() { - window.highlightObserver && (window.highlightObserver.disconnect(), window.highlightObserver = null); - const n = document.querySelectorAll(".newspaper-page-container"); - window.highlightObserver = new IntersectionObserver( - (e) => { - H(); - }, - { - rootMargin: "-20% 0px -70% 0px" - } - ), n.forEach((e) => { - window.highlightObserver.observe(e); - }); -} -function H() { - const n = []; - document.querySelectorAll(".newspaper-page-container").forEach((t) => { - const o = t.getBoundingClientRect(), i = window.innerHeight, r = Math.max(o.top, 0), a = Math.min(o.bottom, i), s = Math.max(0, a - r), l = o.height, d = s / l >= 0.5, g = t.querySelector("img[data-page]"), u = g ? g.getAttribute("data-page") : "unknown"; - d && g && u && !n.includes(u) && n.push(u); - }), X(n), n.length > 0 && $(n); -} -function X(n) { - document.querySelectorAll(".continuation-entry").forEach((e) => { - e.style.display = "none"; - }), n.forEach((e) => { - const t = document.querySelector(`[data-page-container="${e}"]`); - t && t.querySelectorAll(".continuation-entry").forEach((i) => { - i.style.display = ""; - }); - }), G(n), Y(); -} -function G(n) { - document.querySelectorAll(".work-title").forEach((e) => { - const t = e.getAttribute("data-short-title"); - t && (e.textContent = t); - }), n.forEach((e) => { - const t = document.querySelector(`[data-page-container="${e}"]`); - t && t.querySelectorAll(".work-title").forEach((i) => { - const r = i.getAttribute("data-full-title"); - r && r !== i.getAttribute("data-short-title") && (i.textContent = r); - }); - }); -} -function Y() { - document.querySelectorAll(".page-entry").forEach((n) => { - const e = n.querySelectorAll(".inhalts-entry"); - let t = !1; - e.forEach((o) => { - window.getComputedStyle(o).display !== "none" && (t = !0); - }), t ? n.style.display = "" : n.style.display = "none"; - }); -} -function q(n) { - $([n]); -} -function $(n) { - console.log("markCurrentPagesInInhaltsverzeichnis called with:", n), document.querySelectorAll("[data-page-container]").forEach((t) => { - t.hasAttribute("data-beilage") ? (t.classList.remove("border-red-500"), t.classList.add("border-amber-400")) : (t.classList.remove("border-red-500"), t.classList.add("border-slate-300")); - }), document.querySelectorAll(".page-number-inhalts").forEach((t) => { - t.classList.remove("text-red-600", "font-bold"), t.classList.add("text-slate-700", "font-semibold"), t.style.textDecoration = "", t.style.pointerEvents = "", t.classList.contains("bg-blue-50") ? t.classList.add("hover:bg-blue-100") : t.classList.contains("bg-amber-50") && t.classList.add("hover:bg-amber-100"), !t.classList.contains("bg-amber-50") && !t.classList.contains("bg-blue-50") && t.classList.add("bg-blue-50"); - }), document.querySelectorAll(".inhalts-entry").forEach((t) => { - t.classList.add("hover:bg-slate-100"), t.style.cursor = ""; - }), document.querySelectorAll('.inhalts-entry a[href*="/"]').forEach((t) => { - t.classList.remove("no-underline"), t.classList.contains("bg-blue-50") && t.classList.add("hover:bg-blue-100"); - }); - const e = []; - n.forEach((t) => { - const o = document.querySelector( - `.page-number-inhalts[data-page-number="${t}"]` - ); - if (o) { - o.classList.remove("text-slate-700", "hover:bg-blue-100", "hover:bg-amber-100"), o.classList.add("text-red-600", "font-bold"), o.style.textDecoration = "none", o.style.pointerEvents = "none", e.push(o); - const i = document.querySelector(`[data-page-container="${t}"]`); - i && (i.classList.remove("border-slate-300", "border-amber-400"), i.classList.add("border-red-500")); - const r = o.closest(".page-entry"); - r && (r.querySelectorAll(".inhalts-entry").forEach((s) => { - s.classList.remove("hover:bg-slate-100"), s.style.cursor = "default"; - }), r.querySelectorAll('a[href*="/"]').forEach((s) => { - s.getAttribute("aria-current") === "page" && (s.style.textDecoration = "none", s.style.pointerEvents = "none", s.classList.add("no-underline"), s.classList.remove("hover:bg-blue-100")); - })); - } - }), e.length > 0 && J(e[0]), document.querySelectorAll(".page-indicator").forEach((t) => { - t.classList.remove("text-red-600", "font-bold"), t.classList.add("text-slate-600", "font-semibold"), t.classList.contains("bg-amber-50") || t.classList.add("bg-blue-50"); - }), n.forEach((t) => { - const o = document.querySelector(`.page-indicator[data-page="${t}"]`); - o && (o.classList.remove("text-slate-600"), o.classList.add("text-red-600", "font-bold")); - }); -} -function J(n) { - const e = n.closest(".lg\\:overflow-y-auto"); - if (e) { - const t = e.getBoundingClientRect(), o = n.getBoundingClientRect(), i = o.top < t.top, r = o.bottom > t.bottom; - (i || r) && n.scrollIntoView({ - behavior: "smooth", - block: "center" - }); + connectedCallback() { + setTimeout(() => { + this.initializeScrollspyAfterDelay(); + }, 100); } -} -function Q(n, e, t, o = null) { - let i = document.querySelector("single-page-viewer"); - i || (i = document.createElement("single-page-viewer"), document.body.appendChild(i)); - const r = n.closest('[data-beilage="true"]') !== null, a = window.templateData && window.templateData.targetPage ? window.templateData.targetPage : 0; - i.show(n.src, n.alt, e, r, a, o); -} -function M() { - document.getElementById("pageModal").classList.add("hidden"); -} -function ee() { - if (window.pageObserver && (window.pageObserver.disconnect(), window.pageObserver = null), window.currentPageContainers = Array.from(document.querySelectorAll(".newspaper-page-container")), window.currentActiveIndex = 0, v(), document.querySelector(".newspaper-page-container")) { - let e = /* @__PURE__ */ new Set(); - window.pageObserver = new IntersectionObserver( - (t) => { - if (t.forEach((o) => { - const i = window.currentPageContainers.indexOf(o.target); - i !== -1 && (o.isIntersecting ? e.add(i) : e.delete(i)); - }), e.size > 0) { - const i = Array.from(e).sort((r, a) => r - a)[0]; - i !== window.currentActiveIndex && (window.currentActiveIndex = i, v()); - } - }, - { - rootMargin: "-20% 0px -70% 0px" - } - ), window.currentPageContainers.forEach((t) => { - window.pageObserver.observe(t); - }); - } -} -function te() { - if (window.currentActiveIndex > 0) { - let n = -1; - const e = []; - window.currentPageContainers.forEach((o, i) => { - const r = o.getBoundingClientRect(), a = window.innerHeight, s = Math.max(r.top, 0), l = Math.min(r.bottom, a), c = Math.max(0, l - s), d = r.height; - c / d >= 0.3 && e.push(i); - }); - const t = Math.min(...e); - for (let o = t - 1; o >= 0; o--) - if (!e.includes(o)) { - n = o; - break; - } - n === -1 && t > 0 && (n = t - 1), n >= 0 && (window.currentActiveIndex = n, window.currentPageContainers[window.currentActiveIndex].scrollIntoView({ - behavior: "smooth", - block: "start" - }), setTimeout(() => { - v(); - }, 100)); - } -} -function ne() { - if (window.currentActiveIndex < window.currentPageContainers.length - 1) { - let n = -1; - const e = []; - window.currentPageContainers.forEach((o, i) => { - const r = o.getBoundingClientRect(), a = window.innerHeight, s = Math.max(r.top, 0), l = Math.min(r.bottom, a), c = Math.max(0, l - s), d = r.height; - c / d >= 0.3 && e.push(i); - }); - const t = Math.max(...e); - for (let o = t + 1; o < window.currentPageContainers.length; o++) - if (!e.includes(o)) { - n = o; - break; - } - n === -1 && t < window.currentPageContainers.length - 1 && (n = t + 1), n >= 0 && n < window.currentPageContainers.length && (window.currentActiveIndex = n, window.currentPageContainers[window.currentActiveIndex].scrollIntoView({ - behavior: "smooth", - block: "start" - }), setTimeout(() => { - v(); - }, 100)); - } -} -function oe() { - if (R()) { - const e = document.querySelector("#newspaper-content .newspaper-page-container"); - e && e.scrollIntoView({ - behavior: "smooth", - block: "start" - }); - } else { - const e = document.querySelector('[class*="border-t-2 border-amber-200"]'); - e && e.scrollIntoView({ - behavior: "smooth", - block: "start" - }); - } -} -function R() { - const n = []; - window.currentPageContainers.forEach((e, t) => { - const o = e.getBoundingClientRect(), i = window.innerHeight, r = Math.max(o.top, 0), a = Math.min(o.bottom, i), s = Math.max(0, a - r), l = o.height; - s / l >= 0.3 && n.push(t); - }); - for (const e of n) { - const t = window.currentPageContainers[e]; - if (t && t.id && t.id.includes("beilage-")) - return !0; - } - return !1; -} -function v() { - const n = document.getElementById("prevPageBtn"), e = document.getElementById("nextPageBtn"), t = document.getElementById("beilageBtn"); - if (n && (window.currentActiveIndex <= 0 ? n.style.display = "none" : n.style.display = "flex"), e && (window.currentActiveIndex >= window.currentPageContainers.length - 1 ? e.style.display = "none" : e.style.display = "flex"), t) { - const o = R(), i = t.querySelector("i"); - o ? (t.title = "Zur Hauptausgabe", t.className = "w-14 h-10 lg:w-16 lg:h-12 px-2 py-1 bg-gray-100 hover:bg-gray-200 text-gray-700 hover:text-gray-800 border border-gray-300 transition-colors duration-200 flex items-center justify-center cursor-pointer", i && (i.className = "ri-file-text-line text-lg lg:text-xl")) : (t.title = "Zu Beilage", t.className = "w-14 h-10 lg:w-16 lg:h-12 px-2 py-1 bg-amber-100 hover:bg-amber-200 text-amber-700 hover:text-amber-800 border border-amber-300 transition-colors duration-200 flex items-center justify-center cursor-pointer", i && (i.className = "ri-attachment-line text-lg lg:text-xl")); - } -} -function ie() { - const n = document.getElementById("shareLinkBtn"); - let e = ""; - if (window.currentActiveIndex !== void 0 && window.currentPageContainers && window.currentPageContainers[window.currentActiveIndex]) { - const i = window.currentPageContainers[window.currentActiveIndex].querySelector("[data-page]"); - i && (e = `/${i.getAttribute("data-page")}`); - } - const t = window.location.origin + window.location.pathname + e; - navigator.share ? navigator.share({ - title: document.title, - url: t - }).catch((o) => { - E(t, n); - }) : E(t, n); -} -function E(n, e) { - if (navigator.clipboard) - navigator.clipboard.writeText(n).then(() => { - p(e, "Link kopiert!"); - }).catch((t) => { - p(e, "Kopieren fehlgeschlagen"); - }); - else { - const t = document.createElement("textarea"); - t.value = n, document.body.appendChild(t), t.select(); - try { - const o = document.execCommand("copy"); - p(e, o ? "Link kopiert!" : "Kopieren fehlgeschlagen"); - } catch { - p(e, "Kopieren fehlgeschlagen"); - } finally { - document.body.removeChild(t); - } - } -} -function re() { - const n = document.getElementById("citationBtn"), e = document.title || "KGPZ"; - let t = window.location.origin + window.location.pathname; - t.includes("#") && (t = t.split("#")[0]); - const o = (/* @__PURE__ */ new Date()).toLocaleDateString("de-DE"), i = `Königsberger Gelehrte und Politische Zeitung (KGPZ). ${e}. Digital verfügbar unter: ${t} (Zugriff: ${o}).`; - if (navigator.clipboard) - navigator.clipboard.writeText(i).then(() => { - p(n, "Zitation kopiert!"); - }).catch((r) => { - p(n, "Kopieren fehlgeschlagen"); - }); - else { - const r = document.createElement("textarea"); - r.value = i, document.body.appendChild(r), r.select(); - try { - const a = document.execCommand("copy"); - p(n, a ? "Zitation kopiert!" : "Kopieren fehlgeschlagen"); - } catch { - p(n, "Kopieren fehlgeschlagen"); - } finally { - document.body.removeChild(r); - } - } -} -function p(n, e) { - const t = document.querySelector(".simple-popup"); - t && t.remove(); - const o = document.createElement("div"); - o.className = "simple-popup", o.textContent = e, o.style.cssText = ` - position: fixed; - background: #374151; - color: white; - padding: 6px 12px; - border-radius: 6px; - font-size: 13px; - font-weight: 500; - z-index: 1000; - pointer-events: none; - opacity: 0; - transition: opacity 0.2s ease; - white-space: nowrap; - `; - const i = n.getBoundingClientRect(), r = window.innerHeight, a = window.innerWidth; - let s = i.left - 10, l = i.bottom + 8; - const c = 120, d = 32; - s + c > a && (s = i.right - c + 10), l + d > r && (l = i.top - d - 8), o.style.left = Math.max(5, s) + "px", o.style.top = Math.max(5, l) + "px", document.body.appendChild(o), setTimeout(() => { - o.style.opacity = "1"; - }, 10), setTimeout(() => { - o.style.opacity = "0", setTimeout(() => { - o.parentNode && o.remove(); - }, 200); - }, 2e3); -} -function se() { - if (window.htmxNavigating) - return; - let n = "", e = null; - const t = window.location.pathname.split("/"); - if (t.length >= 4 && !isNaN(t[t.length - 1])) { - if (n = t[t.length - 1], e = document.getElementById(`page-${n}`), !e) { - const o = document.querySelectorAll(".newspaper-page-container[data-pages]"); - for (const i of o) { - const r = i.getAttribute("data-pages"); - if (r && r.split(",").includes(n)) { - e = i; - break; - } - } - } - e || (e = document.getElementById(`beilage-1-page-${n}`) || document.getElementById(`beilage-2-page-${n}`) || document.querySelector(`[id*="beilage"][id*="page-${n}"]`)); - } - e && n && setTimeout(() => { - e.scrollIntoView({ - behavior: "smooth", - block: "start" - }), q(n); - }, 300); -} -function x(n, e, t = !1) { - let o = ""; - if (t) - o = window.location.origin + window.location.pathname + `#beilage-1-page-${n}`; - else { - const r = window.location.pathname.split("/"); - if (r.length >= 3) { - const a = r[1], s = r[2]; - o = `${window.location.origin}/${a}/${s}/${n}`; - } else - o = window.location.origin + window.location.pathname + `/${n}`; - } - const i = o; - if (navigator.clipboard) - navigator.clipboard.writeText(i).then(() => { - p(e, "Link kopiert!"); - }).catch((r) => { - p(e, "Kopieren fehlgeschlagen"); - }); - else { - const r = document.createElement("textarea"); - r.value = i, document.body.appendChild(r), r.select(); - try { - const a = document.execCommand("copy"); - p(e, a ? "Link kopiert!" : "Kopieren fehlgeschlagen"); - } catch { - p(e, "Kopieren fehlgeschlagen"); - } finally { - document.body.removeChild(r); - } - } -} -function S(n, e) { - const t = document.title || "KGPZ", o = window.location.pathname.split("/"); - let i; - if (o.length >= 3) { - const l = o[1], c = o[2]; - i = `${window.location.origin}/${l}/${c}/${n}`; - } else - i = `${window.location.origin}${window.location.pathname}/${n}`; - const r = i, a = (/* @__PURE__ */ new Date()).toLocaleDateString("de-DE"), s = `Königsberger Gelehrte und Politische Zeitung (KGPZ). ${t}, Seite ${n}. Digital verfügbar unter: ${r} (Zugriff: ${a}).`; - if (navigator.clipboard) - navigator.clipboard.writeText(s).then(() => { - p(e, "Zitation kopiert!"); - }).catch((l) => { - p(e, "Kopieren fehlgeschlagen"); - }); - else { - const l = document.createElement("textarea"); - l.value = s, document.body.appendChild(l), l.select(); - try { - const c = document.execCommand("copy"); - p(e, c ? "Zitation kopiert!" : "Kopieren fehlgeschlagen"); - } catch { - p(e, "Kopieren fehlgeschlagen"); - } finally { - document.body.removeChild(l); - } - } -} -function k() { - N(); - const n = document.querySelectorAll(".author-section"), e = document.querySelectorAll(".scrollspy-link"); - if (n.length === 0 || e.length === 0) - return; - function t() { - const s = document.getElementById("scrollspy-slider"), l = document.getElementById("scrollspy-nav"); - if (!s || !l || s.style.opacity === "0") + initializeScrollspyAfterDelay() { + if (this.sections = document.querySelectorAll(".author-section"), this.navLinks = document.querySelectorAll(".scrollspy-link"), this.sections.length === 0 || this.navLinks.length === 0) { + setTimeout(() => { + this.sections = document.querySelectorAll(".author-section"), this.navLinks = document.querySelectorAll(".scrollspy-link"), this.sections.length > 0 && this.navLinks.length > 0 && this.initializeScrollspy(); + }, 200); return; - const c = l.getBoundingClientRect(), d = parseFloat(s.style.top), g = parseFloat(s.style.height), u = d + g, h = l.scrollTop, m = h + c.height; - if (u > m) { - const f = u - c.height + 20; - l.scrollTo({ - top: f, + } + this.initializeScrollspy(); + } + disconnectedCallback() { + this.cleanup(); + } + initializeScrollspy() { + this.scrollHandler = () => { + clearTimeout(this.scrollTimeout), this.scrollTimeout = setTimeout(() => { + this.updateActiveLink(), this.updateSidebarScrollToTopButton(); + }, 50); + }, window.addEventListener("scroll", this.scrollHandler), this.navLinks.forEach((e) => { + const t = (n) => { + n.preventDefault(); + const i = e.getAttribute("data-target"), o = document.getElementById(i); + o && (this.updateActiveLinkImmediate(i), this.manualNavigation = !0, o.scrollIntoView({ + behavior: "smooth", + block: "start" + }), setTimeout(() => { + this.manualNavigation = !1, this.ensureMarkerVisibility(); + }, 1e3)); + }; + this.clickHandlers.push({ link: e, handler: t }), e.addEventListener("click", t); + }), this.updateActiveLink(), this.updateSidebarScrollToTopButton(); + } + ensureMarkerVisibility() { + const e = document.getElementById("scrollspy-slider"), t = document.getElementById("scrollspy-nav"); + if (!e || !t || e.style.opacity === "0") + return; + const n = t.getBoundingClientRect(), i = parseFloat(e.style.top), o = parseFloat(e.style.height), s = i + o, l = t.scrollTop, a = l + n.height; + if (s > a) { + const c = s - n.height + 20; + t.scrollTo({ + top: c, behavior: "smooth" }); - } else if (d < h) { - const f = d - 20; - l.scrollTo({ - top: Math.max(0, f), + } else if (i < l) { + const c = i - 20; + t.scrollTo({ + top: Math.max(0, c), behavior: "smooth" }); } } - function o() { - const s = []; - n.forEach((d) => { - const g = d.getAttribute("id"), u = d.querySelector(".akteur-werke-section"), h = d.querySelector(".akteur-beitraege-section"); - let m = !1; - if (u) { - const f = u.getBoundingClientRect(), b = f.top < window.innerHeight, w = f.bottom > 0; - b && w && (m = !0); - } - if (h && !m) { - const f = h.getBoundingClientRect(), b = f.top < window.innerHeight, w = f.bottom > 0; - b && w && (m = !0); - } - if (!u && !h) { - const f = d.querySelector("div:first-child"); - if (f) { - const b = f.getBoundingClientRect(), w = b.top >= 0, y = b.bottom <= window.innerHeight; - w && y && (m = !0); + updateActiveLink() { + if (!this.sections || !this.navLinks) + return; + const e = []; + try { + this.sections.forEach((i) => { + if (!i || !i.getAttribute) return; + const o = i.getAttribute("id"), s = i.querySelector(".akteur-werke-section"), l = i.querySelector(".akteur-beitraege-section"); + let a = !1; + if (s) { + const c = s.getBoundingClientRect(), d = c.top < window.innerHeight, g = c.bottom > 0; + d && g && (a = !0); } - } - m && s.push(g); - }); - const l = [], c = document.getElementById("scrollspy-slider"); - if (e.forEach((d) => { - d.classList.remove("font-medium"); - const g = d.getAttribute("data-target"); - s.includes(g) && (d.classList.add("font-medium"), l.push(d)); - }), l.length > 0 && c) { - const d = document.getElementById("scrollspy-nav"), g = d.getBoundingClientRect(); - let u = 1 / 0, h = -1 / 0; - l.forEach((f) => { - const b = f.getBoundingClientRect(), w = b.top - g.top + d.scrollTop, y = w + b.height; - u = Math.min(u, w), h = Math.max(h, y); + if (l && !a) { + const c = l.getBoundingClientRect(), d = c.top < window.innerHeight, g = c.bottom > 0; + d && g && (a = !0); + } + if (!s && !l) { + const c = i.querySelector("div:first-child"); + if (c) { + const d = c.getBoundingClientRect(), g = d.top >= 0, h = d.bottom <= window.innerHeight; + g && h && (a = !0); + } + } + a && e.push(o); }); - let m = h - u; - c.style.top = `${u}px`, c.style.height = `${m}px`, c.style.opacity = "1", setTimeout(() => t(), 100); - } else c && (c.style.opacity = "0"); - l.length > 0 && r(l); + } catch { + return; + } + const t = [], n = document.getElementById("scrollspy-slider"); + if (this.navLinks.forEach((i) => { + i.classList.remove("font-medium"); + const o = i.getAttribute("data-target"); + e.includes(o) && (i.classList.add("font-medium"), t.push(i)); + }), t.length > 0 && n) { + const i = document.getElementById("scrollspy-nav"), o = i.getBoundingClientRect(); + let s = 1 / 0, l = -1 / 0; + t.forEach((c) => { + const d = c.getBoundingClientRect(), g = d.top - o.top + i.scrollTop, h = g + d.height; + s = Math.min(s, g), l = Math.max(l, h); + }); + let a = l - s; + n.style.top = `${s}px`, n.style.height = `${a}px`, n.style.opacity = "1", setTimeout(() => this.ensureMarkerVisibility(), 100); + } else n && (n.style.opacity = "0"); + t.length > 0 && this.updateSidebarScroll(t); } - function i(s) { - const l = document.querySelectorAll(".scrollspy-link"), c = document.getElementById("scrollspy-slider"); - l.forEach((g) => { - g.classList.remove("font-medium"); - }); - const d = document.querySelector(`[data-target="${s}"]`); - if (d && (d.classList.add("font-medium"), c)) { - const g = document.getElementById("scrollspy-nav"), u = g.getBoundingClientRect(), h = d.getBoundingClientRect(), m = h.top - u.top + g.scrollTop; - c.style.top = `${m}px`, c.style.height = `${h.height}px`, c.style.opacity = "1"; + updateActiveLinkImmediate(e) { + if (!this.navLinks) return; + const t = document.getElementById("scrollspy-slider"); + try { + this.navLinks.forEach((i) => { + i && i.classList && i.classList.remove("font-medium"); + }); + } catch { + return; + } + const n = document.querySelector(`[data-target="${e}"]`); + if (n && (n.classList.add("font-medium"), t)) { + const i = document.getElementById("scrollspy-nav"); + if (i) { + const o = i.getBoundingClientRect(), s = n.getBoundingClientRect(), l = s.top - o.top + i.scrollTop; + t.style.top = `${l}px`, t.style.height = `${s.height}px`, t.style.opacity = "1"; + } } } - function r(s) { - if (window.scrollspyManualNavigation) return; - const l = document.getElementById("scrollspy-nav"); - if (!l) return; - const c = s[0], d = Math.max( + updateSidebarScroll(e) { + if (this.manualNavigation) return; + const t = document.getElementById("scrollspy-nav"); + if (!t) return; + const n = e[0], i = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight - ), g = window.innerHeight, u = d - g, h = u > 0 ? window.scrollY / u : 0, m = l.clientHeight, b = l.scrollHeight - m; - if (b > 0) { - const w = h * b, y = c.getBoundingClientRect(), O = l.getBoundingClientRect(), V = y.top - O.top + l.scrollTop, z = m / 2, D = V - z, T = 0.7, K = T * w + (1 - T) * D, C = Math.max(0, Math.min(b, K)), j = l.scrollTop; - Math.abs(C - j) > 10 && l.scrollTo({ - top: C, + ), o = window.innerHeight, s = i - o, l = s > 0 ? window.scrollY / s : 0, a = t.clientHeight, d = t.scrollHeight - a; + if (d > 0) { + const g = l * d, h = n.getBoundingClientRect(), P = t.getBoundingClientRect(), C = h.top - P.top + t.scrollTop, k = a / 2, T = C - k, m = 0.7, I = m * g + (1 - m) * T, b = Math.max(0, Math.min(d, I)), L = t.scrollTop; + Math.abs(b - L) > 10 && t.scrollTo({ + top: b, behavior: "smooth" }); } } - window.scrollspyScrollHandler = function() { - clearTimeout(window.scrollspyTimeout), window.scrollspyTimeout = setTimeout(() => { - o(), a(); - }, 50); - }; - function a() { - const s = document.getElementById("sidebar-scroll-to-top"); - if (!s) return; - const l = window.pageYOffset || document.documentElement.scrollTop, c = window.innerHeight; - l > c * 0.5 ? (s.classList.remove("opacity-0"), s.classList.add("opacity-100")) : (s.classList.remove("opacity-100"), s.classList.add("opacity-0")); + updateSidebarScrollToTopButton() { + const e = document.getElementById("sidebar-scroll-to-top"); + if (!e) return; + const t = window.pageYOffset || document.documentElement.scrollTop, n = window.innerHeight; + t > n * 0.5 ? (e.classList.remove("opacity-0"), e.classList.add("opacity-100")) : (e.classList.remove("opacity-100"), e.classList.add("opacity-0")); + } + cleanup() { + this.scrollHandler && (window.removeEventListener("scroll", this.scrollHandler), this.scrollHandler = null), this.scrollTimeout && (clearTimeout(this.scrollTimeout), this.scrollTimeout = null), this.clickHandlers && this.clickHandlers.length > 0 && this.clickHandlers.forEach(({ link: t, handler: n }) => { + t && n && t.removeEventListener("click", n); + }); + const e = document.getElementById("scrollspy-slider"); + e && (e.style.opacity = "0", e.style.height = "0"), this.sections = null, this.navLinks = null, this.clickHandlers = [], this.manualNavigation = !1; } - window.addEventListener("scroll", window.scrollspyScrollHandler), window.scrollspyClickHandlers = [], e.forEach((s) => { - const l = function(c) { - c.preventDefault(); - const d = this.getAttribute("data-target"), g = document.getElementById(d); - g && (i(d), window.scrollspyManualNavigation = !0, g.scrollIntoView({ - behavior: "smooth", - block: "start" - }), setTimeout(() => { - window.scrollspyManualNavigation = !1, t(); - }, 1e3)); - }; - window.scrollspyClickHandlers.push({ link: s, handler: l }), s.addEventListener("click", l); - }), o(), a(); } -function N() { - window.scrollspyScrollHandler && (window.removeEventListener("scroll", window.scrollspyScrollHandler), window.scrollspyScrollHandler = null), window.scrollspyTimeout && (clearTimeout(window.scrollspyTimeout), window.scrollspyTimeout = null), window.scrollspyClickHandlers && (window.scrollspyClickHandlers.forEach(({ link: e, handler: t }) => { - e.removeEventListener("click", t); - }), window.scrollspyClickHandlers = null); - const n = document.getElementById("scrollspy-slider"); - n && (n.style.opacity = "0", n.style.height = "0"), window.scrollspyManualNavigation = !1; -} -function A() { - U(), ee(), window.addEventListener("scroll", function() { - clearTimeout(window.scrollTimeout), window.scrollTimeout = setTimeout(() => { - H(), v(); - }, 50); - }), se(), document.addEventListener("keydown", function(n) { - n.key === "Escape" && M(); - }); -} -window.enlargePage = Q; -window.closeModal = M; -window.scrollToPreviousPage = te; -window.scrollToNextPage = ne; -window.scrollToBeilage = oe; -window.shareCurrentPage = ie; -window.generateCitation = re; -window.copyPagePermalink = x; -window.generatePageCitation = S; -function B() { - const n = window.location.pathname, e = document.body; - e.classList.remove("page-akteure", "page-ausgabe", "page-search", "page-ort", "page-kategorie", "page-piece", "page-edition"), n.includes("/akteure/") || n.includes("/autoren") ? e.classList.add("page-akteure") : n.match(/\/\d{4}\/\d+/) ? e.classList.add("page-ausgabe") : n.includes("/search") || n.includes("/suche") ? e.classList.add("page-search") : n.includes("/ort/") ? e.classList.add("page-ort") : n.includes("/kategorie/") ? e.classList.add("page-kategorie") : n.includes("/beitrag/") ? e.classList.add("page-piece") : n.includes("/edition") && e.classList.add("page-edition"); -} -function de() { - I(), _(), B(), document.querySelector(".newspaper-page-container") && A(), document.querySelector(".author-section") && k(), htmx.on("htmx:load", function(n) { - I(); - }), document.body.addEventListener("htmx:afterSwap", function(n) { - B(), window.htmxNavigating = !0; - const e = window.location.pathname, t = e.match(/\/\d+$/), o = e.includes("/akteure/") || e.includes("/autoren"); - !t && o && setTimeout(() => { - window.scrollTo({ - top: 0, - behavior: "instant" - // Use instant instead of smooth to avoid conflicts - }); - }, 50), setTimeout(() => { - document.querySelector(".newspaper-page-container") && A(), document.querySelector(".author-section") && k(); - const i = document.querySelector("scroll-to-top-button"); - i && i.reassessScrollPosition(), setTimeout(() => { - window.htmxNavigating = !1; - }, 500); - }, 100); - }), document.body.addEventListener("htmx:beforeRequest", function(n) { - window.htmxNavigating = !0; - }); -} -class le extends HTMLElement { +customElements.define("akteure-scrollspy", H); +class B extends HTMLElement { constructor() { super(), this.resizeObserver = null; } @@ -721,42 +281,41 @@ class le extends HTMLElement { e.style.width = t, console.log("Updated sidebar width to:", t); } } - show(e, t, o, i = !1, r = 0, a = null) { - const s = this.querySelector("#single-page-image"), l = this.querySelector("#page-number"), c = this.querySelector("#page-icon"); - this.querySelector("#page-indicator"), s.src = e, s.alt = t, this.currentPageNumber = o, this.currentIsBeilage = i, this.currentPartNumber = a; - const d = this.getIssueContext(o); - if (l.innerHTML = d ? `${d}, ${o}` : `${o}`, r && o === r) { - l.style.position = "relative"; - const g = l.querySelector(".target-page-dot"); + show(e, t, n, i = !1, o = 0, s = null) { + const l = this.querySelector("#single-page-image"), a = this.querySelector("#page-number"), c = this.querySelector("#page-icon"); + this.querySelector("#page-indicator"), l.src = e, l.alt = t, this.currentPageNumber = n, this.currentIsBeilage = i, this.currentPartNumber = s; + const d = this.getIssueContext(n); + if (a.innerHTML = d ? `${d}, ${n}` : `${n}`, o && n === o) { + a.style.position = "relative"; + const g = a.querySelector(".target-page-dot"); g && g.remove(); - const u = document.createElement("span"); - u.className = "target-page-dot absolute -top-1 -right-1 w-3 h-3 bg-red-500 rounded-full z-10", u.title = "verlinkte Seite", l.appendChild(u); + const h = document.createElement("span"); + h.className = "target-page-dot absolute -top-1 -right-1 w-3 h-3 bg-red-500 rounded-full z-10", h.title = "verlinkte Seite", a.appendChild(h); } - if (a !== null) - c.innerHTML = `${a}. Teil`; + if (s !== null) + c.innerHTML = `${s}. Teil`; else { - const g = this.determinePageIconType(o, i); + const g = this.determinePageIconType(n, i); c.innerHTML = this.getPageIconHTML(g); } - this.updateNavigationButtons(), this.style.display = "block", document.body.style.overflow = "hidden", q(o); + this.updateNavigationButtons(), this.style.display = "block", document.body.style.overflow = "hidden"; } close() { this.style.display = "none", document.body.style.overflow = ""; } - // Clean up component completely - destroy() { - this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = null), document.body.style.overflow = "", this.parentNode && this.parentNode.removeChild(this); + disconnectedCallback() { + this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = null), document.body.style.overflow = ""; } // Determine page icon type based on page position and whether it's beilage determinePageIconType(e, t) { - const o = t ? '.newspaper-page-container[data-beilage="true"]' : ".newspaper-page-container:not([data-beilage])", r = Array.from(document.querySelectorAll(o)).map((l) => { - const c = l.getAttribute("data-page-container"); + const n = t ? '.newspaper-page-container[data-beilage="true"]' : ".newspaper-page-container:not([data-beilage])", o = Array.from(document.querySelectorAll(n)).map((a) => { + const c = a.getAttribute("data-page-container"); return c ? parseInt(c) : null; - }).filter((l) => l !== null).sort((l, c) => l - c); - if (r.length === 0) + }).filter((a) => a !== null).sort((a, c) => a - c); + if (o.length === 0) return "first"; - const a = r[0], s = r[r.length - 1]; - return e === a ? "first" : e === s ? "last" : e === a + 1 ? "even" : e === s - 1 ? "odd" : e % 2 === 0 ? "even" : "odd"; + const s = o[0], l = o[o.length - 1]; + return e === s ? "first" : e === l ? "last" : e === s + 1 ? "even" : e === l - 1 ? "odd" : e % 2 === 0 ? "even" : "odd"; } // Generate page icon HTML based on type (same as Go PageIcon function) getPageIconHTML(e) { @@ -776,22 +335,22 @@ class le extends HTMLElement { } // Share current page shareCurrentPage() { - if (typeof x == "function") { + if (typeof copyPagePermalink == "function") { const e = this.querySelector("#share-btn"); - x(this.currentPageNumber, e, this.currentIsBeilage); + copyPagePermalink(this.currentPageNumber, e, this.currentIsBeilage); } } // Generate citation for current page generatePageCitation() { - if (typeof S == "function") { + if (typeof generatePageCitation == "function") { const e = this.querySelector("#cite-btn"); - S(this.currentPageNumber, e); + generatePageCitation(this.currentPageNumber, e); } } // Update navigation button visibility based on available pages updateNavigationButtons() { - const e = this.querySelector("#prev-page-btn"), t = this.querySelector("#next-page-btn"), { prevPage: o, nextPage: i } = this.getAdjacentPages(); - o !== null ? (e.disabled = !1, e.className = e.className.replace("opacity-50 cursor-not-allowed", ""), e.className = e.className.replace( + const e = this.querySelector("#prev-page-btn"), t = this.querySelector("#next-page-btn"), { prevPage: n, nextPage: i } = this.getAdjacentPages(); + n !== null ? (e.disabled = !1, e.className = e.className.replace("opacity-50 cursor-not-allowed", ""), e.className = e.className.replace( "bg-gray-50 text-gray-400", "bg-gray-100 text-gray-700" )) : (e.disabled = !0, e.className.includes("opacity-50") || (e.className += " opacity-50 cursor-not-allowed"), e.className = e.className.replace( @@ -816,15 +375,15 @@ class le extends HTMLElement { "for", this.currentIsBeilage ? "beilage" : "main" ); - const o = t.map((s) => { - const l = s.getAttribute("data-page-container"), c = l ? parseInt(l) : null; - return console.log("Container page:", l, "parsed:", c), c; - }).filter((s) => s !== null).sort((s, l) => s - l); - console.log("All pages found:", o), console.log("Current page:", this.currentPageNumber); - const i = o.indexOf(this.currentPageNumber); + const n = t.map((l) => { + const a = l.getAttribute("data-page-container"), c = a ? parseInt(a) : null; + return console.log("Container page:", a, "parsed:", c), c; + }).filter((l) => l !== null).sort((l, a) => l - a); + console.log("All pages found:", n), console.log("Current page:", this.currentPageNumber); + const i = n.indexOf(this.currentPageNumber); console.log("Current index:", i); - let r = null, a = null; - return i > 0 && (r = o[i - 1]), i < o.length - 1 && (a = o[i + 1]), console.log("Adjacent pages - prev:", r, "next:", a), { prevPage: r, nextPage: a }; + let o = null, s = null; + return i > 0 && (o = n[i - 1]), i < n.length - 1 && (s = n[i + 1]), console.log("Adjacent pages - prev:", o, "next:", s), { prevPage: o, nextPage: s }; } // Navigate to previous page goToPreviousPage() { @@ -838,20 +397,20 @@ class le extends HTMLElement { } // Navigate to a specific page navigateToPage(e) { - const t = this.currentIsBeilage ? '.newspaper-page-container[data-beilage="true"]' : ".newspaper-page-container:not([data-beilage])", o = document.querySelector( + const t = this.currentIsBeilage ? '.newspaper-page-container[data-beilage="true"]' : ".newspaper-page-container:not([data-beilage])", n = document.querySelector( `${t}[data-page-container="${e}"]` ); - if (o) { - const i = o.querySelector(".newspaper-page-image"); + if (n) { + const i = n.querySelector(".newspaper-page-image"); if (i) { - let r = null; - this.currentPartNumber !== null && (r = this.getPartNumberForPage(e)), this.show( + let o = null; + this.currentPartNumber !== null && (o = this.getPartNumberForPage(e)), this.show( i.src, i.alt, e, this.currentIsBeilage, 0, - r + o ); } } @@ -860,9 +419,9 @@ class le extends HTMLElement { getPartNumberForPage(e) { const t = document.querySelector(`[data-page-container="${e}"]`); if (t) { - const o = t.querySelector(".part-number"); - if (o) { - const i = o.textContent.match(/(\d+)\./); + const n = t.querySelector(".part-number"); + if (n) { + const i = n.textContent.match(/(\d+)\./); if (i) return parseInt(i[1]); } @@ -871,59 +430,59 @@ class le extends HTMLElement { } // Toggle sidebar visibility toggleSidebar() { - const e = this.querySelector("#sidebar-spacer"), t = this.querySelector("#sidebar-toggle-btn"), o = t.querySelector("i"), i = e.style.width, r = i === "0px" || i === "0"; - if (console.log("Current state - isCollapsed:", r), console.log("Current width:", i), r) { - const a = this.detectSidebarWidth(); - e.style.width = a, t.className = "w-10 h-10 bg-slate-100 hover:bg-slate-200 text-slate-700 border border-slate-300 rounded flex items-center justify-center transition-colors duration-200 cursor-pointer", o.className = "ri-sidebar-fold-line text-lg font-bold", t.title = "Inhaltsverzeichnis ausblenden", console.log("Expanding sidebar to:", a); + const e = this.querySelector("#sidebar-spacer"), t = this.querySelector("#sidebar-toggle-btn"), n = t.querySelector("i"), i = e.style.width, o = i === "0px" || i === "0"; + if (console.log("Current state - isCollapsed:", o), console.log("Current width:", i), o) { + const s = this.detectSidebarWidth(); + e.style.width = s, t.className = "w-10 h-10 bg-slate-100 hover:bg-slate-200 text-slate-700 border border-slate-300 rounded flex items-center justify-center transition-colors duration-200 cursor-pointer", n.className = "ri-sidebar-fold-line text-lg font-bold", t.title = "Inhaltsverzeichnis ausblenden", console.log("Expanding sidebar to:", s); } else - e.style.width = "0px", t.className = "w-10 h-10 bg-orange-100 hover:bg-orange-200 text-orange-700 border border-orange-300 rounded flex items-center justify-center transition-colors duration-200 cursor-pointer", o.className = "ri-sidebar-unfold-line text-lg font-bold", t.title = "Inhaltsverzeichnis einblenden", console.log("Collapsing sidebar"); + e.style.width = "0px", t.className = "w-10 h-10 bg-orange-100 hover:bg-orange-200 text-orange-700 border border-orange-300 rounded flex items-center justify-center transition-colors duration-200 cursor-pointer", n.className = "ri-sidebar-unfold-line text-lg font-bold", t.title = "Inhaltsverzeichnis einblenden", console.log("Collapsing sidebar"); console.log("New width:", e.style.width); } // Extract issue context from document title, URL, or page container getIssueContext(e) { - const t = window.location.pathname, o = t.includes("/beitrag/"); - if (o) { - const a = document.querySelector(`[data-page-container="${e}"]`); - if (a) { - const c = a.querySelector(".page-indicator"); + const t = window.location.pathname, n = t.includes("/beitrag/"); + if (n) { + const s = document.querySelector(`[data-page-container="${e}"]`); + if (s) { + const c = s.querySelector(".page-indicator"); if (c) { const d = c.textContent.trim(), g = d.match(/(\d{1,2}\.\d{1,2}\.\d{4}\s+Nr\.\s+\d+)/); if (g) return g[1]; - const u = d.match(/(\d{4})\s+Nr\.\s+(\d+)/); - if (u) - return `${u[1]} Nr. ${u[2]}`; + const h = d.match(/(\d{4})\s+Nr\.\s+(\d+)/); + if (h) + return `${h[1]} Nr. ${h[2]}`; } } - const l = document.title.match(/(\d{4}).*Nr\.\s*(\d+)/); - if (l) - return `${l[1]} Nr. ${l[2]}`; + const a = document.title.match(/(\d{4}).*Nr\.\s*(\d+)/); + if (a) + return `${a[1]} Nr. ${a[2]}`; } else return ""; const i = t.match(/\/(\d{4})\/(\d+)/); if (i) - return o ? `${i[1]} Nr. ${i[2]}` : ""; - const r = document.querySelector(".page-indicator"); - if (r) { - const s = r.textContent.trim().match(/(\d{4})\s+Nr\.\s+(\d+)/); - if (s) - return `${s[1]} Nr. ${s[2]}`; + return n ? `${i[1]} Nr. ${i[2]}` : ""; + const o = document.querySelector(".page-indicator"); + if (o) { + const l = o.textContent.trim().match(/(\d{4})\s+Nr\.\s+(\d+)/); + if (l) + return `${l[1]} Nr. ${l[2]}`; } return "KGPZ"; } } -customElements.define("single-page-viewer", le); -document.body.addEventListener("htmx:beforeRequest", function(n) { +customElements.define("single-page-viewer", B); +document.body.addEventListener("htmx:beforeRequest", function(r) { const e = document.querySelector("single-page-viewer"); - e && e.style.display !== "none" && (console.log("Cleaning up single page viewer before HTMX navigation"), e.destroy()), N(); + e && e.style.display !== "none" && (console.log("Cleaning up single page viewer before HTMX navigation"), e.destroy()); }); window.addEventListener("beforeunload", function() { - const n = document.querySelector("single-page-viewer"); - n && n.destroy(); + const r = document.querySelector("single-page-viewer"); + r && r.destroy(); }); -class ae extends HTMLElement { +class E extends HTMLElement { constructor() { - super(), this.isVisible = !1, this.scrollHandler = null; + super(), this.isVisible = !1, this.scrollHandler = null, this.htmxAfterSwapHandler = null; } connectedCallback() { this.innerHTML = ` @@ -936,10 +495,12 @@ class ae extends HTMLElement { `, this.scrollHandler = () => { this.handleScroll(); - }, window.addEventListener("scroll", this.scrollHandler), this.handleScroll(); + }, this.htmxAfterSwapHandler = () => { + this.reassessScrollPosition(); + }, window.addEventListener("scroll", this.scrollHandler), document.body.addEventListener("htmx:afterSettle", this.htmxAfterSwapHandler), this.handleScroll(); } disconnectedCallback() { - this.scrollHandler && (window.removeEventListener("scroll", this.scrollHandler), this.scrollHandler = null); + this.scrollHandler && (window.removeEventListener("scroll", this.scrollHandler), this.scrollHandler = null), this.htmxAfterSwapHandler && (document.body.removeEventListener("htmx:afterSettle", this.htmxAfterSwapHandler), this.htmxAfterSwapHandler = null); } // Method to reassess scroll position (called after HTMX swaps) reassessScrollPosition() { @@ -950,7 +511,7 @@ class ae extends HTMLElement { handleScroll() { const e = this.querySelector("#scroll-to-top-btn"); if (!e) return; - const t = window.pageYOffset || document.documentElement.scrollTop, o = window.innerHeight, i = t > o; + const t = window.pageYOffset || document.documentElement.scrollTop, n = window.innerHeight, i = t > n; i && !this.isVisible ? (this.isVisible = !0, e.classList.remove("opacity-0", "pointer-events-none"), e.classList.add("opacity-100", "pointer-events-auto")) : !i && this.isVisible && (this.isVisible = !1, e.classList.remove("opacity-100", "pointer-events-auto"), e.classList.add("opacity-0", "pointer-events-none")); } scrollToTop() { @@ -960,7 +521,324 @@ class ae extends HTMLElement { }); } } -customElements.define("scroll-to-top-button", ae); +customElements.define("scroll-to-top-button", E); +window.currentPageContainers = window.currentPageContainers || []; +window.currentActiveIndex = window.currentActiveIndex || 0; +window.pageObserver = window.pageObserver || null; +function A(r, e, t, n = null) { + let i = document.querySelector("single-page-viewer"); + i || (i = document.createElement("single-page-viewer"), document.body.appendChild(i)); + const o = r.closest('[data-beilage="true"]') !== null, s = window.templateData && window.templateData.targetPage ? window.templateData.targetPage : 0; + i.show(r.src, r.alt, e, o, s, n); +} +function x() { + document.getElementById("pageModal").classList.add("hidden"); +} +function $() { + if (window.pageObserver && (window.pageObserver.disconnect(), window.pageObserver = null), window.currentPageContainers = Array.from(document.querySelectorAll(".newspaper-page-container")), window.currentActiveIndex = 0, p(), document.querySelector(".newspaper-page-container")) { + let e = /* @__PURE__ */ new Set(); + window.pageObserver = new IntersectionObserver( + (t) => { + if (t.forEach((n) => { + const i = window.currentPageContainers.indexOf(n.target); + i !== -1 && (n.isIntersecting ? e.add(i) : e.delete(i)); + }), e.size > 0) { + const i = Array.from(e).sort((o, s) => o - s)[0]; + i !== window.currentActiveIndex && (window.currentActiveIndex = i, p()); + } + }, + { + rootMargin: "-20% 0px -70% 0px" + } + ), window.currentPageContainers.forEach((t) => { + window.pageObserver.observe(t); + }); + } +} +function N() { + if (window.currentActiveIndex > 0) { + let r = -1; + const e = []; + window.currentPageContainers.forEach((n, i) => { + const o = n.getBoundingClientRect(), s = window.innerHeight, l = Math.max(o.top, 0), a = Math.min(o.bottom, s), c = Math.max(0, a - l), d = o.height; + c / d >= 0.3 && e.push(i); + }); + const t = Math.min(...e); + for (let n = t - 1; n >= 0; n--) + if (!e.includes(n)) { + r = n; + break; + } + r === -1 && t > 0 && (r = t - 1), r >= 0 && (window.currentActiveIndex = r, window.currentPageContainers[window.currentActiveIndex].scrollIntoView({ + behavior: "smooth", + block: "start" + }), setTimeout(() => { + p(); + }, 100)); + } +} +function q() { + if (window.currentActiveIndex < window.currentPageContainers.length - 1) { + let r = -1; + const e = []; + window.currentPageContainers.forEach((n, i) => { + const o = n.getBoundingClientRect(), s = window.innerHeight, l = Math.max(o.top, 0), a = Math.min(o.bottom, s), c = Math.max(0, a - l), d = o.height; + c / d >= 0.3 && e.push(i); + }); + const t = Math.max(...e); + for (let n = t + 1; n < window.currentPageContainers.length; n++) + if (!e.includes(n)) { + r = n; + break; + } + r === -1 && t < window.currentPageContainers.length - 1 && (r = t + 1), r >= 0 && r < window.currentPageContainers.length && (window.currentActiveIndex = r, window.currentPageContainers[window.currentActiveIndex].scrollIntoView({ + behavior: "smooth", + block: "start" + }), setTimeout(() => { + p(); + }, 100)); + } +} +function M() { + if (S()) { + const e = document.querySelector("#newspaper-content .newspaper-page-container"); + e && e.scrollIntoView({ + behavior: "smooth", + block: "start" + }); + } else { + const e = document.querySelector('[class*="border-t-2 border-amber-200"]'); + e && e.scrollIntoView({ + behavior: "smooth", + block: "start" + }); + } +} +function S() { + const r = []; + window.currentPageContainers.forEach((e, t) => { + const n = e.getBoundingClientRect(), i = window.innerHeight, o = Math.max(n.top, 0), s = Math.min(n.bottom, i), l = Math.max(0, s - o), a = n.height; + l / a >= 0.3 && r.push(t); + }); + for (const e of r) { + const t = window.currentPageContainers[e]; + if (t && t.id && t.id.includes("beilage-")) + return !0; + } + return !1; +} +function p() { + const r = document.getElementById("prevPageBtn"), e = document.getElementById("nextPageBtn"), t = document.getElementById("beilageBtn"); + if (r && (window.currentActiveIndex <= 0 ? r.style.display = "none" : r.style.display = "flex"), e && (window.currentActiveIndex >= window.currentPageContainers.length - 1 ? e.style.display = "none" : e.style.display = "flex"), t) { + const n = S(), i = t.querySelector("i"); + n ? (t.title = "Zur Hauptausgabe", t.className = "w-14 h-10 lg:w-16 lg:h-12 px-2 py-1 bg-gray-100 hover:bg-gray-200 text-gray-700 hover:text-gray-800 border border-gray-300 transition-colors duration-200 flex items-center justify-center cursor-pointer", i && (i.className = "ri-file-text-line text-lg lg:text-xl")) : (t.title = "Zu Beilage", t.className = "w-14 h-10 lg:w-16 lg:h-12 px-2 py-1 bg-amber-100 hover:bg-amber-200 text-amber-700 hover:text-amber-800 border border-amber-300 transition-colors duration-200 flex items-center justify-center cursor-pointer", i && (i.className = "ri-attachment-line text-lg lg:text-xl")); + } +} +function R() { + const r = document.getElementById("shareLinkBtn"); + let e = ""; + if (window.currentActiveIndex !== void 0 && window.currentPageContainers && window.currentPageContainers[window.currentActiveIndex]) { + const i = window.currentPageContainers[window.currentActiveIndex].querySelector("[data-page]"); + i && (e = `/${i.getAttribute("data-page")}`); + } + const t = window.location.origin + window.location.pathname + e; + navigator.share ? navigator.share({ + title: document.title, + url: t + }).catch((n) => { + w(t, r); + }) : w(t, r); +} +function w(r, e) { + if (navigator.clipboard) + navigator.clipboard.writeText(r).then(() => { + u(e, "Link kopiert!"); + }).catch((t) => { + u(e, "Kopieren fehlgeschlagen"); + }); + else { + const t = document.createElement("textarea"); + t.value = r, document.body.appendChild(t), t.select(); + try { + const n = document.execCommand("copy"); + u(e, n ? "Link kopiert!" : "Kopieren fehlgeschlagen"); + } catch { + u(e, "Kopieren fehlgeschlagen"); + } finally { + document.body.removeChild(t); + } + } +} +function z() { + const r = document.getElementById("citationBtn"), e = document.title || "KGPZ"; + let t = window.location.origin + window.location.pathname; + t.includes("#") && (t = t.split("#")[0]); + const n = (/* @__PURE__ */ new Date()).toLocaleDateString("de-DE"), i = `Königsberger Gelehrte und Politische Zeitung (KGPZ). ${e}. Digital verfügbar unter: ${t} (Zugriff: ${n}).`; + if (navigator.clipboard) + navigator.clipboard.writeText(i).then(() => { + u(r, "Zitation kopiert!"); + }).catch((o) => { + u(r, "Kopieren fehlgeschlagen"); + }); + else { + const o = document.createElement("textarea"); + o.value = i, document.body.appendChild(o), o.select(); + try { + const s = document.execCommand("copy"); + u(r, s ? "Zitation kopiert!" : "Kopieren fehlgeschlagen"); + } catch { + u(r, "Kopieren fehlgeschlagen"); + } finally { + document.body.removeChild(o); + } + } +} +function u(r, e) { + const t = document.querySelector(".simple-popup"); + t && t.remove(); + const n = document.createElement("div"); + n.className = "simple-popup", n.textContent = e, n.style.cssText = ` + position: fixed; + background: #374151; + color: white; + padding: 6px 12px; + border-radius: 6px; + font-size: 13px; + font-weight: 500; + z-index: 1000; + pointer-events: none; + opacity: 0; + transition: opacity 0.2s ease; + white-space: nowrap; + `; + const i = r.getBoundingClientRect(), o = window.innerHeight, s = window.innerWidth; + let l = i.left - 10, a = i.bottom + 8; + const c = 120, d = 32; + l + c > s && (l = i.right - c + 10), a + d > o && (a = i.top - d - 8), n.style.left = Math.max(5, l) + "px", n.style.top = Math.max(5, a) + "px", document.body.appendChild(n), setTimeout(() => { + n.style.opacity = "1"; + }, 10), setTimeout(() => { + n.style.opacity = "0", setTimeout(() => { + n.parentNode && n.remove(); + }, 200); + }, 2e3); +} +function V(r, e, t = !1) { + let n = ""; + if (t) + n = window.location.origin + window.location.pathname + `#beilage-1-page-${r}`; + else { + const o = window.location.pathname.split("/"); + if (o.length >= 3) { + const s = o[1], l = o[2]; + n = `${window.location.origin}/${s}/${l}/${r}`; + } else + n = window.location.origin + window.location.pathname + `/${r}`; + } + const i = n; + if (navigator.clipboard) + navigator.clipboard.writeText(i).then(() => { + u(e, "Link kopiert!"); + }).catch((o) => { + u(e, "Kopieren fehlgeschlagen"); + }); + else { + const o = document.createElement("textarea"); + o.value = i, document.body.appendChild(o), o.select(); + try { + const s = document.execCommand("copy"); + u(e, s ? "Link kopiert!" : "Kopieren fehlgeschlagen"); + } catch { + u(e, "Kopieren fehlgeschlagen"); + } finally { + document.body.removeChild(o); + } + } +} +function O(r, e) { + const t = document.title || "KGPZ", n = window.location.pathname.split("/"); + let i; + if (n.length >= 3) { + const a = n[1], c = n[2]; + i = `${window.location.origin}/${a}/${c}/${r}`; + } else + i = `${window.location.origin}${window.location.pathname}/${r}`; + const o = i, s = (/* @__PURE__ */ new Date()).toLocaleDateString("de-DE"), l = `Königsberger Gelehrte und Politische Zeitung (KGPZ). ${t}, Seite ${r}. Digital verfügbar unter: ${o} (Zugriff: ${s}).`; + if (navigator.clipboard) + navigator.clipboard.writeText(l).then(() => { + u(e, "Zitation kopiert!"); + }).catch((a) => { + u(e, "Kopieren fehlgeschlagen"); + }); + else { + const a = document.createElement("textarea"); + a.value = l, document.body.appendChild(a), a.select(); + try { + const c = document.execCommand("copy"); + u(e, c ? "Zitation kopiert!" : "Kopieren fehlgeschlagen"); + } catch { + u(e, "Kopieren fehlgeschlagen"); + } finally { + document.body.removeChild(a); + } + } +} +function y() { + $(), window.addEventListener("scroll", function() { + clearTimeout(window.scrollTimeout), window.scrollTimeout = setTimeout(() => { + p(); + }, 50); + }), document.addEventListener("keydown", function(r) { + r.key === "Escape" && x(); + }); +} +function f() { + const r = window.location.pathname; + document.querySelectorAll(".citation-link[data-citation-url]").forEach((t) => { + const n = t.getAttribute("data-citation-url"); + let i = !1; + if (n === r) + i = !0; + else { + const o = r.match(/^\/(\d{4})\/(\d+)(?:\/(\d+))?$/), s = n.match(/^\/(\d{4})\/(\d+)$/); + if (o && s) { + const [, l, a, c] = o, [, d, g] = s; + l === d && a === g && (i = !0); + } + } + i ? (t.classList.add("text-red-700", "pointer-events-none"), t.setAttribute("aria-current", "page")) : (t.classList.remove("text-red-700", "pointer-events-none"), t.removeAttribute("aria-current")); + }); +} +function v() { + const r = window.location.pathname, e = document.body; + e.classList.remove( + "page-akteure", + "page-ausgabe", + "page-search", + "page-ort", + "page-kategorie", + "page-piece", + "page-edition" + ), r.includes("/akteure/") || r.includes("/autoren") ? e.classList.add("page-akteure") : r.match(/\/\d{4}\/\d+/) ? e.classList.add("page-ausgabe") : r.includes("/search") || r.includes("/suche") ? e.classList.add("page-search") : r.includes("/ort/") ? e.classList.add("page-ort") : r.includes("/kategorie/") ? e.classList.add("page-kategorie") : r.includes("/beitrag/") ? e.classList.add("page-piece") : r.includes("/edition") && e.classList.add("page-edition"); +} +window.enlargePage = A; +window.closeModal = x; +window.scrollToPreviousPage = N; +window.scrollToNextPage = q; +window.scrollToBeilage = M; +window.shareCurrentPage = R; +window.generateCitation = z; +window.copyPagePermalink = V; +window.generatePageCitation = O; +function K() { + v(), f(), document.querySelector(".newspaper-page-container") && y(); + let r = function(t) { + v(), f(), setTimeout(() => { + document.querySelector(".newspaper-page-container") && y(); + }, 50); + }, e = function(t) { + }; + document.body.addEventListener("htmx:afterSettle", r), document.body.addEventListener("htmx:afterSettle", f), document.body.addEventListener("htmx:beforeRequest", e); +} export { - de as setup + K as setup }; diff --git a/views/assets/style.css b/views/assets/style.css index 7499d35..1d8e022 100644 --- a/views/assets/style.css +++ b/views/assets/style.css @@ -1 +1 @@ -/*! tailwindcss v4.0.0 | MIT License | https://tailwindcss.com */@layer theme{:root{--font-sans:"Source Sans 3","Merriweather Sans",ui-sans-serif;--font-serif:"Merriweather",ui-serif;--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-50:oklch(.971 .013 17.38);--color-red-100:oklch(.936 .032 17.717);--color-red-200:oklch(.885 .062 18.334);--color-red-300:oklch(.808 .114 19.571);--color-red-400:oklch(.704 .191 22.216);--color-red-500:oklch(.637 .237 25.331);--color-red-600:oklch(.577 .245 27.325);--color-red-700:oklch(.505 .213 27.518);--color-red-800:oklch(.444 .177 26.899);--color-red-900:oklch(.396 .141 25.723);--color-red-950:oklch(.258 .092 26.042);--color-orange-50:oklch(.98 .016 73.684);--color-orange-100:oklch(.954 .038 75.164);--color-orange-200:oklch(.901 .076 70.697);--color-orange-300:oklch(.837 .128 66.29);--color-orange-400:oklch(.75 .183 55.934);--color-orange-500:oklch(.705 .213 47.604);--color-orange-600:oklch(.646 .222 41.116);--color-orange-700:oklch(.553 .195 38.402);--color-orange-800:oklch(.47 .157 37.304);--color-orange-900:oklch(.408 .123 38.172);--color-orange-950:oklch(.266 .079 36.259);--color-amber-50:oklch(.987 .022 95.277);--color-amber-100:oklch(.962 .059 95.617);--color-amber-200:oklch(.924 .12 95.746);--color-amber-300:oklch(.879 .169 91.605);--color-amber-400:oklch(.828 .189 84.429);--color-amber-500:oklch(.769 .188 70.08);--color-amber-600:oklch(.666 .179 58.318);--color-amber-700:oklch(.555 .163 48.998);--color-amber-800:oklch(.473 .137 46.201);--color-amber-900:oklch(.414 .112 45.904);--color-amber-950:oklch(.279 .077 45.635);--color-yellow-50:oklch(.987 .026 102.212);--color-yellow-100:oklch(.973 .071 103.193);--color-yellow-200:oklch(.945 .129 101.54);--color-yellow-300:oklch(.905 .182 98.111);--color-yellow-400:oklch(.852 .199 91.936);--color-yellow-500:oklch(.795 .184 86.047);--color-yellow-600:oklch(.681 .162 75.834);--color-yellow-700:oklch(.554 .135 66.442);--color-yellow-800:oklch(.476 .114 61.907);--color-yellow-900:oklch(.421 .095 57.708);--color-yellow-950:oklch(.286 .066 53.813);--color-lime-50:oklch(.986 .031 120.757);--color-lime-100:oklch(.967 .067 122.328);--color-lime-200:oklch(.938 .127 124.321);--color-lime-300:oklch(.897 .196 126.665);--color-lime-400:oklch(.841 .238 128.85);--color-lime-500:oklch(.768 .233 130.85);--color-lime-600:oklch(.648 .2 131.684);--color-lime-700:oklch(.532 .157 131.589);--color-lime-800:oklch(.453 .124 130.933);--color-lime-900:oklch(.405 .101 131.063);--color-lime-950:oklch(.274 .072 132.109);--color-green-50:oklch(.982 .018 155.826);--color-green-100:oklch(.962 .044 156.743);--color-green-200:oklch(.925 .084 155.995);--color-green-300:oklch(.871 .15 154.449);--color-green-400:oklch(.792 .209 151.711);--color-green-500:oklch(.723 .219 149.579);--color-green-600:oklch(.627 .194 149.214);--color-green-700:oklch(.527 .154 150.069);--color-green-800:oklch(.448 .119 151.328);--color-green-900:oklch(.393 .095 152.535);--color-green-950:oklch(.266 .065 152.934);--color-emerald-50:oklch(.979 .021 166.113);--color-emerald-100:oklch(.95 .052 163.051);--color-emerald-200:oklch(.905 .093 164.15);--color-emerald-300:oklch(.845 .143 164.978);--color-emerald-400:oklch(.765 .177 163.223);--color-emerald-500:oklch(.696 .17 162.48);--color-emerald-600:oklch(.596 .145 163.225);--color-emerald-700:oklch(.508 .118 165.612);--color-emerald-800:oklch(.432 .095 166.913);--color-emerald-900:oklch(.378 .077 168.94);--color-emerald-950:oklch(.262 .051 172.552);--color-teal-50:oklch(.984 .014 180.72);--color-teal-100:oklch(.953 .051 180.801);--color-teal-200:oklch(.91 .096 180.426);--color-teal-300:oklch(.855 .138 181.071);--color-teal-400:oklch(.777 .152 181.912);--color-teal-500:oklch(.704 .14 182.503);--color-teal-600:oklch(.6 .118 184.704);--color-teal-700:oklch(.511 .096 186.391);--color-teal-800:oklch(.437 .078 188.216);--color-teal-900:oklch(.386 .063 188.416);--color-teal-950:oklch(.277 .046 192.524);--color-cyan-50:oklch(.984 .019 200.873);--color-cyan-100:oklch(.956 .045 203.388);--color-cyan-200:oklch(.917 .08 205.041);--color-cyan-300:oklch(.865 .127 207.078);--color-cyan-400:oklch(.789 .154 211.53);--color-cyan-500:oklch(.715 .143 215.221);--color-cyan-600:oklch(.609 .126 221.723);--color-cyan-700:oklch(.52 .105 223.128);--color-cyan-800:oklch(.45 .085 224.283);--color-cyan-900:oklch(.398 .07 227.392);--color-cyan-950:oklch(.302 .056 229.695);--color-sky-50:oklch(.977 .013 236.62);--color-sky-100:oklch(.951 .026 236.824);--color-sky-200:oklch(.901 .058 230.902);--color-sky-300:oklch(.828 .111 230.318);--color-sky-400:oklch(.746 .16 232.661);--color-sky-500:oklch(.685 .169 237.323);--color-sky-600:oklch(.588 .158 241.966);--color-sky-700:oklch(.5 .134 242.749);--color-sky-800:oklch(.443 .11 240.79);--color-sky-900:oklch(.391 .09 240.876);--color-sky-950:oklch(.293 .066 243.157);--color-blue-50:oklch(.97 .014 254.604);--color-blue-100:oklch(.932 .032 255.585);--color-blue-200:oklch(.882 .059 254.128);--color-blue-300:oklch(.809 .105 251.813);--color-blue-400:oklch(.707 .165 254.624);--color-blue-500:oklch(.623 .214 259.815);--color-blue-600:oklch(.546 .245 262.881);--color-blue-700:oklch(.488 .243 264.376);--color-blue-800:oklch(.424 .199 265.638);--color-blue-900:oklch(.379 .146 265.522);--color-blue-950:oklch(.282 .091 267.935);--color-indigo-50:oklch(.962 .018 272.314);--color-indigo-100:oklch(.93 .034 272.788);--color-indigo-200:oklch(.87 .065 274.039);--color-indigo-300:oklch(.785 .115 274.713);--color-indigo-400:oklch(.673 .182 276.935);--color-indigo-500:oklch(.585 .233 277.117);--color-indigo-600:oklch(.511 .262 276.966);--color-indigo-700:oklch(.457 .24 277.023);--color-indigo-800:oklch(.398 .195 277.366);--color-indigo-900:oklch(.359 .144 278.697);--color-indigo-950:oklch(.257 .09 281.288);--color-violet-50:oklch(.969 .016 293.756);--color-violet-100:oklch(.943 .029 294.588);--color-violet-200:oklch(.894 .057 293.283);--color-violet-300:oklch(.811 .111 293.571);--color-violet-400:oklch(.702 .183 293.541);--color-violet-500:oklch(.606 .25 292.717);--color-violet-600:oklch(.541 .281 293.009);--color-violet-700:oklch(.491 .27 292.581);--color-violet-800:oklch(.432 .232 292.759);--color-violet-900:oklch(.38 .189 293.745);--color-violet-950:oklch(.283 .141 291.089);--color-purple-50:oklch(.977 .014 308.299);--color-purple-100:oklch(.946 .033 307.174);--color-purple-200:oklch(.902 .063 306.703);--color-purple-300:oklch(.827 .119 306.383);--color-purple-400:oklch(.714 .203 305.504);--color-purple-500:oklch(.627 .265 303.9);--color-purple-600:oklch(.558 .288 302.321);--color-purple-700:oklch(.496 .265 301.924);--color-purple-800:oklch(.438 .218 303.724);--color-purple-900:oklch(.381 .176 304.987);--color-purple-950:oklch(.291 .149 302.717);--color-fuchsia-50:oklch(.977 .017 320.058);--color-fuchsia-100:oklch(.952 .037 318.852);--color-fuchsia-200:oklch(.903 .076 319.62);--color-fuchsia-300:oklch(.833 .145 321.434);--color-fuchsia-400:oklch(.74 .238 322.16);--color-fuchsia-500:oklch(.667 .295 322.15);--color-fuchsia-600:oklch(.591 .293 322.896);--color-fuchsia-700:oklch(.518 .253 323.949);--color-fuchsia-800:oklch(.452 .211 324.591);--color-fuchsia-900:oklch(.401 .17 325.612);--color-fuchsia-950:oklch(.293 .136 325.661);--color-pink-50:oklch(.971 .014 343.198);--color-pink-100:oklch(.948 .028 342.258);--color-pink-200:oklch(.899 .061 343.231);--color-pink-300:oklch(.823 .12 346.018);--color-pink-400:oklch(.718 .202 349.761);--color-pink-500:oklch(.656 .241 354.308);--color-pink-600:oklch(.592 .249 .584);--color-pink-700:oklch(.525 .223 3.958);--color-pink-800:oklch(.459 .187 3.815);--color-pink-900:oklch(.408 .153 2.432);--color-pink-950:oklch(.284 .109 3.907);--color-rose-50:oklch(.969 .015 12.422);--color-rose-100:oklch(.941 .03 12.58);--color-rose-200:oklch(.892 .058 10.001);--color-rose-300:oklch(.81 .117 11.638);--color-rose-400:oklch(.712 .194 13.428);--color-rose-500:oklch(.645 .246 16.439);--color-rose-600:oklch(.586 .253 17.585);--color-rose-700:oklch(.514 .222 16.935);--color-rose-800:oklch(.455 .188 13.697);--color-rose-900:oklch(.41 .159 10.272);--color-rose-950:oklch(.271 .105 12.094);--color-slate-50:oklch(.984 .003 247.858);--color-slate-100:oklch(.968 .007 247.896);--color-slate-200:oklch(.929 .013 255.508);--color-slate-300:oklch(.869 .022 252.894);--color-slate-400:oklch(.704 .04 256.788);--color-slate-500:oklch(.554 .046 257.417);--color-slate-600:oklch(.446 .043 257.281);--color-slate-700:oklch(.372 .044 257.287);--color-slate-800:oklch(.279 .041 260.031);--color-slate-900:oklch(.208 .042 265.755);--color-slate-950:oklch(.129 .042 264.695);--color-gray-50:oklch(.985 .002 247.839);--color-gray-100:oklch(.967 .003 264.542);--color-gray-200:oklch(.928 .006 264.531);--color-gray-300:oklch(.872 .01 258.338);--color-gray-400:oklch(.707 .022 261.325);--color-gray-500:oklch(.551 .027 264.364);--color-gray-600:oklch(.446 .03 256.802);--color-gray-700:oklch(.373 .034 259.733);--color-gray-800:oklch(.278 .033 256.848);--color-gray-900:oklch(.21 .034 264.665);--color-gray-950:oklch(.13 .028 261.692);--color-zinc-50:oklch(.985 0 0);--color-zinc-100:oklch(.967 .001 286.375);--color-zinc-200:oklch(.92 .004 286.32);--color-zinc-300:oklch(.871 .006 286.286);--color-zinc-400:oklch(.705 .015 286.067);--color-zinc-500:oklch(.552 .016 285.938);--color-zinc-600:oklch(.442 .017 285.786);--color-zinc-700:oklch(.37 .013 285.805);--color-zinc-800:oklch(.274 .006 286.033);--color-zinc-900:oklch(.21 .006 285.885);--color-zinc-950:oklch(.141 .005 285.823);--color-neutral-50:oklch(.985 0 0);--color-neutral-100:oklch(.97 0 0);--color-neutral-200:oklch(.922 0 0);--color-neutral-300:oklch(.87 0 0);--color-neutral-400:oklch(.708 0 0);--color-neutral-500:oklch(.556 0 0);--color-neutral-600:oklch(.439 0 0);--color-neutral-700:oklch(.371 0 0);--color-neutral-800:oklch(.269 0 0);--color-neutral-900:oklch(.205 0 0);--color-neutral-950:oklch(.145 0 0);--color-stone-50:oklch(.985 .001 106.423);--color-stone-100:oklch(.97 .001 106.424);--color-stone-200:oklch(.923 .003 48.717);--color-stone-300:oklch(.869 .005 56.366);--color-stone-400:oklch(.709 .01 56.259);--color-stone-500:oklch(.553 .013 58.071);--color-stone-600:oklch(.444 .011 73.639);--color-stone-700:oklch(.374 .01 67.558);--color-stone-800:oklch(.268 .007 34.298);--color-stone-900:oklch(.216 .006 56.043);--color-stone-950:oklch(.147 .004 49.25);--color-black:#000;--color-white:#fff;--spacing:.25rem;--breakpoint-sm:40rem;--breakpoint-md:48rem;--breakpoint-lg:64rem;--breakpoint-xl:80rem;--breakpoint-2xl:96rem;--container-3xs:16rem;--container-2xs:18rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--container-5xl:64rem;--container-6xl:72rem;--container-7xl:80rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5/2.25);--text-5xl:3rem;--text-5xl--line-height:1;--text-6xl:3.75rem;--text-6xl--line-height:1;--text-7xl:4.5rem;--text-7xl--line-height:1;--text-8xl:6rem;--text-8xl--line-height:1;--text-9xl:8rem;--text-9xl--line-height:1;--font-weight-thin:100;--font-weight-extralight:200;--font-weight-light:300;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-extrabold:800;--font-weight-black:900;--tracking-tighter:-.05em;--tracking-tight:-.025em;--tracking-normal:0em;--tracking-wide:.025em;--tracking-wider:.05em;--tracking-widest:.1em;--leading-tight:1.25;--leading-snug:1.375;--leading-normal:1.5;--leading-relaxed:1.625;--leading-loose:2;--radius-xs:.125rem;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--radius-3xl:1.5rem;--radius-4xl:2rem;--shadow-2xs:0 1px #0000000d;--shadow-xs:0 1px 2px 0 #0000000d;--shadow-sm:0 1px 3px 0 #0000001a,0 1px 2px -1px #0000001a;--shadow-md:0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a;--shadow-lg:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a;--shadow-xl:0 20px 25px -5px #0000001a,0 8px 10px -6px #0000001a;--shadow-2xl:0 25px 50px -12px #00000040;--inset-shadow-2xs:inset 0 1px #0000000d;--inset-shadow-xs:inset 0 1px 1px #0000000d;--inset-shadow-sm:inset 0 2px 4px #0000000d;--drop-shadow-xs:0 1px 1px #0000000d;--drop-shadow-sm:0 1px 2px #00000026;--drop-shadow-md:0 3px 3px #0000001f;--drop-shadow-lg:0 4px 4px #00000026;--drop-shadow-xl:0 9px 7px #0000001a;--drop-shadow-2xl:0 25px 25px #00000026;--ease-in:cubic-bezier(.4,0,1,1);--ease-out:cubic-bezier(0,0,.2,1);--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--animate-ping:ping 1s cubic-bezier(0,0,.2,1)infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--animate-bounce:bounce 1s infinite;--blur-xs:4px;--blur-sm:8px;--blur-md:12px;--blur-lg:16px;--blur-xl:24px;--blur-2xl:40px;--blur-3xl:64px;--perspective-dramatic:100px;--perspective-near:300px;--perspective-normal:500px;--perspective-midrange:800px;--perspective-distant:1200px;--aspect-video:16/9;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-font-feature-settings:var(--font-sans--font-feature-settings);--default-font-variation-settings:var(--font-sans--font-variation-settings);--default-mono-font-family:var(--font-mono);--default-mono-font-feature-settings:var(--font-mono--font-feature-settings);--default-mono-font-variation-settings:var(--font-mono--font-variation-settings);--font-script:Rancho,ui-serif;--color-abyss:#0b1215;--color-shadow:#0f171f;--color-eclipse:#0b0b0b;--color-storm:#020c1a;--color-deep:#011122;--color-obsidian:#161616}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}body{line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1;color:color-mix(in oklab,currentColor 50%,transparent)}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*,:after,:before,::backdrop{border-color:var(--color-gray-200,currentColor)}::file-selector-button{border-color:var(--color-gray-200,currentColor)}}@layer components{html{font-size:17px}body{background-color:var(--color-slate-50)}h1,h2,h3,h4{font-family:var(--font-serif);--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}a{-webkit-hyphens:none;hyphens:none;color:var(--color-slate-700);text-decoration-line:underline;text-decoration-style:dotted}@media (hover:hover){a:hover{color:var(--color-slate-900);text-decoration-style:solid}}ul{margin-block:calc(var(--spacing)*2)}li{margin-left:calc(var(--spacing)*14);list-style-type:disc}a[aria-current=page]{color:var(--color-red-500)!important}main{flex-grow:1;flex-shrink:0}.newspaper-page-container{margin-bottom:2rem}.newspaper-page-container .absolute .page-indicator{pointer-events:auto;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}@media (width<=768px){.newspaper-page-container .absolute{transform:scale(.9)}}.single-page{justify-content:center;display:flex}.single-page .newspaper-page-image{width:100%;max-width:min(400px,100%);height:auto}@media (width>=1280px){.single-page .newspaper-page-image{max-width:min(600px,100%)}}@media (width>=1536px){.single-page .newspaper-page-image{max-width:min(700px,100%)}}@media (width<=640px){.single-page .newspaper-page-image{max-width:100%}}button#prevPageBtn:hover:not([style*="display: none"]),button#nextPageBtn:hover,button#beilageBtn:hover{color:#374151!important;background-color:#d1d5db!important}button#beilageBtn:hover{color:#92400e!important;background-color:#fed7aa!important}.scrollspy-hover:hover:not(.font-medium){background-color:#fef2f2}}@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing)*0)}.-top-1{top:calc(var(--spacing)*-1)}.top-0{top:calc(var(--spacing)*0)}.top-2{top:calc(var(--spacing)*2)}.-right-1{right:calc(var(--spacing)*-1)}.right-2{right:calc(var(--spacing)*2)}.right-6{right:calc(var(--spacing)*6)}.bottom-6{bottom:calc(var(--spacing)*6)}.z-0{z-index:0}.z-10{z-index:10}.z-50{z-index:50}.col-span-1{grid-column:span 1/span 1}.col-span-2{grid-column:span 2/span 2}.col-span-10{grid-column:span 10/span 10}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.\!m-0{margin:calc(var(--spacing)*0)!important}.mx-1{margin-inline:calc(var(--spacing)*1)}.mx-3{margin-inline:calc(var(--spacing)*3)}.mx-auto{margin-inline:auto}.my-4{margin-block:calc(var(--spacing)*4)}.mt-0\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-6{margin-top:calc(var(--spacing)*6)}.mt-8{margin-top:calc(var(--spacing)*8)}.mt-12{margin-top:calc(var(--spacing)*12)}.mr-1{margin-right:calc(var(--spacing)*1)}.mr-2{margin-right:calc(var(--spacing)*2)}.mr-3{margin-right:calc(var(--spacing)*3)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-1\.5{margin-bottom:calc(var(--spacing)*1.5)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.mb-10{margin-bottom:calc(var(--spacing)*10)}.ml-1{margin-left:calc(var(--spacing)*1)}.ml-2{margin-left:calc(var(--spacing)*2)}.box-content{box-sizing:content-box}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.h-1{height:calc(var(--spacing)*1)}.h-2{height:calc(var(--spacing)*2)}.h-3{height:calc(var(--spacing)*3)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-7{height:calc(var(--spacing)*7)}.h-8{height:calc(var(--spacing)*8)}.h-10{height:calc(var(--spacing)*10)}.h-12{height:calc(var(--spacing)*12)}.h-auto{height:auto}.h-full{height:100%}.max-h-full{max-height:100%}.max-h-screen{max-height:100vh}.min-h-\[1\.5rem\]{min-height:1.5rem}.min-h-full{min-height:100%}.min-h-screen{min-height:100vh}.w-3{width:calc(var(--spacing)*3)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-6\/12{width:50%}.w-7{width:calc(var(--spacing)*7)}.w-8{width:calc(var(--spacing)*8)}.w-10{width:calc(var(--spacing)*10)}.w-12{width:calc(var(--spacing)*12)}.w-14{width:calc(var(--spacing)*14)}.w-16{width:calc(var(--spacing)*16)}.w-20{width:calc(var(--spacing)*20)}.w-96{width:calc(var(--spacing)*96)}.w-fit{width:fit-content}.w-full{width:100%}.w-px{width:1px}.max-w-\(--breakpoint-2xl\){max-width:var(--breakpoint-2xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-7xl{max-width:var(--container-7xl)}.max-w-\[95ch\]{max-width:95ch}.max-w-full{max-width:100%}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.translate-2{--tw-translate-x:calc(var(--spacing)*2);--tw-translate-y:calc(var(--spacing)*2);translate:var(--tw-translate-x)var(--tw-translate-y)}.scale-x-\[-1\]{--tw-scale-x:-1;scale:var(--tw-scale-x)var(--tw-scale-y)}.transform{transform:var(--tw-rotate-x)var(--tw-rotate-y)var(--tw-rotate-z)var(--tw-skew-x)var(--tw-skew-y)}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.cursor-zoom-in{cursor:zoom-in}.resize{resize:both}.scroll-mt-8{scroll-margin-top:calc(var(--spacing)*8)}.columns-2{columns:2}.break-inside-avoid{break-inside:avoid}.grid-flow-row-dense{grid-auto-flow:dense}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-11{grid-template-columns:repeat(11,minmax(0,1fr))}.grid-cols-subgrid{grid-template-columns:subgrid}.flex-col{flex-direction:column}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-6{gap:calc(var(--spacing)*6)}.gap-8{gap:calc(var(--spacing)*8)}.gap-x-1{column-gap:calc(var(--spacing)*1)}.gap-x-2{column-gap:calc(var(--spacing)*2)}.gap-x-4{column-gap:calc(var(--spacing)*4)}.gap-x-6{column-gap:calc(var(--spacing)*6)}.gap-x-8{column-gap:calc(var(--spacing)*8)}:where(.space-y-0>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*0)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*0)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*6)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*6)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*8)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*8)*calc(1 - var(--tw-space-y-reverse)))}.gap-y-2{row-gap:calc(var(--spacing)*2)}.gap-y-3{row-gap:calc(var(--spacing)*3)}.gap-y-4{row-gap:calc(var(--spacing)*4)}.gap-y-10{row-gap:calc(var(--spacing)*10)}.overflow-auto{overflow:auto}.overflow-y-auto{overflow-y:auto}.overscroll-contain{overscroll-behavior:contain}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-2{border-top-style:var(--tw-border-style);border-top-width:2px}.border-t-8{border-top-style:var(--tw-border-style);border-top-width:8px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-amber-200{border-color:var(--color-amber-200)}.border-amber-300{border-color:var(--color-amber-300)}.border-amber-400{border-color:var(--color-amber-400)}.border-blue-200{border-color:var(--color-blue-200)}.border-blue-300{border-color:var(--color-blue-300)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-green-300{border-color:var(--color-green-300)}.border-orange-300{border-color:var(--color-orange-300)}.border-purple-300{border-color:var(--color-purple-300)}.border-red-200{border-color:var(--color-red-200)}.border-red-300{border-color:var(--color-red-300)}.border-red-500{border-color:var(--color-red-500)}.border-slate-100{border-color:var(--color-slate-100)}.border-slate-200{border-color:var(--color-slate-200)}.border-slate-300{border-color:var(--color-slate-300)}.border-slate-400{border-color:var(--color-slate-400)}.border-slate-600{border-color:var(--color-slate-600)}.border-yellow-200{border-color:var(--color-yellow-200)}.bg-amber-50{background-color:var(--color-amber-50)}.bg-amber-100{background-color:var(--color-amber-100)}.bg-black{background-color:var(--color-black)}.bg-blue-50{background-color:var(--color-blue-50)}.bg-blue-100{background-color:var(--color-blue-100)}.bg-blue-600{background-color:var(--color-blue-600)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-gray-300{background-color:var(--color-gray-300)}.bg-gray-700{background-color:var(--color-gray-700)}.bg-green-100{background-color:var(--color-green-100)}.bg-orange-100{background-color:var(--color-orange-100)}.bg-purple-100{background-color:var(--color-purple-100)}.bg-red-50{background-color:var(--color-red-50)}.bg-red-100{background-color:var(--color-red-100)}.bg-red-500{background-color:var(--color-red-500)}.bg-slate-50{background-color:var(--color-slate-50)}.bg-slate-100{background-color:var(--color-slate-100)}.bg-slate-200{background-color:var(--color-slate-200)}.bg-slate-300{background-color:var(--color-slate-300)}.bg-slate-800{background-color:var(--color-slate-800)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-yellow-50{background-color:var(--color-yellow-50)}.object-contain{object-fit:contain}.\!p-0{padding:calc(var(--spacing)*0)!important}.p-1{padding:calc(var(--spacing)*1)}.p-4{padding:calc(var(--spacing)*4)}.p-6{padding:calc(var(--spacing)*6)}.p-8{padding:calc(var(--spacing)*8)}.px-0{padding-inline:calc(var(--spacing)*0)}.px-1\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-2\.5{padding-inline:calc(var(--spacing)*2.5)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-5{padding-inline:calc(var(--spacing)*5)}.px-6{padding-inline:calc(var(--spacing)*6)}.px-8{padding-inline:calc(var(--spacing)*8)}.py-0{padding-block:calc(var(--spacing)*0)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.py-6{padding-block:calc(var(--spacing)*6)}.py-8{padding-block:calc(var(--spacing)*8)}.py-16{padding-block:calc(var(--spacing)*16)}.pt-1{padding-top:calc(var(--spacing)*1)}.pt-3{padding-top:calc(var(--spacing)*3)}.pt-4{padding-top:calc(var(--spacing)*4)}.pt-6{padding-top:calc(var(--spacing)*6)}.pt-8{padding-top:calc(var(--spacing)*8)}.pr-1{padding-right:calc(var(--spacing)*1)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.pb-6{padding-bottom:calc(var(--spacing)*6)}.pb-8{padding-bottom:calc(var(--spacing)*8)}.pl-4{padding-left:calc(var(--spacing)*4)}.text-center{text-align:center}.text-right{text-align:right}.indent-6{text-indent:calc(var(--spacing)*6)}.align-bottom{vertical-align:bottom}.align-top{vertical-align:top}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.font-serif{font-family:var(--font-serif)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-6xl{font-size:var(--text-6xl);line-height:var(--tw-leading,var(--text-6xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.leading-none{--tw-leading:1;line-height:1}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-wrap{text-wrap:wrap}.hyphens-auto{-webkit-hyphens:auto;hyphens:auto}.whitespace-nowrap{white-space:nowrap}.text-amber-600{color:var(--color-amber-600)}.text-amber-700{color:var(--color-amber-700)}.text-black{color:var(--color-black)}.text-blue-600{color:var(--color-blue-600)}.text-blue-700{color:var(--color-blue-700)}.text-gray-100{color:var(--color-gray-100)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-gray-900{color:var(--color-gray-900)}.text-green-700{color:var(--color-green-700)}.text-orange-700{color:var(--color-orange-700)}.text-purple-700{color:var(--color-purple-700)}.text-red-600{color:var(--color-red-600)}.text-red-700{color:var(--color-red-700)}.text-red-800{color:var(--color-red-800)}.text-slate-400{color:var(--color-slate-400)}.text-slate-500{color:var(--color-slate-500)}.text-slate-600{color:var(--color-slate-600)}.text-slate-700{color:var(--color-slate-700)}.text-slate-800{color:var(--color-slate-800)}.text-white{color:var(--color-white)}.text-yellow-700{color:var(--color-yellow-700)}.text-yellow-800{color:var(--color-yellow-800)}.italic{font-style:italic}.no-underline{text-decoration-line:none}.no-underline\!{text-decoration-line:none!important}.overline{text-decoration-line:overline}.underline{text-decoration-line:underline}.decoration-slate-400{-webkit-text-decoration-color:var(--color-slate-400);text-decoration-color:var(--color-slate-400)}.decoration-dotted{text-decoration-style:dotted}.underline-offset-3{text-underline-offset:3px}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.ease-in{--tw-ease:var(--ease-in);transition-timing-function:var(--ease-in)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.\[a-zA-Z\:\\-\\\.\]{a-zA-Z:\-\.}.font-variant-small-caps{font-variant-caps:small-caps}.first\:mb-0:first-child{margin-bottom:calc(var(--spacing)*0)}.checked\:border-red-600:checked{border-color:var(--color-red-600)}.checked\:bg-red-600:checked{background-color:var(--color-red-600)}@media (hover:hover){.hover\:scale-\[1\.02\]:hover{scale:1.02}.hover\:border-amber-300:hover{border-color:var(--color-amber-300)}.hover\:border-blue-300:hover{border-color:var(--color-blue-300)}.hover\:border-slate-300:hover{border-color:var(--color-slate-300)}.hover\:bg-amber-50:hover{background-color:var(--color-amber-50)}.hover\:bg-amber-100:hover{background-color:var(--color-amber-100)}.hover\:bg-amber-200:hover{background-color:var(--color-amber-200)}.hover\:bg-blue-100:hover{background-color:var(--color-blue-100)}.hover\:bg-blue-200:hover{background-color:var(--color-blue-200)}.hover\:bg-blue-700:hover{background-color:var(--color-blue-700)}.hover\:bg-gray-200:hover{background-color:var(--color-gray-200)}.hover\:bg-gray-300:hover{background-color:var(--color-gray-300)}.hover\:bg-gray-800:hover{background-color:var(--color-gray-800)}.hover\:bg-green-200:hover{background-color:var(--color-green-200)}.hover\:bg-orange-200:hover{background-color:var(--color-orange-200)}.hover\:bg-purple-200:hover{background-color:var(--color-purple-200)}.hover\:bg-slate-100:hover{background-color:var(--color-slate-100)}.hover\:bg-slate-200:hover{background-color:var(--color-slate-200)}.hover\:text-amber-600:hover{color:var(--color-amber-600)}.hover\:text-amber-800:hover{color:var(--color-amber-800)}.hover\:text-blue-600:hover{color:var(--color-blue-600)}.hover\:text-blue-700:hover{color:var(--color-blue-700)}.hover\:text-blue-800:hover{color:var(--color-blue-800)}.hover\:text-gray-700:hover{color:var(--color-gray-700)}.hover\:text-gray-800:hover{color:var(--color-gray-800)}.hover\:text-green-800:hover{color:var(--color-green-800)}.hover\:text-red-600:hover{color:var(--color-red-600)}.hover\:text-slate-700:hover{color:var(--color-slate-700)}.hover\:text-slate-900:hover{color:var(--color-slate-900)}.hover\:decoration-slate-600:hover{-webkit-text-decoration-color:var(--color-slate-600);text-decoration-color:var(--color-slate-600)}.hover\:decoration-solid:hover{text-decoration-style:solid}.hover\:opacity-80:hover{opacity:.8}.hover\:shadow-xl:hover{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.focus\:border-blue-400:focus{border-color:var(--color-blue-400)}.focus\:border-blue-500:focus{border-color:var(--color-blue-500)}.focus\:border-red-500:focus{border-color:var(--color-red-500)}.focus\:ring-1:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentColor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentColor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-blue-400:focus{--tw-ring-color:var(--color-blue-400)}.focus\:ring-blue-500:focus{--tw-ring-color:var(--color-blue-500)}.focus\:ring-red-500:focus{--tw-ring-color:var(--color-red-500)}.focus\:ring-offset-1:focus{--tw-ring-offset-width:1px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}@media (width>=64rem){.lg\:sticky{position:sticky}.lg\:top-12{top:calc(var(--spacing)*12)}.lg\:h-12{height:calc(var(--spacing)*12)}.lg\:max-h-\[calc\(100vh-2rem\)\]{max-height:calc(100vh - 2rem)}.lg\:w-1\/4{width:25%}.lg\:w-3\/4{width:75%}.lg\:w-16{width:calc(var(--spacing)*16)}.lg\:w-20{width:calc(var(--spacing)*20)}.lg\:flex-row{flex-direction:row}.lg\:px-6{padding-inline:calc(var(--spacing)*6)}.lg\:text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}}@media (width>=80rem){.xl\:w-1\/4{width:25%}.xl\:w-3\/4{width:75%}.xl\:w-24{width:calc(var(--spacing)*24)}.xl\:px-8{padding-inline:calc(var(--spacing)*8)}}@media (width>=96rem){.\32xl\:mb-0{margin-bottom:calc(var(--spacing)*0)}.\32xl\:block{display:block}.\32xl\:hidden{display:none}}.\[\&\>a\]\:text-blue-600>a{color:var(--color-blue-600)}.\[\&\>a\:hover\]\:text-blue-700>a:hover{color:var(--color-blue-700)}.\[\&\>div\]\:bg-slate-100>div{background-color:var(--color-slate-100)}.\[\&\>div\]\:px-4>div{padding-inline:calc(var(--spacing)*4)}.\[\&\>div\]\:py-3>div{padding-block:calc(var(--spacing)*3)}}body:before{content:"";z-index:-1;opacity:.4;background-image:url(skyscraper.webp);background-position:50%;background-repeat:repeat;background-size:100px 100px;transition:transform 1.5s ease-in-out;animation:60s linear infinite backdrop-drift;position:fixed;top:-50%;right:-50%;bottom:-50%;left:-50%;transform:rotate(15deg)skew(25deg)scale(4)}@keyframes backdrop-drift{0%{transform:rotate(15deg)skew(25deg)scale(4)}25%{transform:rotate(20deg)skew(30deg)scale(4.1)}50%{transform:rotate(10deg)skew(20deg)scale(3.9)}75%{transform:rotate(18deg)skew(28deg)scale(4.05)}to{transform:rotate(15deg)skew(25deg)scale(4)}}body.page-akteure:before{animation:45s ease-in-out infinite backdrop-drift-akteure}body.page-ausgabe:before{animation:55s ease-in-out infinite backdrop-drift-ausgabe}body.page-search:before{animation:40s ease-in-out infinite backdrop-drift-search}body.page-ort:before{animation:65s ease-in-out infinite backdrop-drift-ort}body.page-kategorie:before{animation:50s ease-in-out infinite backdrop-drift-kategorie}body.page-piece:before{animation:58s ease-in-out infinite backdrop-drift-piece}body.page-edition:before{animation:42s ease-in-out infinite backdrop-drift-edition}@keyframes backdrop-drift-akteure{0%{transform:rotate(-35deg)skew(-40deg)scale(4.2)}25%{transform:rotate(-30deg)skew(-35deg)scale(4)}50%{transform:rotate(-40deg)skew(-45deg)scale(4.4)}75%{transform:rotate(-32deg)skew(-38deg)scale(4.1)}to{transform:rotate(-35deg)skew(-40deg)scale(4.2)}}@keyframes backdrop-drift-ausgabe{0%{transform:rotate(40deg)skew(15deg)scale(4.5)}25%{transform:rotate(45deg)skew(20deg)scale(4.3)}50%{transform:rotate(35deg)skew(10deg)scale(4.7)}75%{transform:rotate(42deg)skew(18deg)scale(4.4)}to{transform:rotate(40deg)skew(15deg)scale(4.5)}}@keyframes backdrop-drift-search{0%{transform:rotate(0)skew(45deg)scale(3.8)}25%{transform:rotate(5deg)skew(50deg)scale(3.6)}50%{transform:rotate(-5deg)skew(40deg)scale(4)}75%{transform:rotate(2deg)skew(48deg)scale(3.7)}to{transform:rotate(0)skew(45deg)scale(3.8)}}@keyframes backdrop-drift-ort{0%{transform:rotate(60deg)skew(-30deg)scale(4.8)}25%{transform:rotate(65deg)skew(-25deg)scale(4.6)}50%{transform:rotate(55deg)skew(-35deg)scale(5)}75%{transform:rotate(62deg)skew(-28deg)scale(4.7)}to{transform:rotate(60deg)skew(-30deg)scale(4.8)}}@keyframes backdrop-drift-kategorie{0%{transform:rotate(-25deg)skew(50deg)scale(4.1)}25%{transform:rotate(-20deg)skew(55deg)scale(3.9)}50%{transform:rotate(-30deg)skew(45deg)scale(4.3)}75%{transform:rotate(-22deg)skew(52deg)scale(4)}to{transform:rotate(-25deg)skew(50deg)scale(4.1)}}@keyframes backdrop-drift-piece{0%{transform:rotate(45deg)skew(-25deg)scale(4.3)}25%{transform:rotate(50deg)skew(-20deg)scale(4.1)}50%{transform:rotate(40deg)skew(-30deg)scale(4.5)}75%{transform:rotate(47deg)skew(-22deg)scale(4.2)}to{transform:rotate(45deg)skew(-25deg)scale(4.3)}}@keyframes backdrop-drift-edition{0%{transform:rotate(-50deg)skew(35deg)scale(3.9)}25%{transform:rotate(-45deg)skew(40deg)scale(3.7)}50%{transform:rotate(-55deg)skew(30deg)scale(4.1)}75%{transform:rotate(-48deg)skew(38deg)scale(3.8)}to{transform:rotate(-50deg)skew(35deg)scale(3.9)}}@keyframes spin{to{transform:rotate(360deg)}}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}@keyframes pulse{50%{opacity:.5}}@keyframes bounce{0%,to{animation-timing-function:cubic-bezier(.8,0,1,1);transform:translateY(-25%)}50%{animation-timing-function:cubic-bezier(0,0,.2,1);transform:none}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false;initial-value:rotateX(0)}@property --tw-rotate-y{syntax:"*";inherits:false;initial-value:rotateY(0)}@property --tw-rotate-z{syntax:"*";inherits:false;initial-value:rotateZ(0)}@property --tw-skew-x{syntax:"*";inherits:false;initial-value:skewX(0)}@property --tw-skew-y{syntax:"*";inherits:false;initial-value:skewY(0)}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false} +/*! tailwindcss v4.0.0 | MIT License | https://tailwindcss.com */@layer theme{:root{--font-sans:"Source Sans 3","Merriweather Sans",ui-sans-serif;--font-serif:"Merriweather",ui-serif;--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-50:oklch(.971 .013 17.38);--color-red-100:oklch(.936 .032 17.717);--color-red-200:oklch(.885 .062 18.334);--color-red-300:oklch(.808 .114 19.571);--color-red-400:oklch(.704 .191 22.216);--color-red-500:oklch(.637 .237 25.331);--color-red-600:oklch(.577 .245 27.325);--color-red-700:oklch(.505 .213 27.518);--color-red-800:oklch(.444 .177 26.899);--color-red-900:oklch(.396 .141 25.723);--color-red-950:oklch(.258 .092 26.042);--color-orange-50:oklch(.98 .016 73.684);--color-orange-100:oklch(.954 .038 75.164);--color-orange-200:oklch(.901 .076 70.697);--color-orange-300:oklch(.837 .128 66.29);--color-orange-400:oklch(.75 .183 55.934);--color-orange-500:oklch(.705 .213 47.604);--color-orange-600:oklch(.646 .222 41.116);--color-orange-700:oklch(.553 .195 38.402);--color-orange-800:oklch(.47 .157 37.304);--color-orange-900:oklch(.408 .123 38.172);--color-orange-950:oklch(.266 .079 36.259);--color-amber-50:oklch(.987 .022 95.277);--color-amber-100:oklch(.962 .059 95.617);--color-amber-200:oklch(.924 .12 95.746);--color-amber-300:oklch(.879 .169 91.605);--color-amber-400:oklch(.828 .189 84.429);--color-amber-500:oklch(.769 .188 70.08);--color-amber-600:oklch(.666 .179 58.318);--color-amber-700:oklch(.555 .163 48.998);--color-amber-800:oklch(.473 .137 46.201);--color-amber-900:oklch(.414 .112 45.904);--color-amber-950:oklch(.279 .077 45.635);--color-yellow-50:oklch(.987 .026 102.212);--color-yellow-100:oklch(.973 .071 103.193);--color-yellow-200:oklch(.945 .129 101.54);--color-yellow-300:oklch(.905 .182 98.111);--color-yellow-400:oklch(.852 .199 91.936);--color-yellow-500:oklch(.795 .184 86.047);--color-yellow-600:oklch(.681 .162 75.834);--color-yellow-700:oklch(.554 .135 66.442);--color-yellow-800:oklch(.476 .114 61.907);--color-yellow-900:oklch(.421 .095 57.708);--color-yellow-950:oklch(.286 .066 53.813);--color-lime-50:oklch(.986 .031 120.757);--color-lime-100:oklch(.967 .067 122.328);--color-lime-200:oklch(.938 .127 124.321);--color-lime-300:oklch(.897 .196 126.665);--color-lime-400:oklch(.841 .238 128.85);--color-lime-500:oklch(.768 .233 130.85);--color-lime-600:oklch(.648 .2 131.684);--color-lime-700:oklch(.532 .157 131.589);--color-lime-800:oklch(.453 .124 130.933);--color-lime-900:oklch(.405 .101 131.063);--color-lime-950:oklch(.274 .072 132.109);--color-green-50:oklch(.982 .018 155.826);--color-green-100:oklch(.962 .044 156.743);--color-green-200:oklch(.925 .084 155.995);--color-green-300:oklch(.871 .15 154.449);--color-green-400:oklch(.792 .209 151.711);--color-green-500:oklch(.723 .219 149.579);--color-green-600:oklch(.627 .194 149.214);--color-green-700:oklch(.527 .154 150.069);--color-green-800:oklch(.448 .119 151.328);--color-green-900:oklch(.393 .095 152.535);--color-green-950:oklch(.266 .065 152.934);--color-emerald-50:oklch(.979 .021 166.113);--color-emerald-100:oklch(.95 .052 163.051);--color-emerald-200:oklch(.905 .093 164.15);--color-emerald-300:oklch(.845 .143 164.978);--color-emerald-400:oklch(.765 .177 163.223);--color-emerald-500:oklch(.696 .17 162.48);--color-emerald-600:oklch(.596 .145 163.225);--color-emerald-700:oklch(.508 .118 165.612);--color-emerald-800:oklch(.432 .095 166.913);--color-emerald-900:oklch(.378 .077 168.94);--color-emerald-950:oklch(.262 .051 172.552);--color-teal-50:oklch(.984 .014 180.72);--color-teal-100:oklch(.953 .051 180.801);--color-teal-200:oklch(.91 .096 180.426);--color-teal-300:oklch(.855 .138 181.071);--color-teal-400:oklch(.777 .152 181.912);--color-teal-500:oklch(.704 .14 182.503);--color-teal-600:oklch(.6 .118 184.704);--color-teal-700:oklch(.511 .096 186.391);--color-teal-800:oklch(.437 .078 188.216);--color-teal-900:oklch(.386 .063 188.416);--color-teal-950:oklch(.277 .046 192.524);--color-cyan-50:oklch(.984 .019 200.873);--color-cyan-100:oklch(.956 .045 203.388);--color-cyan-200:oklch(.917 .08 205.041);--color-cyan-300:oklch(.865 .127 207.078);--color-cyan-400:oklch(.789 .154 211.53);--color-cyan-500:oklch(.715 .143 215.221);--color-cyan-600:oklch(.609 .126 221.723);--color-cyan-700:oklch(.52 .105 223.128);--color-cyan-800:oklch(.45 .085 224.283);--color-cyan-900:oklch(.398 .07 227.392);--color-cyan-950:oklch(.302 .056 229.695);--color-sky-50:oklch(.977 .013 236.62);--color-sky-100:oklch(.951 .026 236.824);--color-sky-200:oklch(.901 .058 230.902);--color-sky-300:oklch(.828 .111 230.318);--color-sky-400:oklch(.746 .16 232.661);--color-sky-500:oklch(.685 .169 237.323);--color-sky-600:oklch(.588 .158 241.966);--color-sky-700:oklch(.5 .134 242.749);--color-sky-800:oklch(.443 .11 240.79);--color-sky-900:oklch(.391 .09 240.876);--color-sky-950:oklch(.293 .066 243.157);--color-blue-50:oklch(.97 .014 254.604);--color-blue-100:oklch(.932 .032 255.585);--color-blue-200:oklch(.882 .059 254.128);--color-blue-300:oklch(.809 .105 251.813);--color-blue-400:oklch(.707 .165 254.624);--color-blue-500:oklch(.623 .214 259.815);--color-blue-600:oklch(.546 .245 262.881);--color-blue-700:oklch(.488 .243 264.376);--color-blue-800:oklch(.424 .199 265.638);--color-blue-900:oklch(.379 .146 265.522);--color-blue-950:oklch(.282 .091 267.935);--color-indigo-50:oklch(.962 .018 272.314);--color-indigo-100:oklch(.93 .034 272.788);--color-indigo-200:oklch(.87 .065 274.039);--color-indigo-300:oklch(.785 .115 274.713);--color-indigo-400:oklch(.673 .182 276.935);--color-indigo-500:oklch(.585 .233 277.117);--color-indigo-600:oklch(.511 .262 276.966);--color-indigo-700:oklch(.457 .24 277.023);--color-indigo-800:oklch(.398 .195 277.366);--color-indigo-900:oklch(.359 .144 278.697);--color-indigo-950:oklch(.257 .09 281.288);--color-violet-50:oklch(.969 .016 293.756);--color-violet-100:oklch(.943 .029 294.588);--color-violet-200:oklch(.894 .057 293.283);--color-violet-300:oklch(.811 .111 293.571);--color-violet-400:oklch(.702 .183 293.541);--color-violet-500:oklch(.606 .25 292.717);--color-violet-600:oklch(.541 .281 293.009);--color-violet-700:oklch(.491 .27 292.581);--color-violet-800:oklch(.432 .232 292.759);--color-violet-900:oklch(.38 .189 293.745);--color-violet-950:oklch(.283 .141 291.089);--color-purple-50:oklch(.977 .014 308.299);--color-purple-100:oklch(.946 .033 307.174);--color-purple-200:oklch(.902 .063 306.703);--color-purple-300:oklch(.827 .119 306.383);--color-purple-400:oklch(.714 .203 305.504);--color-purple-500:oklch(.627 .265 303.9);--color-purple-600:oklch(.558 .288 302.321);--color-purple-700:oklch(.496 .265 301.924);--color-purple-800:oklch(.438 .218 303.724);--color-purple-900:oklch(.381 .176 304.987);--color-purple-950:oklch(.291 .149 302.717);--color-fuchsia-50:oklch(.977 .017 320.058);--color-fuchsia-100:oklch(.952 .037 318.852);--color-fuchsia-200:oklch(.903 .076 319.62);--color-fuchsia-300:oklch(.833 .145 321.434);--color-fuchsia-400:oklch(.74 .238 322.16);--color-fuchsia-500:oklch(.667 .295 322.15);--color-fuchsia-600:oklch(.591 .293 322.896);--color-fuchsia-700:oklch(.518 .253 323.949);--color-fuchsia-800:oklch(.452 .211 324.591);--color-fuchsia-900:oklch(.401 .17 325.612);--color-fuchsia-950:oklch(.293 .136 325.661);--color-pink-50:oklch(.971 .014 343.198);--color-pink-100:oklch(.948 .028 342.258);--color-pink-200:oklch(.899 .061 343.231);--color-pink-300:oklch(.823 .12 346.018);--color-pink-400:oklch(.718 .202 349.761);--color-pink-500:oklch(.656 .241 354.308);--color-pink-600:oklch(.592 .249 .584);--color-pink-700:oklch(.525 .223 3.958);--color-pink-800:oklch(.459 .187 3.815);--color-pink-900:oklch(.408 .153 2.432);--color-pink-950:oklch(.284 .109 3.907);--color-rose-50:oklch(.969 .015 12.422);--color-rose-100:oklch(.941 .03 12.58);--color-rose-200:oklch(.892 .058 10.001);--color-rose-300:oklch(.81 .117 11.638);--color-rose-400:oklch(.712 .194 13.428);--color-rose-500:oklch(.645 .246 16.439);--color-rose-600:oklch(.586 .253 17.585);--color-rose-700:oklch(.514 .222 16.935);--color-rose-800:oklch(.455 .188 13.697);--color-rose-900:oklch(.41 .159 10.272);--color-rose-950:oklch(.271 .105 12.094);--color-slate-50:oklch(.984 .003 247.858);--color-slate-100:oklch(.968 .007 247.896);--color-slate-200:oklch(.929 .013 255.508);--color-slate-300:oklch(.869 .022 252.894);--color-slate-400:oklch(.704 .04 256.788);--color-slate-500:oklch(.554 .046 257.417);--color-slate-600:oklch(.446 .043 257.281);--color-slate-700:oklch(.372 .044 257.287);--color-slate-800:oklch(.279 .041 260.031);--color-slate-900:oklch(.208 .042 265.755);--color-slate-950:oklch(.129 .042 264.695);--color-gray-50:oklch(.985 .002 247.839);--color-gray-100:oklch(.967 .003 264.542);--color-gray-200:oklch(.928 .006 264.531);--color-gray-300:oklch(.872 .01 258.338);--color-gray-400:oklch(.707 .022 261.325);--color-gray-500:oklch(.551 .027 264.364);--color-gray-600:oklch(.446 .03 256.802);--color-gray-700:oklch(.373 .034 259.733);--color-gray-800:oklch(.278 .033 256.848);--color-gray-900:oklch(.21 .034 264.665);--color-gray-950:oklch(.13 .028 261.692);--color-zinc-50:oklch(.985 0 0);--color-zinc-100:oklch(.967 .001 286.375);--color-zinc-200:oklch(.92 .004 286.32);--color-zinc-300:oklch(.871 .006 286.286);--color-zinc-400:oklch(.705 .015 286.067);--color-zinc-500:oklch(.552 .016 285.938);--color-zinc-600:oklch(.442 .017 285.786);--color-zinc-700:oklch(.37 .013 285.805);--color-zinc-800:oklch(.274 .006 286.033);--color-zinc-900:oklch(.21 .006 285.885);--color-zinc-950:oklch(.141 .005 285.823);--color-neutral-50:oklch(.985 0 0);--color-neutral-100:oklch(.97 0 0);--color-neutral-200:oklch(.922 0 0);--color-neutral-300:oklch(.87 0 0);--color-neutral-400:oklch(.708 0 0);--color-neutral-500:oklch(.556 0 0);--color-neutral-600:oklch(.439 0 0);--color-neutral-700:oklch(.371 0 0);--color-neutral-800:oklch(.269 0 0);--color-neutral-900:oklch(.205 0 0);--color-neutral-950:oklch(.145 0 0);--color-stone-50:oklch(.985 .001 106.423);--color-stone-100:oklch(.97 .001 106.424);--color-stone-200:oklch(.923 .003 48.717);--color-stone-300:oklch(.869 .005 56.366);--color-stone-400:oklch(.709 .01 56.259);--color-stone-500:oklch(.553 .013 58.071);--color-stone-600:oklch(.444 .011 73.639);--color-stone-700:oklch(.374 .01 67.558);--color-stone-800:oklch(.268 .007 34.298);--color-stone-900:oklch(.216 .006 56.043);--color-stone-950:oklch(.147 .004 49.25);--color-black:#000;--color-white:#fff;--spacing:.25rem;--breakpoint-sm:40rem;--breakpoint-md:48rem;--breakpoint-lg:64rem;--breakpoint-xl:80rem;--breakpoint-2xl:96rem;--container-3xs:16rem;--container-2xs:18rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--container-5xl:64rem;--container-6xl:72rem;--container-7xl:80rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5/2.25);--text-5xl:3rem;--text-5xl--line-height:1;--text-6xl:3.75rem;--text-6xl--line-height:1;--text-7xl:4.5rem;--text-7xl--line-height:1;--text-8xl:6rem;--text-8xl--line-height:1;--text-9xl:8rem;--text-9xl--line-height:1;--font-weight-thin:100;--font-weight-extralight:200;--font-weight-light:300;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-extrabold:800;--font-weight-black:900;--tracking-tighter:-.05em;--tracking-tight:-.025em;--tracking-normal:0em;--tracking-wide:.025em;--tracking-wider:.05em;--tracking-widest:.1em;--leading-tight:1.25;--leading-snug:1.375;--leading-normal:1.5;--leading-relaxed:1.625;--leading-loose:2;--radius-xs:.125rem;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--radius-3xl:1.5rem;--radius-4xl:2rem;--shadow-2xs:0 1px #0000000d;--shadow-xs:0 1px 2px 0 #0000000d;--shadow-sm:0 1px 3px 0 #0000001a,0 1px 2px -1px #0000001a;--shadow-md:0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a;--shadow-lg:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a;--shadow-xl:0 20px 25px -5px #0000001a,0 8px 10px -6px #0000001a;--shadow-2xl:0 25px 50px -12px #00000040;--inset-shadow-2xs:inset 0 1px #0000000d;--inset-shadow-xs:inset 0 1px 1px #0000000d;--inset-shadow-sm:inset 0 2px 4px #0000000d;--drop-shadow-xs:0 1px 1px #0000000d;--drop-shadow-sm:0 1px 2px #00000026;--drop-shadow-md:0 3px 3px #0000001f;--drop-shadow-lg:0 4px 4px #00000026;--drop-shadow-xl:0 9px 7px #0000001a;--drop-shadow-2xl:0 25px 25px #00000026;--ease-in:cubic-bezier(.4,0,1,1);--ease-out:cubic-bezier(0,0,.2,1);--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--animate-ping:ping 1s cubic-bezier(0,0,.2,1)infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--animate-bounce:bounce 1s infinite;--blur-xs:4px;--blur-sm:8px;--blur-md:12px;--blur-lg:16px;--blur-xl:24px;--blur-2xl:40px;--blur-3xl:64px;--perspective-dramatic:100px;--perspective-near:300px;--perspective-normal:500px;--perspective-midrange:800px;--perspective-distant:1200px;--aspect-video:16/9;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-font-feature-settings:var(--font-sans--font-feature-settings);--default-font-variation-settings:var(--font-sans--font-variation-settings);--default-mono-font-family:var(--font-mono);--default-mono-font-feature-settings:var(--font-mono--font-feature-settings);--default-mono-font-variation-settings:var(--font-mono--font-variation-settings);--font-script:Rancho,ui-serif;--breakpoint-3xl:120.063rem;--color-abyss:#0b1215;--color-shadow:#0f171f;--color-eclipse:#0b0b0b;--color-storm:#020c1a;--color-deep:#011122;--color-obsidian:#161616}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}body{line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1;color:color-mix(in oklab,currentColor 50%,transparent)}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*,:after,:before,::backdrop{border-color:var(--color-gray-200,currentColor)}::file-selector-button{border-color:var(--color-gray-200,currentColor)}}@layer components{html{font-size:17px}body{background-color:var(--color-slate-50)}h1,h2,h3,h4{font-family:var(--font-serif);--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}a{-webkit-hyphens:none;hyphens:none;color:var(--color-slate-700);text-decoration-line:underline;text-decoration-style:dotted}@media (hover:hover){a:hover{color:var(--color-slate-900);text-decoration-style:solid}}ul{margin-block:calc(var(--spacing)*2)}li{margin-left:calc(var(--spacing)*14);list-style-type:disc}a[aria-current=page]{color:var(--color-red-500)!important}main{flex-grow:1;flex-shrink:0}.newspaper-page-container{margin-bottom:2rem}.newspaper-page-container .absolute .page-indicator{pointer-events:auto;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}@media (width<=768px){.newspaper-page-container .absolute{transform:scale(.9)}}.single-page{justify-content:center;display:flex}.single-page .newspaper-page-image{width:100%;max-width:min(400px,100%);height:auto}@media (width>=1280px){.single-page .newspaper-page-image{max-width:min(600px,100%)}}@media (width>=1536px){.single-page .newspaper-page-image{max-width:min(700px,100%)}}@media (width<=640px){.single-page .newspaper-page-image{max-width:100%}}button#prevPageBtn:hover:not([style*="display: none"]),button#nextPageBtn:hover,button#beilageBtn:hover{color:#374151!important;background-color:#d1d5db!important}button#beilageBtn:hover{color:#92400e!important;background-color:#fed7aa!important}.scrollspy-hover:hover:not(.font-medium){background-color:#fef2f2}}@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing)*0)}.-top-1{top:calc(var(--spacing)*-1)}.top-0{top:calc(var(--spacing)*0)}.top-2{top:calc(var(--spacing)*2)}.-right-1{right:calc(var(--spacing)*-1)}.right-2{right:calc(var(--spacing)*2)}.right-6{right:calc(var(--spacing)*6)}.bottom-6{bottom:calc(var(--spacing)*6)}.z-0{z-index:0}.z-10{z-index:10}.z-50{z-index:50}.col-span-1{grid-column:span 1/span 1}.col-span-2{grid-column:span 2/span 2}.col-span-10{grid-column:span 10/span 10}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}@media (width>=120.063rem){.container{max-width:120.063rem}}.\!m-0{margin:calc(var(--spacing)*0)!important}.mx-1{margin-inline:calc(var(--spacing)*1)}.mx-3{margin-inline:calc(var(--spacing)*3)}.mx-auto{margin-inline:auto}.my-4{margin-block:calc(var(--spacing)*4)}.mt-0\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-6{margin-top:calc(var(--spacing)*6)}.mt-8{margin-top:calc(var(--spacing)*8)}.mt-12{margin-top:calc(var(--spacing)*12)}.mr-1{margin-right:calc(var(--spacing)*1)}.mr-2{margin-right:calc(var(--spacing)*2)}.mr-3{margin-right:calc(var(--spacing)*3)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-1\.5{margin-bottom:calc(var(--spacing)*1.5)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.mb-10{margin-bottom:calc(var(--spacing)*10)}.ml-1{margin-left:calc(var(--spacing)*1)}.ml-2{margin-left:calc(var(--spacing)*2)}.box-content{box-sizing:content-box}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.h-1{height:calc(var(--spacing)*1)}.h-2{height:calc(var(--spacing)*2)}.h-3{height:calc(var(--spacing)*3)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-7{height:calc(var(--spacing)*7)}.h-8{height:calc(var(--spacing)*8)}.h-10{height:calc(var(--spacing)*10)}.h-12{height:calc(var(--spacing)*12)}.h-auto{height:auto}.h-full{height:100%}.max-h-full{max-height:100%}.max-h-screen{max-height:100vh}.min-h-\[1\.5rem\]{min-height:1.5rem}.min-h-full{min-height:100%}.min-h-screen{min-height:100vh}.w-3{width:calc(var(--spacing)*3)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-6\/12{width:50%}.w-7{width:calc(var(--spacing)*7)}.w-8{width:calc(var(--spacing)*8)}.w-10{width:calc(var(--spacing)*10)}.w-12{width:calc(var(--spacing)*12)}.w-14{width:calc(var(--spacing)*14)}.w-16{width:calc(var(--spacing)*16)}.w-20{width:calc(var(--spacing)*20)}.w-96{width:calc(var(--spacing)*96)}.w-fit{width:fit-content}.w-full{width:100%}.w-px{width:1px}.max-w-\(--breakpoint-2xl\){max-width:var(--breakpoint-2xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-7xl{max-width:var(--container-7xl)}.max-w-\[95ch\]{max-width:95ch}.max-w-full{max-width:100%}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.translate-2{--tw-translate-x:calc(var(--spacing)*2);--tw-translate-y:calc(var(--spacing)*2);translate:var(--tw-translate-x)var(--tw-translate-y)}.scale-x-\[-1\]{--tw-scale-x:-1;scale:var(--tw-scale-x)var(--tw-scale-y)}.transform{transform:var(--tw-rotate-x)var(--tw-rotate-y)var(--tw-rotate-z)var(--tw-skew-x)var(--tw-skew-y)}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.cursor-zoom-in{cursor:zoom-in}.resize{resize:both}.scroll-mt-8{scroll-margin-top:calc(var(--spacing)*8)}.columns-2{columns:2}.break-inside-avoid{break-inside:avoid}.grid-flow-row-dense{grid-auto-flow:dense}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-11{grid-template-columns:repeat(11,minmax(0,1fr))}.grid-cols-subgrid{grid-template-columns:subgrid}.flex-col{flex-direction:column}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-6{gap:calc(var(--spacing)*6)}.gap-8{gap:calc(var(--spacing)*8)}.gap-x-1{column-gap:calc(var(--spacing)*1)}.gap-x-2{column-gap:calc(var(--spacing)*2)}.gap-x-4{column-gap:calc(var(--spacing)*4)}.gap-x-6{column-gap:calc(var(--spacing)*6)}.gap-x-8{column-gap:calc(var(--spacing)*8)}:where(.space-y-0>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*0)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*0)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*6)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*6)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*8)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*8)*calc(1 - var(--tw-space-y-reverse)))}.gap-y-2{row-gap:calc(var(--spacing)*2)}.gap-y-3{row-gap:calc(var(--spacing)*3)}.gap-y-4{row-gap:calc(var(--spacing)*4)}.gap-y-10{row-gap:calc(var(--spacing)*10)}.overflow-auto{overflow:auto}.overflow-y-auto{overflow-y:auto}.overscroll-contain{overscroll-behavior:contain}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-2{border-top-style:var(--tw-border-style);border-top-width:2px}.border-t-8{border-top-style:var(--tw-border-style);border-top-width:8px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-amber-200{border-color:var(--color-amber-200)}.border-amber-300{border-color:var(--color-amber-300)}.border-amber-400{border-color:var(--color-amber-400)}.border-blue-200{border-color:var(--color-blue-200)}.border-blue-300{border-color:var(--color-blue-300)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-green-300{border-color:var(--color-green-300)}.border-orange-300{border-color:var(--color-orange-300)}.border-purple-300{border-color:var(--color-purple-300)}.border-red-200{border-color:var(--color-red-200)}.border-red-300{border-color:var(--color-red-300)}.border-slate-100{border-color:var(--color-slate-100)}.border-slate-200{border-color:var(--color-slate-200)}.border-slate-300{border-color:var(--color-slate-300)}.border-slate-400{border-color:var(--color-slate-400)}.border-slate-600{border-color:var(--color-slate-600)}.border-yellow-200{border-color:var(--color-yellow-200)}.bg-amber-50{background-color:var(--color-amber-50)}.bg-amber-100{background-color:var(--color-amber-100)}.bg-black{background-color:var(--color-black)}.bg-blue-50{background-color:var(--color-blue-50)}.bg-blue-100{background-color:var(--color-blue-100)}.bg-blue-600{background-color:var(--color-blue-600)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-gray-300{background-color:var(--color-gray-300)}.bg-gray-700{background-color:var(--color-gray-700)}.bg-green-100{background-color:var(--color-green-100)}.bg-orange-100{background-color:var(--color-orange-100)}.bg-purple-100{background-color:var(--color-purple-100)}.bg-red-50{background-color:var(--color-red-50)}.bg-red-100{background-color:var(--color-red-100)}.bg-red-500{background-color:var(--color-red-500)}.bg-slate-50{background-color:var(--color-slate-50)}.bg-slate-100{background-color:var(--color-slate-100)}.bg-slate-200{background-color:var(--color-slate-200)}.bg-slate-300{background-color:var(--color-slate-300)}.bg-slate-800{background-color:var(--color-slate-800)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-yellow-50{background-color:var(--color-yellow-50)}.object-contain{object-fit:contain}.\!p-0{padding:calc(var(--spacing)*0)!important}.p-1{padding:calc(var(--spacing)*1)}.p-4{padding:calc(var(--spacing)*4)}.p-6{padding:calc(var(--spacing)*6)}.p-8{padding:calc(var(--spacing)*8)}.px-0{padding-inline:calc(var(--spacing)*0)}.px-1\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-2\.5{padding-inline:calc(var(--spacing)*2.5)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-5{padding-inline:calc(var(--spacing)*5)}.px-6{padding-inline:calc(var(--spacing)*6)}.px-8{padding-inline:calc(var(--spacing)*8)}.py-0{padding-block:calc(var(--spacing)*0)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.py-6{padding-block:calc(var(--spacing)*6)}.py-8{padding-block:calc(var(--spacing)*8)}.py-16{padding-block:calc(var(--spacing)*16)}.pt-1{padding-top:calc(var(--spacing)*1)}.pt-3{padding-top:calc(var(--spacing)*3)}.pt-4{padding-top:calc(var(--spacing)*4)}.pt-6{padding-top:calc(var(--spacing)*6)}.pt-8{padding-top:calc(var(--spacing)*8)}.pr-1{padding-right:calc(var(--spacing)*1)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.pb-6{padding-bottom:calc(var(--spacing)*6)}.pb-8{padding-bottom:calc(var(--spacing)*8)}.pl-4{padding-left:calc(var(--spacing)*4)}.text-center{text-align:center}.text-right{text-align:right}.indent-6{text-indent:calc(var(--spacing)*6)}.align-bottom{vertical-align:bottom}.align-top{vertical-align:top}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.font-serif{font-family:var(--font-serif)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-6xl{font-size:var(--text-6xl);line-height:var(--tw-leading,var(--text-6xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.leading-none{--tw-leading:1;line-height:1}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-wrap{text-wrap:wrap}.hyphens-auto{-webkit-hyphens:auto;hyphens:auto}.whitespace-nowrap{white-space:nowrap}.text-amber-600{color:var(--color-amber-600)}.text-amber-700{color:var(--color-amber-700)}.text-black{color:var(--color-black)}.text-blue-600{color:var(--color-blue-600)}.text-blue-700{color:var(--color-blue-700)}.text-gray-100{color:var(--color-gray-100)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-gray-900{color:var(--color-gray-900)}.text-green-700{color:var(--color-green-700)}.text-orange-700{color:var(--color-orange-700)}.text-purple-700{color:var(--color-purple-700)}.text-red-600{color:var(--color-red-600)}.text-red-700{color:var(--color-red-700)}.text-red-800{color:var(--color-red-800)}.text-slate-400{color:var(--color-slate-400)}.text-slate-500{color:var(--color-slate-500)}.text-slate-600{color:var(--color-slate-600)}.text-slate-700{color:var(--color-slate-700)}.text-slate-800{color:var(--color-slate-800)}.text-white{color:var(--color-white)}.text-yellow-700{color:var(--color-yellow-700)}.text-yellow-800{color:var(--color-yellow-800)}.italic{font-style:italic}.no-underline{text-decoration-line:none}.no-underline\!{text-decoration-line:none!important}.overline{text-decoration-line:overline}.underline{text-decoration-line:underline}.decoration-slate-400{-webkit-text-decoration-color:var(--color-slate-400);text-decoration-color:var(--color-slate-400)}.decoration-dotted{text-decoration-style:dotted}.underline-offset-3{text-underline-offset:3px}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.ease-in{--tw-ease:var(--ease-in);transition-timing-function:var(--ease-in)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.\[a-zA-Z\:\\-\\\.\]{a-zA-Z:\-\.}.font-variant-small-caps{font-variant-caps:small-caps}.first\:mb-0:first-child{margin-bottom:calc(var(--spacing)*0)}.checked\:border-red-600:checked{border-color:var(--color-red-600)}.checked\:bg-red-600:checked{background-color:var(--color-red-600)}@media (hover:hover){.hover\:scale-\[1\.02\]:hover{scale:1.02}.hover\:border-amber-300:hover{border-color:var(--color-amber-300)}.hover\:border-blue-300:hover{border-color:var(--color-blue-300)}.hover\:border-slate-300:hover{border-color:var(--color-slate-300)}.hover\:bg-amber-50:hover{background-color:var(--color-amber-50)}.hover\:bg-amber-100:hover{background-color:var(--color-amber-100)}.hover\:bg-amber-200:hover{background-color:var(--color-amber-200)}.hover\:bg-blue-100:hover{background-color:var(--color-blue-100)}.hover\:bg-blue-200:hover{background-color:var(--color-blue-200)}.hover\:bg-blue-700:hover{background-color:var(--color-blue-700)}.hover\:bg-gray-200:hover{background-color:var(--color-gray-200)}.hover\:bg-gray-300:hover{background-color:var(--color-gray-300)}.hover\:bg-gray-800:hover{background-color:var(--color-gray-800)}.hover\:bg-green-200:hover{background-color:var(--color-green-200)}.hover\:bg-orange-200:hover{background-color:var(--color-orange-200)}.hover\:bg-purple-200:hover{background-color:var(--color-purple-200)}.hover\:bg-slate-100:hover{background-color:var(--color-slate-100)}.hover\:bg-slate-200:hover{background-color:var(--color-slate-200)}.hover\:text-amber-600:hover{color:var(--color-amber-600)}.hover\:text-amber-800:hover{color:var(--color-amber-800)}.hover\:text-blue-600:hover{color:var(--color-blue-600)}.hover\:text-blue-700:hover{color:var(--color-blue-700)}.hover\:text-blue-800:hover{color:var(--color-blue-800)}.hover\:text-gray-700:hover{color:var(--color-gray-700)}.hover\:text-gray-800:hover{color:var(--color-gray-800)}.hover\:text-green-800:hover{color:var(--color-green-800)}.hover\:text-red-600:hover{color:var(--color-red-600)}.hover\:text-slate-700:hover{color:var(--color-slate-700)}.hover\:text-slate-900:hover{color:var(--color-slate-900)}.hover\:decoration-slate-600:hover{-webkit-text-decoration-color:var(--color-slate-600);text-decoration-color:var(--color-slate-600)}.hover\:decoration-solid:hover{text-decoration-style:solid}.hover\:opacity-80:hover{opacity:.8}.hover\:shadow-xl:hover{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.focus\:border-blue-400:focus{border-color:var(--color-blue-400)}.focus\:border-blue-500:focus{border-color:var(--color-blue-500)}.focus\:border-red-500:focus{border-color:var(--color-red-500)}.focus\:ring-1:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentColor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentColor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-blue-400:focus{--tw-ring-color:var(--color-blue-400)}.focus\:ring-blue-500:focus{--tw-ring-color:var(--color-blue-500)}.focus\:ring-red-500:focus{--tw-ring-color:var(--color-red-500)}.focus\:ring-offset-1:focus{--tw-ring-offset-width:1px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}@media (width>=64rem){.lg\:sticky{position:sticky}.lg\:top-12{top:calc(var(--spacing)*12)}.lg\:h-12{height:calc(var(--spacing)*12)}.lg\:max-h-\[calc\(100vh-2rem\)\]{max-height:calc(100vh - 2rem)}.lg\:w-1\/4{width:25%}.lg\:w-3\/4{width:75%}.lg\:w-16{width:calc(var(--spacing)*16)}.lg\:w-20{width:calc(var(--spacing)*20)}.lg\:flex-row{flex-direction:row}.lg\:px-6{padding-inline:calc(var(--spacing)*6)}.lg\:text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}}@media (width>=80rem){.xl\:w-1\/4{width:25%}.xl\:w-3\/4{width:75%}.xl\:w-24{width:calc(var(--spacing)*24)}.xl\:px-8{padding-inline:calc(var(--spacing)*8)}}@media (width>=96rem){.\32xl\:mb-0{margin-bottom:calc(var(--spacing)*0)}.\32xl\:block{display:block}.\32xl\:hidden{display:none}.\32xl\:w-1\/4{width:25%}.\32xl\:w-3\/4{width:75%}}@media (width>=120.063rem){.\33xl\:w-1\/5{width:20%}.\33xl\:w-4\/5{width:80%}}.\[\&\>a\]\:text-blue-600>a{color:var(--color-blue-600)}.\[\&\>a\:hover\]\:text-blue-700>a:hover{color:var(--color-blue-700)}.\[\&\>div\]\:bg-slate-100>div{background-color:var(--color-slate-100)}.\[\&\>div\]\:px-4>div{padding-inline:calc(var(--spacing)*4)}.\[\&\>div\]\:py-3>div{padding-block:calc(var(--spacing)*3)}}body:before{content:"";z-index:-1;opacity:.4;background-image:url(skyscraper.webp);background-position:50%;background-repeat:repeat;background-size:100px 100px;transition:transform 1.5s ease-in-out;animation:60s linear infinite backdrop-drift;position:fixed;top:-50%;right:-50%;bottom:-50%;left:-50%;transform:rotate(15deg)skew(25deg)scale(4)}@keyframes backdrop-drift{0%{transform:rotate(15deg)skew(25deg)scale(4)}25%{transform:rotate(20deg)skew(30deg)scale(4.1)}50%{transform:rotate(10deg)skew(20deg)scale(3.9)}75%{transform:rotate(18deg)skew(28deg)scale(4.05)}to{transform:rotate(15deg)skew(25deg)scale(4)}}body.page-akteure:before{animation:45s ease-in-out infinite backdrop-drift-akteure}body.page-ausgabe:before{animation:55s ease-in-out infinite backdrop-drift-ausgabe}body.page-search:before{animation:40s ease-in-out infinite backdrop-drift-search}body.page-ort:before{animation:65s ease-in-out infinite backdrop-drift-ort}body.page-kategorie:before{animation:50s ease-in-out infinite backdrop-drift-kategorie}body.page-piece:before{animation:58s ease-in-out infinite backdrop-drift-piece}body.page-edition:before{animation:42s ease-in-out infinite backdrop-drift-edition}@keyframes backdrop-drift-akteure{0%{transform:rotate(-35deg)skew(-40deg)scale(4.2)}25%{transform:rotate(-30deg)skew(-35deg)scale(4)}50%{transform:rotate(-40deg)skew(-45deg)scale(4.4)}75%{transform:rotate(-32deg)skew(-38deg)scale(4.1)}to{transform:rotate(-35deg)skew(-40deg)scale(4.2)}}@keyframes backdrop-drift-ausgabe{0%{transform:rotate(40deg)skew(15deg)scale(4.5)}25%{transform:rotate(45deg)skew(20deg)scale(4.3)}50%{transform:rotate(35deg)skew(10deg)scale(4.7)}75%{transform:rotate(42deg)skew(18deg)scale(4.4)}to{transform:rotate(40deg)skew(15deg)scale(4.5)}}@keyframes backdrop-drift-search{0%{transform:rotate(0)skew(45deg)scale(3.8)}25%{transform:rotate(5deg)skew(50deg)scale(3.6)}50%{transform:rotate(-5deg)skew(40deg)scale(4)}75%{transform:rotate(2deg)skew(48deg)scale(3.7)}to{transform:rotate(0)skew(45deg)scale(3.8)}}@keyframes backdrop-drift-ort{0%{transform:rotate(60deg)skew(-30deg)scale(4.8)}25%{transform:rotate(65deg)skew(-25deg)scale(4.6)}50%{transform:rotate(55deg)skew(-35deg)scale(5)}75%{transform:rotate(62deg)skew(-28deg)scale(4.7)}to{transform:rotate(60deg)skew(-30deg)scale(4.8)}}@keyframes backdrop-drift-kategorie{0%{transform:rotate(-25deg)skew(50deg)scale(4.1)}25%{transform:rotate(-20deg)skew(55deg)scale(3.9)}50%{transform:rotate(-30deg)skew(45deg)scale(4.3)}75%{transform:rotate(-22deg)skew(52deg)scale(4)}to{transform:rotate(-25deg)skew(50deg)scale(4.1)}}@keyframes backdrop-drift-piece{0%{transform:rotate(45deg)skew(-25deg)scale(4.3)}25%{transform:rotate(50deg)skew(-20deg)scale(4.1)}50%{transform:rotate(40deg)skew(-30deg)scale(4.5)}75%{transform:rotate(47deg)skew(-22deg)scale(4.2)}to{transform:rotate(45deg)skew(-25deg)scale(4.3)}}@keyframes backdrop-drift-edition{0%{transform:rotate(-50deg)skew(35deg)scale(3.9)}25%{transform:rotate(-45deg)skew(40deg)scale(3.7)}50%{transform:rotate(-55deg)skew(30deg)scale(4.1)}75%{transform:rotate(-48deg)skew(38deg)scale(3.8)}to{transform:rotate(-50deg)skew(35deg)scale(3.9)}}@keyframes spin{to{transform:rotate(360deg)}}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}@keyframes pulse{50%{opacity:.5}}@keyframes bounce{0%,to{animation-timing-function:cubic-bezier(.8,0,1,1);transform:translateY(-25%)}50%{animation-timing-function:cubic-bezier(0,0,.2,1);transform:none}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false;initial-value:rotateX(0)}@property --tw-rotate-y{syntax:"*";inherits:false;initial-value:rotateY(0)}@property --tw-rotate-z{syntax:"*";inherits:false;initial-value:rotateZ(0)}@property --tw-skew-x{syntax:"*";inherits:false;initial-value:skewX(0)}@property --tw-skew-y{syntax:"*";inherits:false;initial-value:skewY(0)}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false} diff --git a/views/layouts/components/_footer.gohtml b/views/layouts/components/_footer.gohtml index cd522eb..7fd7f63 100644 --- a/views/layouts/components/_footer.gohtml +++ b/views/layouts/components/_footer.gohtml @@ -1 +1 @@ -
Datenschutz, Impressum.
+ diff --git a/views/routes/ausgabe/body.gohtml b/views/routes/ausgabe/body.gohtml index ac64eae..9bb54c2 100644 --- a/views/routes/ausgabe/body.gohtml +++ b/views/routes/ausgabe/body.gohtml @@ -6,7 +6,7 @@
-
+
{{ template "_title_nav" . }} diff --git a/views/routes/ausgabe/head.gohtml b/views/routes/ausgabe/head.gohtml index 7f56f10..5fa8e40 100644 --- a/views/routes/ausgabe/head.gohtml +++ b/views/routes/ausgabe/head.gohtml @@ -1,32 +1 @@ KGPZ – Ausgabe {{ .model.Number.No }} / {{ .model.Year }} - - - -{{ if .targetPage }} - -{{ end }} diff --git a/views/routes/components/_akteur_beitraege.gohtml b/views/routes/components/_akteur_beitraege.gohtml index 2c754f6..ad5880e 100644 --- a/views/routes/components/_akteur_beitraege.gohtml +++ b/views/routes/components/_akteur_beitraege.gohtml @@ -48,8 +48,7 @@ {{ " " }}{{- range $groupIndex, $groupItem := $groupedItems -}} {{- range $issueIndex, $issue := $groupItem.Item.IssueRefs -}} {{- if or (gt $groupIndex 0) (gt $issueIndex 0) }}, {{ end -}} - {{ template "_citation" $issue }} - {{- end -}} + {{- template "_citation" $issue -}}{{- end -}} {{- end -}} {{- /* Add "Ganzer Beitrag" link if piece spans multiple issues */ -}} {{- $firstGroupItem := index $groupedItems 0 -}} diff --git a/views/routes/components/_akteur_werke.gohtml b/views/routes/components/_akteur_werke.gohtml index 7c706dd..c21bd0c 100644 --- a/views/routes/components/_akteur_werke.gohtml +++ b/views/routes/components/_akteur_werke.gohtml @@ -182,8 +182,7 @@ {{ " " }}{{- range $pieceIndex, $p := $categoryPieces -}} {{- range $issueIndex, $issue := $p.Item.IssueRefs -}} {{- if or (gt $pieceIndex 0) (gt $issueIndex 0) }}, {{ end -}} - {{ template "_citation" $issue }} - {{- end -}} + {{- template "_citation" $issue -}}{{- end -}} {{- end -}} {{- /* Add "Ganzer Beitrag" link if piece spans multiple issues */ -}} {{- $firstPiece := index $categoryPieces 0 -}} @@ -304,8 +303,7 @@ {{ " " }}{{- range $pieceIndex, $p := $categoryPieces -}} {{- range $issueIndex, $issue := $p.Item.IssueRefs -}} {{- if or (gt $pieceIndex 0) (gt $issueIndex 0) }}, {{ end -}} - {{ template "_citation" $issue }} - {{- end -}} + {{- template "_citation" $issue -}}{{- end -}} {{- end -}} {{- /* Add "Ganzer Beitrag" link if piece spans multiple issues */ -}} {{- $firstPiece := index $categoryPieces 0 -}} diff --git a/views/routes/components/_citation.gohtml b/views/routes/components/_citation.gohtml index bdf8dc6..784c8e9 100644 --- a/views/routes/components/_citation.gohtml +++ b/views/routes/components/_citation.gohtml @@ -32,56 +32,9 @@ {{ $issue.When.Year }}/{{ $issue.Nr }} {{- end -}} {{- if $issue.Von }}, {{ if $issue.Beilage }}Beil. {{ else }}S. {{ end }}{{ $issue.Von }}{{- if and $issue.Bis (ne $issue.Von $issue.Bis) -}} --{{ $issue.Bis }} +-{{- $issue.Bis -}} {{- end -}} {{- end -}} - - \ No newline at end of file +{{- /* This is a dummy element to remove all whitespace at the end of the file, as some editiors +will insert a newline at the end of the file, UGH. */ -}} diff --git a/views/routes/components/_scrollspy_layout.gohtml b/views/routes/components/_scrollspy_layout.gohtml index e5cd01d..33c3e8a 100644 --- a/views/routes/components/_scrollspy_layout.gohtml +++ b/views/routes/components/_scrollspy_layout.gohtml @@ -63,3 +63,6 @@
+ + + diff --git a/views/routes/piece/body.gohtml b/views/routes/piece/body.gohtml index 14bf7e1..c34e2bd 100644 --- a/views/routes/piece/body.gohtml +++ b/views/routes/piece/body.gohtml @@ -6,14 +6,14 @@
-
+
{{ template "_piece_inhaltsverzeichnis" . }}
-
+
{{ template "_piece_sequential_layout" . }}
diff --git a/views/routes/piece/head.gohtml b/views/routes/piece/head.gohtml index 24fd1c3..99e1d42 100644 --- a/views/routes/piece/head.gohtml +++ b/views/routes/piece/head.gohtml @@ -1,32 +1 @@ -KGPZ – {{ if .model.Title }}{{ .model.Title }}{{ else }}Beitrag{{ end }} ({{ len .model.IssueContexts }} Teil{{ if gt (len .model.IssueContexts) 1 }}e{{ end }}) - - - -{{ if .targetPage }} - -{{ end }} \ No newline at end of file +KGPZ – {{ if .model.Title }}{{ .model.Title }}{{ else }}Beitrag{{ end }} ({{ len .model.IssueContexts }} Teil{{ if gt (len .model.IssueContexts) 1 }}e{{ end }}) \ No newline at end of file diff --git a/views/transform/akteure.js b/views/transform/akteure.js new file mode 100644 index 0000000..a85a544 --- /dev/null +++ b/views/transform/akteure.js @@ -0,0 +1,405 @@ +// =========================== +// AKTEURE/AUTHORS SCROLLSPY WEB COMPONENT +// =========================== + +export class AkteureScrollspy extends HTMLElement { + constructor() { + super(); + this.scrollHandler = null; + this.scrollTimeout = null; + this.clickHandlers = []; + this.manualNavigation = false; + } + + connectedCallback() { + // Small delay to ensure DOM is fully rendered after HTMX swap + setTimeout(() => { + this.initializeScrollspyAfterDelay(); + }, 100); + } + + initializeScrollspyAfterDelay() { + // Find sections and nav links + this.sections = document.querySelectorAll(".author-section"); + this.navLinks = document.querySelectorAll(".scrollspy-link"); + + if (this.sections.length === 0 || this.navLinks.length === 0) { + // Retry after a bit more time if elements not found + setTimeout(() => { + this.sections = document.querySelectorAll(".author-section"); + this.navLinks = document.querySelectorAll(".scrollspy-link"); + if (this.sections.length > 0 && this.navLinks.length > 0) { + this.initializeScrollspy(); + } + }, 200); + return; + } + + this.initializeScrollspy(); + } + + disconnectedCallback() { + this.cleanup(); + } + + initializeScrollspy() { + // Set up scroll handler + this.scrollHandler = () => { + clearTimeout(this.scrollTimeout); + this.scrollTimeout = setTimeout(() => { + this.updateActiveLink(); + this.updateSidebarScrollToTopButton(); + }, 50); + }; + + window.addEventListener("scroll", this.scrollHandler); + + // Add smooth scroll on link click + this.navLinks.forEach((link) => { + const clickHandler = (e) => { + e.preventDefault(); + const targetId = link.getAttribute("data-target"); + const target = document.getElementById(targetId); + if (target) { + // Immediately update the active link highlighting on click + this.updateActiveLinkImmediate(targetId); + + // Temporarily disable automatic sidebar scrolling during manual navigation + this.manualNavigation = true; + + target.scrollIntoView({ + behavior: "smooth", + block: "start", + }); + + // Re-enable automatic scrolling after navigation completes + setTimeout(() => { + this.manualNavigation = false; + // Ensure the full marker is visible after scroll settles + this.ensureMarkerVisibility(); + }, 1000); + } + }; + + this.clickHandlers.push({ link, handler: clickHandler }); + link.addEventListener("click", clickHandler); + }); + + // Initial active link update + this.updateActiveLink(); + + // Initial scroll-to-top button update + this.updateSidebarScrollToTopButton(); + } + + ensureMarkerVisibility() { + const slider = document.getElementById("scrollspy-slider"); + const nav = document.getElementById("scrollspy-nav"); + + if (!slider || !nav || slider.style.opacity === "0") { + return; + } + + const navRect = nav.getBoundingClientRect(); + const sliderTop = parseFloat(slider.style.top); + const sliderHeight = parseFloat(slider.style.height); + const sliderBottom = sliderTop + sliderHeight; + + // Check if the marker extends beyond the visible area + const navScrollTop = nav.scrollTop; + const navVisibleBottom = navScrollTop + navRect.height; + + if (sliderBottom > navVisibleBottom) { + // Marker extends below visible area - scroll down to show the bottom + const scrollTarget = sliderBottom - navRect.height + 20; // 20px padding + nav.scrollTo({ + top: scrollTarget, + behavior: "smooth", + }); + } else if (sliderTop < navScrollTop) { + // Marker extends above visible area - scroll up to show the top + const scrollTarget = sliderTop - 20; // 20px padding + nav.scrollTo({ + top: Math.max(0, scrollTarget), + behavior: "smooth", + }); + } + } + + updateActiveLink() { + // Safety check: ensure DOM elements still exist + if (!this.sections || !this.navLinks) { + return; + } + + const visibleSections = []; + const viewportTop = window.scrollY; + const viewportBottom = viewportTop + window.innerHeight; + + // Check which sections have any part of their Werke or Beiträge visible + try { + this.sections.forEach((section) => { + if (!section || !section.getAttribute) return; + const sectionId = section.getAttribute("id"); + + // Find Werke and Beiträge sections within this author section + const werkeSection = section.querySelector(".akteur-werke-section"); + const beitraegeSection = section.querySelector(".akteur-beitraege-section"); + + let isVisible = false; + + // Check if any part of Werke section is visible + if (werkeSection) { + const werkeRect = werkeSection.getBoundingClientRect(); + const werkeTopVisible = werkeRect.top < window.innerHeight; + const werkeBottomVisible = werkeRect.bottom > 0; + if (werkeTopVisible && werkeBottomVisible) { + isVisible = true; + } + } + + // Check if any part of Beiträge section is visible + if (beitraegeSection && !isVisible) { + const beitraegeRect = beitraegeSection.getBoundingClientRect(); + const beitraegeTopVisible = beitraegeRect.top < window.innerHeight; + const beitraegeBottomVisible = beitraegeRect.bottom > 0; + if (beitraegeTopVisible && beitraegeBottomVisible) { + isVisible = true; + } + } + + // Fallback: if no Werke/Beiträge sections, check header visibility (for authors without content) + if (!werkeSection && !beitraegeSection) { + const headerElement = section.querySelector("div:first-child"); + if (headerElement) { + const headerRect = headerElement.getBoundingClientRect(); + const headerTopVisible = headerRect.top >= 0; + const headerBottomVisible = headerRect.bottom <= window.innerHeight; + if (headerTopVisible && headerBottomVisible) { + isVisible = true; + } + } + } + + if (isVisible) { + visibleSections.push(sectionId); + } + }); + } catch (e) { + // Handle case where sections became stale during DOM manipulation + return; + } + + // Update highlighting with sliding background animation + const activeLinks = []; + const slider = document.getElementById("scrollspy-slider"); + + // Reset all links to default state (no background, just font weight for active) + this.navLinks.forEach((link) => { + link.classList.remove("font-medium"); + + const targetId = link.getAttribute("data-target"); + if (visibleSections.includes(targetId)) { + link.classList.add("font-medium"); + activeLinks.push(link); + } + }); + + // Calculate and animate the sliding background + if (activeLinks.length > 0 && slider) { + // Get the nav container for relative positioning + const nav = document.getElementById("scrollspy-nav"); + const navRect = nav.getBoundingClientRect(); + + // Calculate the combined area of all active links + let minTop = Infinity; + let maxBottom = -Infinity; + + activeLinks.forEach((link) => { + const linkRect = link.getBoundingClientRect(); + const relativeTop = linkRect.top - navRect.top + nav.scrollTop; + const relativeBottom = relativeTop + linkRect.height; + + minTop = Math.min(minTop, relativeTop); + maxBottom = Math.max(maxBottom, relativeBottom); + }); + + // Handle gaps between non-consecutive active links + let totalHeight = maxBottom - minTop; + + // Position and size the slider + slider.style.top = `${minTop}px`; + slider.style.height = `${totalHeight}px`; + slider.style.opacity = "1"; + + // Ensure the full marker is visible + setTimeout(() => this.ensureMarkerVisibility(), 100); + } else if (slider) { + // Hide slider when no active links + slider.style.opacity = "0"; + } + + // Implement proportional scrolling to keep active links visible + if (activeLinks.length > 0) { + this.updateSidebarScroll(activeLinks); + } + } + + updateActiveLinkImmediate(targetId) { + // Safety check: ensure DOM elements still exist + if (!this.navLinks) return; + + const slider = document.getElementById("scrollspy-slider"); + + // Reset all links + try { + this.navLinks.forEach((link) => { + if (link && link.classList) { + link.classList.remove("font-medium"); + } + }); + } catch (e) { + // Handle case where navLinks became stale + return; + } + + // Highlight the clicked link + const clickedLink = document.querySelector(`[data-target="${targetId}"]`); + if (clickedLink) { + clickedLink.classList.add("font-medium"); + + // Update slider position for the single clicked link + if (slider) { + const nav = document.getElementById("scrollspy-nav"); + if (nav) { + const navRect = nav.getBoundingClientRect(); + const linkRect = clickedLink.getBoundingClientRect(); + + const relativeTop = linkRect.top - navRect.top + nav.scrollTop; + slider.style.top = `${relativeTop}px`; + slider.style.height = `${linkRect.height}px`; + slider.style.opacity = "1"; + } + } + } + } + + updateSidebarScroll(activeLinks) { + // Skip automatic scrolling during manual navigation + if (this.manualNavigation) return; + + const sidebar = document.getElementById("scrollspy-nav"); + if (!sidebar) return; + + // Get the first active link as reference + const firstActiveLink = activeLinks[0]; + + // Calculate the main content scroll progress + const documentHeight = Math.max( + document.body.scrollHeight, + document.body.offsetHeight, + document.documentElement.clientHeight, + document.documentElement.scrollHeight, + document.documentElement.offsetHeight, + ); + const viewportHeight = window.innerHeight; + const maxScroll = documentHeight - viewportHeight; + const scrollProgress = maxScroll > 0 ? window.scrollY / maxScroll : 0; + + // Calculate sidebar scroll dimensions + const sidebarHeight = sidebar.clientHeight; + const sidebarScrollHeight = sidebar.scrollHeight; + const maxSidebarScroll = sidebarScrollHeight - sidebarHeight; + + if (maxSidebarScroll > 0) { + // Calculate proportional scroll position + const targetSidebarScroll = scrollProgress * maxSidebarScroll; + + // Get the position of the first active link within the sidebar + const linkRect = firstActiveLink.getBoundingClientRect(); + const sidebarRect = sidebar.getBoundingClientRect(); + const linkOffsetInSidebar = linkRect.top - sidebarRect.top + sidebar.scrollTop; + + // Calculate the desired position (center the active link in the sidebar viewport) + const sidebarCenter = sidebarHeight / 2; + const centeredPosition = linkOffsetInSidebar - sidebarCenter; + + // Use a blend of proportional scrolling and centering for smooth behavior + const blendFactor = 0.7; // 70% proportional, 30% centering + const finalScrollPosition = + blendFactor * targetSidebarScroll + (1 - blendFactor) * centeredPosition; + + // Clamp to valid scroll range + const clampedPosition = Math.max(0, Math.min(maxSidebarScroll, finalScrollPosition)); + + // Apply smooth scrolling, but only if the difference is significant + const currentScrollTop = sidebar.scrollTop; + const scrollDifference = Math.abs(clampedPosition - currentScrollTop); + + if (scrollDifference > 10) { + // Only scroll if more than 10px difference + sidebar.scrollTo({ + top: clampedPosition, + behavior: "smooth", + }); + } + } + } + + updateSidebarScrollToTopButton() { + const button = document.getElementById("sidebar-scroll-to-top"); + if (!button) return; + + const scrollTop = window.pageYOffset || document.documentElement.scrollTop; + const viewportHeight = window.innerHeight; + const shouldShow = scrollTop > viewportHeight * 0.5; // Show after scrolling 50% of viewport + + if (shouldShow) { + button.classList.remove("opacity-0"); + button.classList.add("opacity-100"); + } else { + button.classList.remove("opacity-100"); + button.classList.add("opacity-0"); + } + } + + cleanup() { + // Remove scroll listener + if (this.scrollHandler) { + window.removeEventListener("scroll", this.scrollHandler); + this.scrollHandler = null; + } + + // Clear timeout + if (this.scrollTimeout) { + clearTimeout(this.scrollTimeout); + this.scrollTimeout = null; + } + + // Remove click handlers + if (this.clickHandlers && this.clickHandlers.length > 0) { + this.clickHandlers.forEach(({ link, handler }) => { + if (link && handler) { + link.removeEventListener("click", handler); + } + }); + } + + // Reset slider + const slider = document.getElementById("scrollspy-slider"); + if (slider) { + slider.style.opacity = "0"; + slider.style.height = "0"; + } + + // Clear all references to DOM elements and state + this.sections = null; + this.navLinks = null; + this.clickHandlers = []; + this.manualNavigation = false; + } +} + +// Register the web component +customElements.define("akteure-scrollspy", AkteureScrollspy); + diff --git a/views/transform/issue.js b/views/transform/issue.js new file mode 100644 index 0000000..b5677d1 --- /dev/null +++ b/views/transform/issue.js @@ -0,0 +1,595 @@ +// =========================== +// ISSUE/NEWSPAPER LAYOUT FUNCTIONS +// =========================== + +// Global variables for state management +window.currentPageContainers = window.currentPageContainers || []; +window.currentActiveIndex = window.currentActiveIndex || 0; +window.pageObserver = window.pageObserver || null; + +// Modal functions +export function enlargePage(imgElement, pageNumber, isFromSpread, partNumber = null) { + // Get or create the single page viewer component + let viewer = document.querySelector("single-page-viewer"); + if (!viewer) { + viewer = document.createElement("single-page-viewer"); + document.body.appendChild(viewer); + } + + // Determine if this is a beilage page + const isBeilage = imgElement.closest('[data-beilage="true"]') !== null; + + // Get target page from template data if available + const targetPage = + window.templateData && window.templateData.targetPage ? window.templateData.targetPage : 0; + + // Show the page in the viewer + viewer.show(imgElement.src, imgElement.alt, pageNumber, isBeilage, targetPage, partNumber); +} + +export function closeModal() { + const modal = document.getElementById("pageModal"); + modal.classList.add("hidden"); +} + +// Page navigation functions +export function initializePageTracking() { + // Clean up existing observer + if (window.pageObserver) { + window.pageObserver.disconnect(); + window.pageObserver = null; + } + + // Reset state + window.currentPageContainers = Array.from(document.querySelectorAll(".newspaper-page-container")); + window.currentActiveIndex = 0; + updateButtonStates(); + + // Set up new observer + const existingObserver = document.querySelector(".newspaper-page-container"); + if (existingObserver) { + let visibleContainers = new Set(); + + window.pageObserver = new IntersectionObserver( + (entries) => { + entries.forEach((entry) => { + const containerIndex = window.currentPageContainers.indexOf(entry.target); + if (containerIndex !== -1) { + if (entry.isIntersecting) { + visibleContainers.add(containerIndex); + } else { + visibleContainers.delete(containerIndex); + } + } + }); + + // Update currentActiveIndex to the first (topmost) visible container + if (visibleContainers.size > 0) { + const sortedVisible = Array.from(visibleContainers).sort((a, b) => a - b); + const newActiveIndex = sortedVisible[0]; + if (newActiveIndex !== window.currentActiveIndex) { + window.currentActiveIndex = newActiveIndex; + updateButtonStates(); + } + } + }, + { + rootMargin: "-20% 0px -70% 0px", + }, + ); + + window.currentPageContainers.forEach((container) => { + window.pageObserver.observe(container); + }); + } +} + +export function scrollToPreviousPage() { + if (window.currentActiveIndex > 0) { + // Find the first page that's not currently visible + let targetIndex = -1; + + // Check which pages are currently visible + const visibleIndexes = []; + window.currentPageContainers.forEach((container, index) => { + const containerRect = container.getBoundingClientRect(); + const viewportHeight = window.innerHeight; + + const visibleTop = Math.max(containerRect.top, 0); + const visibleBottom = Math.min(containerRect.bottom, viewportHeight); + const visibleHeight = Math.max(0, visibleBottom - visibleTop); + const containerHeight = containerRect.height; + + const visibilityRatio = visibleHeight / containerHeight; + if (visibilityRatio >= 0.3) { + // Consider visible if 30% or more is showing + visibleIndexes.push(index); + } + }); + + // Find the first non-visible page before the current visible range + const minVisibleIndex = Math.min(...visibleIndexes); + for (let i = minVisibleIndex - 1; i >= 0; i--) { + if (!visibleIndexes.includes(i)) { + targetIndex = i; + break; + } + } + + // If no non-visible page found, go to the page just before the visible range + if (targetIndex === -1 && minVisibleIndex > 0) { + targetIndex = minVisibleIndex - 1; + } + + if (targetIndex >= 0) { + window.currentActiveIndex = targetIndex; + window.currentPageContainers[window.currentActiveIndex].scrollIntoView({ + behavior: "smooth", + block: "start", + }); + + // Update button states after a brief delay to let intersection observer catch up + setTimeout(() => { + updateButtonStates(); + }, 100); + } + } +} + +export function scrollToNextPage() { + if (window.currentActiveIndex < window.currentPageContainers.length - 1) { + // Find the first page that's not currently visible + let targetIndex = -1; + + // Check which pages are currently visible + const visibleIndexes = []; + window.currentPageContainers.forEach((container, index) => { + const containerRect = container.getBoundingClientRect(); + const viewportHeight = window.innerHeight; + + const visibleTop = Math.max(containerRect.top, 0); + const visibleBottom = Math.min(containerRect.bottom, viewportHeight); + const visibleHeight = Math.max(0, visibleBottom - visibleTop); + const containerHeight = containerRect.height; + + const visibilityRatio = visibleHeight / containerHeight; + if (visibilityRatio >= 0.3) { + // Consider visible if 30% or more is showing + visibleIndexes.push(index); + } + }); + + // Find the first non-visible page after the current visible range + const maxVisibleIndex = Math.max(...visibleIndexes); + for (let i = maxVisibleIndex + 1; i < window.currentPageContainers.length; i++) { + if (!visibleIndexes.includes(i)) { + targetIndex = i; + break; + } + } + + // If no non-visible page found, go to the page just after the visible range + if (targetIndex === -1 && maxVisibleIndex < window.currentPageContainers.length - 1) { + targetIndex = maxVisibleIndex + 1; + } + + if (targetIndex >= 0 && targetIndex < window.currentPageContainers.length) { + window.currentActiveIndex = targetIndex; + window.currentPageContainers[window.currentActiveIndex].scrollIntoView({ + behavior: "smooth", + block: "start", + }); + + // Update button states after a brief delay to let intersection observer catch up + setTimeout(() => { + updateButtonStates(); + }, 100); + } + } +} + +export function scrollToBeilage() { + // Check if we're currently viewing a Beilage section + const isViewingBeilage = isCurrentlyInBeilageSection(); + + if (isViewingBeilage) { + // Go back to main issue (first main page) + const firstMainPage = document.querySelector("#newspaper-content .newspaper-page-container"); + if (firstMainPage) { + firstMainPage.scrollIntoView({ + behavior: "smooth", + block: "start", + }); + } + } else { + // Go to first beilage container + const beilageContainer = document.querySelector('[class*="border-t-2 border-amber-200"]'); + if (beilageContainer) { + beilageContainer.scrollIntoView({ + behavior: "smooth", + block: "start", + }); + } + } +} + +function isCurrentlyInBeilageSection() { + // Check which pages are currently visible + const visibleIndexes = []; + window.currentPageContainers.forEach((container, index) => { + const containerRect = container.getBoundingClientRect(); + const viewportHeight = window.innerHeight; + + const visibleTop = Math.max(containerRect.top, 0); + const visibleBottom = Math.min(containerRect.bottom, viewportHeight); + const visibleHeight = Math.max(0, visibleBottom - visibleTop); + const containerHeight = containerRect.height; + + const visibilityRatio = visibleHeight / containerHeight; + if (visibilityRatio >= 0.3) { + // Consider visible if 30% or more is showing + visibleIndexes.push(index); + } + }); + + // Check if any visible page is a Beilage page + for (const index of visibleIndexes) { + const container = window.currentPageContainers[index]; + if (container && container.id && container.id.includes("beilage-")) { + return true; + } + } + + return false; +} + +export function updateButtonStates() { + const prevBtn = document.getElementById("prevPageBtn"); + const nextBtn = document.getElementById("nextPageBtn"); + const beilageBtn = document.getElementById("beilageBtn"); + + if (prevBtn) { + if (window.currentActiveIndex <= 0) { + prevBtn.style.display = "none"; + } else { + prevBtn.style.display = "flex"; + } + } + + if (nextBtn) { + if (window.currentActiveIndex >= window.currentPageContainers.length - 1) { + nextBtn.style.display = "none"; + } else { + nextBtn.style.display = "flex"; + } + } + + // Update Beilage button based on current location + if (beilageBtn) { + const isViewingBeilage = isCurrentlyInBeilageSection(); + const icon = beilageBtn.querySelector("i"); + + if (isViewingBeilage) { + // Show "Go to Main Issue" state - use gray styling + beilageBtn.title = "Zur Hauptausgabe"; + beilageBtn.className = + "w-14 h-10 lg:w-16 lg:h-12 px-2 py-1 bg-gray-100 hover:bg-gray-200 text-gray-700 hover:text-gray-800 border border-gray-300 transition-colors duration-200 flex items-center justify-center cursor-pointer"; + if (icon) { + icon.className = "ri-file-text-line text-lg lg:text-xl"; + } + } else { + // Show "Go to Beilage" state - use amber styling + beilageBtn.title = "Zu Beilage"; + beilageBtn.className = + "w-14 h-10 lg:w-16 lg:h-12 px-2 py-1 bg-amber-100 hover:bg-amber-200 text-amber-700 hover:text-amber-800 border border-amber-300 transition-colors duration-200 flex items-center justify-center cursor-pointer"; + if (icon) { + icon.className = "ri-attachment-line text-lg lg:text-xl"; + } + } + } +} + +// Share and citation functions +export function shareCurrentPage() { + const button = document.getElementById("shareLinkBtn"); + + // Get current page information + let pageInfo = ""; + + // Try to get the currently visible page number from active containers + if ( + window.currentActiveIndex !== undefined && + window.currentPageContainers && + window.currentPageContainers[window.currentActiveIndex] + ) { + const activeContainer = window.currentPageContainers[window.currentActiveIndex]; + const pageElement = activeContainer.querySelector("[data-page]"); + if (pageElement) { + const pageNumber = pageElement.getAttribute("data-page"); + pageInfo = `/${pageNumber}`; + } + } + + // Construct the shareable URL + const currentUrl = window.location.origin + window.location.pathname + pageInfo; + + // Try to use Web Share API if available (mobile browsers) + if (navigator.share) { + navigator + .share({ + title: document.title, + url: currentUrl, + }) + .catch((err) => { + // Fallback to clipboard + copyToClipboard(currentUrl, button); + }); + } else { + // Fallback: copy to clipboard + copyToClipboard(currentUrl, button); + } +} + +function copyToClipboard(text, button) { + if (navigator.clipboard) { + navigator.clipboard + .writeText(text) + .then(() => { + showSimplePopup(button, "Link kopiert!"); + }) + .catch((err) => { + showSimplePopup(button, "Kopieren fehlgeschlagen"); + }); + } else { + // Fallback for older browsers + const textarea = document.createElement("textarea"); + textarea.value = text; + document.body.appendChild(textarea); + textarea.select(); + try { + const successful = document.execCommand("copy"); + showSimplePopup(button, successful ? "Link kopiert!" : "Kopieren fehlgeschlagen"); + } catch (err) { + showSimplePopup(button, "Kopieren fehlgeschlagen"); + } finally { + document.body.removeChild(textarea); + } + } +} + +export function generateCitation() { + const button = document.getElementById("citationBtn"); + + // Get current page and issue information + const issueInfo = document.title || "KGPZ"; + + // Use clean URL without hash fragments + let cleanUrl = window.location.origin + window.location.pathname; + + // Remove any hash fragments that might still exist + if (cleanUrl.includes("#")) { + cleanUrl = cleanUrl.split("#")[0]; + } + + // Basic citation format (can be expanded later) + const currentDate = new Date().toLocaleDateString("de-DE"); + const citation = `Königsberger Gelehrte und Politische Zeitung (KGPZ). ${issueInfo}. Digital verfügbar unter: ${cleanUrl} (Zugriff: ${currentDate}).`; + + // Copy to clipboard + if (navigator.clipboard) { + navigator.clipboard + .writeText(citation) + .then(() => { + showSimplePopup(button, "Zitation kopiert!"); + }) + .catch((err) => { + showSimplePopup(button, "Kopieren fehlgeschlagen"); + }); + } else { + // Fallback for older browsers + const textarea = document.createElement("textarea"); + textarea.value = citation; + document.body.appendChild(textarea); + textarea.select(); + try { + const successful = document.execCommand("copy"); + showSimplePopup(button, successful ? "Zitation kopiert!" : "Kopieren fehlgeschlagen"); + } catch (err) { + showSimplePopup(button, "Kopieren fehlgeschlagen"); + } finally { + document.body.removeChild(textarea); + } + } +} + +function showSimplePopup(button, message) { + // Remove any existing popup + const existingPopup = document.querySelector(".simple-popup"); + if (existingPopup) { + existingPopup.remove(); + } + + // Create popup element + const popup = document.createElement("div"); + popup.className = "simple-popup"; + popup.textContent = message; + + // Style the popup + popup.style.cssText = ` + position: fixed; + background: #374151; + color: white; + padding: 6px 12px; + border-radius: 6px; + font-size: 13px; + font-weight: 500; + z-index: 1000; + pointer-events: none; + opacity: 0; + transition: opacity 0.2s ease; + white-space: nowrap; + `; + + // Position popup next to button + const buttonRect = button.getBoundingClientRect(); + const viewportHeight = window.innerHeight; + const viewportWidth = window.innerWidth; + + // Calculate position relative to viewport (since we're using fixed positioning) + let left = buttonRect.left - 10; + let top = buttonRect.bottom + 8; + + // Ensure popup doesn't go off-screen + const popupWidth = 120; // Estimated popup width + const popupHeight = 32; // Estimated popup height + + // Adjust horizontal position if too far right + if (left + popupWidth > viewportWidth) { + left = buttonRect.right - popupWidth + 10; + } + + // Adjust vertical position if too far down (show above button instead) + if (top + popupHeight > viewportHeight) { + top = buttonRect.top - popupHeight - 8; + } + + popup.style.left = Math.max(5, left) + "px"; + popup.style.top = Math.max(5, top) + "px"; + + // Add to page + document.body.appendChild(popup); + + // Fade in + setTimeout(() => { + popup.style.opacity = "1"; + }, 10); + + // Auto-remove after 2 seconds + setTimeout(() => { + popup.style.opacity = "0"; + setTimeout(() => { + if (popup.parentNode) { + popup.remove(); + } + }, 200); + }, 2000); +} + +// Page-specific utilities +export function copyPagePermalink(pageNumber, button, isBeilage = false) { + let pageUrl = ""; + if (isBeilage) { + // For beilage pages, still use hash for now until beilage URLs are updated + pageUrl = window.location.origin + window.location.pathname + `#beilage-1-page-${pageNumber}`; + } else { + // For regular pages, use the new URL format + const pathParts = window.location.pathname.split("/"); + if (pathParts.length >= 3) { + // Current URL format: /year/issue or /year/issue/page + // New format: /year/issue/page + const year = pathParts[1]; + const issue = pathParts[2]; + pageUrl = `${window.location.origin}/${year}/${issue}/${pageNumber}`; + } else { + // Fallback to current URL with page appended + pageUrl = window.location.origin + window.location.pathname + `/${pageNumber}`; + } + } + + const currentUrl = pageUrl; + + // Copy to clipboard + if (navigator.clipboard) { + navigator.clipboard + .writeText(currentUrl) + .then(() => { + showSimplePopup(button, "Link kopiert!"); + }) + .catch((err) => { + showSimplePopup(button, "Kopieren fehlgeschlagen"); + }); + } else { + // Fallback for older browsers + const textarea = document.createElement("textarea"); + textarea.value = currentUrl; + document.body.appendChild(textarea); + textarea.select(); + try { + const successful = document.execCommand("copy"); + showSimplePopup(button, successful ? "Link kopiert!" : "Kopieren fehlgeschlagen"); + } catch (err) { + showSimplePopup(button, "Kopieren fehlgeschlagen"); + } finally { + document.body.removeChild(textarea); + } + } +} + +export function generatePageCitation(pageNumber, button) { + // Get current issue information + const issueInfo = document.title || "KGPZ"; + + // Generate page URL in new format + const pathParts = window.location.pathname.split("/"); + let pageUrl; + if (pathParts.length >= 3) { + const year = pathParts[1]; + const issue = pathParts[2]; + pageUrl = `${window.location.origin}/${year}/${issue}/${pageNumber}`; + } else { + pageUrl = `${window.location.origin}${window.location.pathname}/${pageNumber}`; + } + + const currentUrl = pageUrl; + + // Basic citation format for specific page + const currentDate = new Date().toLocaleDateString("de-DE"); + const citation = `Königsberger Gelehrte und Politische Zeitung (KGPZ). ${issueInfo}, Seite ${pageNumber}. Digital verfügbar unter: ${currentUrl} (Zugriff: ${currentDate}).`; + + // Copy to clipboard + if (navigator.clipboard) { + navigator.clipboard + .writeText(citation) + .then(() => { + showSimplePopup(button, "Zitation kopiert!"); + }) + .catch((err) => { + showSimplePopup(button, "Kopieren fehlgeschlagen"); + }); + } else { + // Fallback for older browsers + const textarea = document.createElement("textarea"); + textarea.value = citation; + document.body.appendChild(textarea); + textarea.select(); + try { + const successful = document.execCommand("copy"); + showSimplePopup(button, successful ? "Zitation kopiert!" : "Kopieren fehlgeschlagen"); + } catch (err) { + showSimplePopup(button, "Kopieren fehlgeschlagen"); + } finally { + document.body.removeChild(textarea); + } + } +} + +// Initialize newspaper layout functionality +export function initializeNewspaperLayout() { + // Initialize page tracking + initializePageTracking(); + + // Set up scroll handler + window.addEventListener("scroll", function () { + clearTimeout(window.scrollTimeout); + window.scrollTimeout = setTimeout(() => { + updateButtonStates(); // Update button states including Beilage toggle + }, 50); + }); + + // Set up keyboard shortcuts + document.addEventListener("keydown", function (e) { + if (e.key === "Escape") { + closeModal(); + } + }); +} \ No newline at end of file diff --git a/views/transform/main.js b/views/transform/main.js index e8f915e..445e568 100644 --- a/views/transform/main.js +++ b/views/transform/main.js @@ -1,1363 +1,95 @@ import "./site.css"; +import "./akteure.js"; +import { SinglePageViewer } from "./single-page-viewer.js"; +import { ScrollToTopButton } from "./scroll-to-top.js"; +import { + enlargePage, + closeModal, + scrollToPreviousPage, + scrollToNextPage, + scrollToBeilage, + shareCurrentPage, + generateCitation, + copyPagePermalink, + generatePageCitation, + initializeNewspaperLayout, +} from "./issue.js"; -const ATTR_XSLT_ONLOAD = "script[xslt-onload]"; -const ATTR_XSLT_TEMPLATE = "xslt-template"; -const ATTR_XSLT_STATE = "xslt-transformed"; +// Update citation links to highlight current page references +function updateCitationLinks() { + const currentPath = window.location.pathname; + const citationLinks = document.querySelectorAll(".citation-link[data-citation-url]"); -const xslt_processors = new Map(); + citationLinks.forEach((link) => { + const citationUrl = link.getAttribute("data-citation-url"); + let isCurrentPage = false; -function setup_xslt() { - let els = htmx.findAll(ATTR_XSLT_ONLOAD); - for (let element of els) { - transform_xslt(element); - } -} - -function transform_xslt(element) { - if ( - element.getAttribute(ATTR_XSLT_STATE) === "true" || - !element.hasAttribute(ATTR_XSLT_TEMPLATE) - ) { - return; - } - - let templateId = "#" + element.getAttribute(ATTR_XSLT_TEMPLATE); - let processor = xslt_processors.get(templateId); - if (!processor) { - let template = htmx.find(templateId); - if (template) { - let content = template.innerHTML - ? new DOMParser().parseFromString(template.innerHTML, "application/xml") - : template.contentDocument; - processor = new XSLTProcessor(); - processor.importStylesheet(content); - xslt_processors.set(templateId, processor); + // Check for exact match + if (citationUrl === currentPath) { + isCurrentPage = true; } else { - throw new Error("Unknown XSLT template: " + templateId); + // Check if current path is an issue with page number that matches this citation + const currentPathMatch = currentPath.match(/^\/(\d{4})\/(\d+)(?:\/(\d+))?$/); + const citationUrlMatch = citationUrl.match(/^\/(\d{4})\/(\d+)$/); + + if (currentPathMatch && citationUrlMatch) { + const [, currentYear, currentIssue, currentPage] = currentPathMatch; + const [, citationYear, citationIssue] = citationUrlMatch; + + // If year and issue match, this citation refers to the current issue + if (currentYear === citationYear && currentIssue === citationIssue) { + isCurrentPage = true; + } + } } - } - let data = new DOMParser().parseFromString(element.innerHTML, "application/xml"); - let frag = processor.transformToFragment(data, document); - let s = new XMLSerializer().serializeToString(frag); - element.outerHTML = s; -} - -function setup_templates() { - let templates = document.querySelectorAll("template[simple]"); - templates.forEach((template) => { - let templateId = template.getAttribute("id"); - let templateContent = template.content; - - customElements.define( - templateId, - class extends HTMLElement { - constructor() { - super(); - this.appendChild(templateContent.cloneNode(true)); - this.slots = this.querySelectorAll("slot"); - } - - connectedCallback() { - let toremove = []; - this.slots.forEach((tslot) => { - let slotName = tslot.getAttribute("name"); - let slotContent = this.querySelector(`[slot="${slotName}"]`); - if (slotContent) { - tslot.replaceWith(slotContent.cloneNode(true)); - toremove.push(slotContent); - } - }); - toremove.forEach((element) => { - element.remove(); - }); - } - }, - ); + if (isCurrentPage) { + // Style as current page: red text, no underline, not clickable + link.classList.add("text-red-700", "pointer-events-none"); + link.setAttribute("aria-current", "page"); + } else { + // Reset to default styling for non-current pages + link.classList.remove("text-red-700", "pointer-events-none"); + link.removeAttribute("aria-current"); + } }); } -// =========================== -// NEWSPAPER LAYOUT FUNCTIONS -// =========================== +// Apply page-specific backdrop styling based on URL +function applyPageBackdrop() { + const path = window.location.pathname; + const body = document.body; -// Global variables for state management -window.highlightObserver = window.highlightObserver || null; -window.currentPageContainers = window.currentPageContainers || []; -window.currentActiveIndex = window.currentActiveIndex || 0; -window.pageObserver = window.pageObserver || null; -window.scrollTimeout = window.scrollTimeout || null; - -// Page highlighting functionality -function initializePageHighlighting() { - // Clean up existing observer - if (window.highlightObserver) { - window.highlightObserver.disconnect(); - window.highlightObserver = null; - } - - // Get all page containers - const pageContainers = document.querySelectorAll(".newspaper-page-container"); - - // Set up intersection observer for active page tracking - window.highlightObserver = new IntersectionObserver( - (entries) => { - checkAndHighlightVisiblePages(); - }, - { - rootMargin: "-20% 0px -70% 0px", - }, + // Remove any existing page-specific classes + body.classList.remove( + "page-akteure", + "page-ausgabe", + "page-search", + "page-ort", + "page-kategorie", + "page-piece", + "page-edition", ); - // Observe all page containers - pageContainers.forEach((container) => { - window.highlightObserver.observe(container); - }); -} - -function checkAndHighlightVisiblePages() { - const visiblePageNumbers = []; - const allPageContainers = document.querySelectorAll(".newspaper-page-container"); - - // Find visible page numbers - allPageContainers.forEach((container) => { - const containerRect = container.getBoundingClientRect(); - const viewportHeight = window.innerHeight; - - const visibleTop = Math.max(containerRect.top, 0); - const visibleBottom = Math.min(containerRect.bottom, viewportHeight); - const visibleHeight = Math.max(0, visibleBottom - visibleTop); - const containerHeight = containerRect.height; - - const visibilityRatio = visibleHeight / containerHeight; - const isVisible = visibilityRatio >= 0.5; - - const pageImg = container.querySelector("img[data-page]"); - const pageNumber = pageImg ? pageImg.getAttribute("data-page") : "unknown"; - - if (isVisible && pageImg && pageNumber && !visiblePageNumbers.includes(pageNumber)) { - visiblePageNumbers.push(pageNumber); - } - }); - - // Show continuations only for visible pages - showContinuationsForVisiblePages(visiblePageNumbers); - - // Highlight visible pages - if (visiblePageNumbers.length > 0) { - markCurrentPagesInInhaltsverzeichnis(visiblePageNumbers); + // Determine page type from URL path and apply appropriate class + if (path.includes("/akteure/") || path.includes("/autoren")) { + body.classList.add("page-akteure"); + } else if (path.match(/\/\d{4}\/\d+/)) { + // Issue URLs like /1771/42 or /1771/42/166 + body.classList.add("page-ausgabe"); + } else if (path.includes("/search") || path.includes("/suche")) { + body.classList.add("page-search"); + } else if (path.includes("/ort/")) { + body.classList.add("page-ort"); + } else if (path.includes("/kategorie/")) { + body.classList.add("page-kategorie"); + } else if (path.includes("/beitrag/")) { + body.classList.add("page-piece"); + } else if (path.includes("/edition")) { + body.classList.add("page-edition"); } } -function showContinuationsForVisiblePages(visiblePageNumbers) { - // Hide all continuation entries by default - document.querySelectorAll(".continuation-entry").forEach((entry) => { - entry.style.display = "none"; - }); - - // Show continuation entries only for visible pages - visiblePageNumbers.forEach((pageNumber) => { - const pageEntry = document.querySelector(`[data-page-container="${pageNumber}"]`); - if (pageEntry) { - const continuationEntries = pageEntry.querySelectorAll(".continuation-entry"); - continuationEntries.forEach((entry) => { - entry.style.display = ""; - }); - } - }); - - // Update work titles based on highlighted state - updateWorkTitles(visiblePageNumbers); - - // Update page entry visibility after showing/hiding continuations - updatePageEntryVisibility(); -} - -function updateWorkTitles(visiblePageNumbers) { - // Reset all work titles to short form - document.querySelectorAll(".work-title").forEach((titleElement) => { - const shortTitle = titleElement.getAttribute("data-short-title"); - if (shortTitle) { - titleElement.textContent = shortTitle; - } - }); - - // Update work titles to full form for highlighted pages - visiblePageNumbers.forEach((pageNumber) => { - const pageEntry = document.querySelector(`[data-page-container="${pageNumber}"]`); - if (pageEntry) { - const workTitles = pageEntry.querySelectorAll(".work-title"); - workTitles.forEach((titleElement) => { - const fullTitle = titleElement.getAttribute("data-full-title"); - if (fullTitle && fullTitle !== titleElement.getAttribute("data-short-title")) { - titleElement.textContent = fullTitle; - } - }); - } - }); -} - -function updatePageEntryVisibility() { - // Check each page entry to see if it has any visible content - document.querySelectorAll(".page-entry").forEach((pageEntry) => { - const allEntries = pageEntry.querySelectorAll(".inhalts-entry"); - let hasVisibleContent = false; - - // Check if any entry is visible - allEntries.forEach((entry) => { - const computedStyle = window.getComputedStyle(entry); - if (computedStyle.display !== "none") { - hasVisibleContent = true; - } - }); - - // Hide the entire page entry if it has no visible content - if (hasVisibleContent) { - pageEntry.style.display = ""; - } else { - pageEntry.style.display = "none"; - } - }); -} - -function markCurrentPageInInhaltsverzeichnis(pageNumber) { - markCurrentPagesInInhaltsverzeichnis([pageNumber]); -} - -function markCurrentPagesInInhaltsverzeichnis(pageNumbers) { - console.log("markCurrentPagesInInhaltsverzeichnis called with:", pageNumbers); - - // Reset all page container borders to default - document.querySelectorAll("[data-page-container]").forEach((container) => { - if (container.hasAttribute("data-beilage")) { - container.classList.remove("border-red-500"); - container.classList.add("border-amber-400"); - } else { - container.classList.remove("border-red-500"); - container.classList.add("border-slate-300"); - } - }); - - // Reset all page numbers in Inhaltsverzeichnis - document.querySelectorAll(".page-number-inhalts").forEach((pageNum) => { - pageNum.classList.remove("text-red-600", "font-bold"); - pageNum.classList.add("text-slate-700", "font-semibold"); - pageNum.style.textDecoration = ""; - pageNum.style.pointerEvents = ""; - // Restore hover effects - if (pageNum.classList.contains("bg-blue-50")) { - pageNum.classList.add("hover:bg-blue-100"); - } else if (pageNum.classList.contains("bg-amber-50")) { - pageNum.classList.add("hover:bg-amber-100"); - } - // Keep original background colors - if (!pageNum.classList.contains("bg-amber-50") && !pageNum.classList.contains("bg-blue-50")) { - pageNum.classList.add("bg-blue-50"); - } - }); - - // Reset all containers and links in Inhaltsverzeichnis - document.querySelectorAll(".inhalts-entry").forEach((container) => { - container.classList.add("hover:bg-slate-100"); - container.style.cursor = ""; - }); - - document.querySelectorAll('.inhalts-entry a[href*="/"]').forEach((link) => { - link.classList.remove("no-underline"); - if (link.classList.contains("bg-blue-50")) { - link.classList.add("hover:bg-blue-100"); - } - }); - - // Find and highlight the current page numbers - const highlightedElements = []; - - pageNumbers.forEach((pageNumber) => { - // Find the exact page entry for this page number - const pageNumElement = document.querySelector( - `.page-number-inhalts[data-page-number="${pageNumber}"]`, - ); - - if (pageNumElement) { - // Highlight the page number - pageNumElement.classList.remove("text-slate-700", "hover:bg-blue-100", "hover:bg-amber-100"); - pageNumElement.classList.add("text-red-600", "font-bold"); - pageNumElement.style.textDecoration = "none"; - pageNumElement.style.pointerEvents = "none"; - highlightedElements.push(pageNumElement); - - // Highlight the page container's left border - const pageContainer = document.querySelector(`[data-page-container="${pageNumber}"]`); - if (pageContainer) { - pageContainer.classList.remove("border-slate-300", "border-amber-400"); - pageContainer.classList.add("border-red-500"); - } - - // Make links in the current page non-clickable and remove hover effects - const parentEntry = pageNumElement.closest(".page-entry"); - if (parentEntry) { - // Remove hover effects from the container - const entryContainers = parentEntry.querySelectorAll(".inhalts-entry"); - entryContainers.forEach((container) => { - container.classList.remove("hover:bg-slate-100"); - container.style.cursor = "default"; - }); - - // Also handle issue reference links - parentEntry.querySelectorAll('a[href*="/"]').forEach((link) => { - if (link.getAttribute("aria-current") === "page") { - link.style.textDecoration = "none"; - link.style.pointerEvents = "none"; - link.classList.add("no-underline"); - link.classList.remove("hover:bg-blue-100"); - } - }); - } - } - }); - - // Auto-scroll to first highlighted element if it exists - if (highlightedElements.length > 0) { - scrollToHighlightedPage(highlightedElements[0]); - } - - // Also highlight page indicators - document.querySelectorAll(".page-indicator").forEach((indicator) => { - indicator.classList.remove("text-red-600", "font-bold"); - indicator.classList.add("text-slate-600", "font-semibold"); - // Keep original backgrounds - if (!indicator.classList.contains("bg-amber-50")) { - indicator.classList.add("bg-blue-50"); - } - }); - - // Highlight page indicators for all current pages - pageNumbers.forEach((pageNumber) => { - const pageIndicator = document.querySelector(`.page-indicator[data-page="${pageNumber}"]`); - if (pageIndicator) { - pageIndicator.classList.remove("text-slate-600"); - pageIndicator.classList.add("text-red-600", "font-bold"); - } - }); -} - -function scrollToHighlightedPage(element) { - // Check if the element is in a scrollable container - const inhaltsContainer = element.closest(".lg\\:overflow-y-auto"); - if (inhaltsContainer) { - // Calculate position - const containerRect = inhaltsContainer.getBoundingClientRect(); - const elementRect = element.getBoundingClientRect(); - - // Check if element is not fully visible - const isAboveContainer = elementRect.top < containerRect.top; - const isBelowContainer = elementRect.bottom > containerRect.bottom; - - if (isAboveContainer || isBelowContainer) { - // Scroll to make element visible with some padding - element.scrollIntoView({ - behavior: "smooth", - block: "center", - }); - } - } -} - -// Modal functions -function enlargePage(imgElement, pageNumber, isFromSpread, partNumber = null) { - // Get or create the single page viewer component - let viewer = document.querySelector("single-page-viewer"); - if (!viewer) { - viewer = document.createElement("single-page-viewer"); - document.body.appendChild(viewer); - } - - // Determine if this is a beilage page - const isBeilage = imgElement.closest('[data-beilage="true"]') !== null; - - // Get target page from template data if available - const targetPage = - window.templateData && window.templateData.targetPage ? window.templateData.targetPage : 0; - - // Show the page in the viewer - viewer.show(imgElement.src, imgElement.alt, pageNumber, isBeilage, targetPage, partNumber); -} - -function closeModal() { - const modal = document.getElementById("pageModal"); - modal.classList.add("hidden"); -} - -// Page navigation functions -function initializePageTracking() { - // Clean up existing observer - if (window.pageObserver) { - window.pageObserver.disconnect(); - window.pageObserver = null; - } - - // Reset state - window.currentPageContainers = Array.from(document.querySelectorAll(".newspaper-page-container")); - window.currentActiveIndex = 0; - updateButtonStates(); - - // Set up new observer - const existingObserver = document.querySelector(".newspaper-page-container"); - if (existingObserver) { - let visibleContainers = new Set(); - - window.pageObserver = new IntersectionObserver( - (entries) => { - entries.forEach((entry) => { - const containerIndex = window.currentPageContainers.indexOf(entry.target); - if (containerIndex !== -1) { - if (entry.isIntersecting) { - visibleContainers.add(containerIndex); - } else { - visibleContainers.delete(containerIndex); - } - } - }); - - // Update currentActiveIndex to the first (topmost) visible container - if (visibleContainers.size > 0) { - const sortedVisible = Array.from(visibleContainers).sort((a, b) => a - b); - const newActiveIndex = sortedVisible[0]; - if (newActiveIndex !== window.currentActiveIndex) { - window.currentActiveIndex = newActiveIndex; - updateButtonStates(); - } - } - }, - { - rootMargin: "-20% 0px -70% 0px", - }, - ); - - window.currentPageContainers.forEach((container) => { - window.pageObserver.observe(container); - }); - } -} - -function scrollToPreviousPage() { - if (window.currentActiveIndex > 0) { - // Find the first page that's not currently visible - let targetIndex = -1; - - // Check which pages are currently visible - const visibleIndexes = []; - window.currentPageContainers.forEach((container, index) => { - const containerRect = container.getBoundingClientRect(); - const viewportHeight = window.innerHeight; - - const visibleTop = Math.max(containerRect.top, 0); - const visibleBottom = Math.min(containerRect.bottom, viewportHeight); - const visibleHeight = Math.max(0, visibleBottom - visibleTop); - const containerHeight = containerRect.height; - - const visibilityRatio = visibleHeight / containerHeight; - if (visibilityRatio >= 0.3) { - // Consider visible if 30% or more is showing - visibleIndexes.push(index); - } - }); - - // Find the first non-visible page before the current visible range - const minVisibleIndex = Math.min(...visibleIndexes); - for (let i = minVisibleIndex - 1; i >= 0; i--) { - if (!visibleIndexes.includes(i)) { - targetIndex = i; - break; - } - } - - // If no non-visible page found, go to the page just before the visible range - if (targetIndex === -1 && minVisibleIndex > 0) { - targetIndex = minVisibleIndex - 1; - } - - if (targetIndex >= 0) { - window.currentActiveIndex = targetIndex; - window.currentPageContainers[window.currentActiveIndex].scrollIntoView({ - behavior: "smooth", - block: "start", - }); - - // Update button states after a brief delay to let intersection observer catch up - setTimeout(() => { - updateButtonStates(); - }, 100); - } - } -} - -function scrollToNextPage() { - if (window.currentActiveIndex < window.currentPageContainers.length - 1) { - // Find the first page that's not currently visible - let targetIndex = -1; - - // Check which pages are currently visible - const visibleIndexes = []; - window.currentPageContainers.forEach((container, index) => { - const containerRect = container.getBoundingClientRect(); - const viewportHeight = window.innerHeight; - - const visibleTop = Math.max(containerRect.top, 0); - const visibleBottom = Math.min(containerRect.bottom, viewportHeight); - const visibleHeight = Math.max(0, visibleBottom - visibleTop); - const containerHeight = containerRect.height; - - const visibilityRatio = visibleHeight / containerHeight; - if (visibilityRatio >= 0.3) { - // Consider visible if 30% or more is showing - visibleIndexes.push(index); - } - }); - - // Find the first non-visible page after the current visible range - const maxVisibleIndex = Math.max(...visibleIndexes); - for (let i = maxVisibleIndex + 1; i < window.currentPageContainers.length; i++) { - if (!visibleIndexes.includes(i)) { - targetIndex = i; - break; - } - } - - // If no non-visible page found, go to the page just after the visible range - if (targetIndex === -1 && maxVisibleIndex < window.currentPageContainers.length - 1) { - targetIndex = maxVisibleIndex + 1; - } - - if (targetIndex >= 0 && targetIndex < window.currentPageContainers.length) { - window.currentActiveIndex = targetIndex; - window.currentPageContainers[window.currentActiveIndex].scrollIntoView({ - behavior: "smooth", - block: "start", - }); - - // Update button states after a brief delay to let intersection observer catch up - setTimeout(() => { - updateButtonStates(); - }, 100); - } - } -} - -function scrollToBeilage() { - // Check if we're currently viewing a Beilage section - const isViewingBeilage = isCurrentlyInBeilageSection(); - - if (isViewingBeilage) { - // Go back to main issue (first main page) - const firstMainPage = document.querySelector("#newspaper-content .newspaper-page-container"); - if (firstMainPage) { - firstMainPage.scrollIntoView({ - behavior: "smooth", - block: "start", - }); - } - } else { - // Go to first beilage container - const beilageContainer = document.querySelector('[class*="border-t-2 border-amber-200"]'); - if (beilageContainer) { - beilageContainer.scrollIntoView({ - behavior: "smooth", - block: "start", - }); - } - } -} - -function isCurrentlyInBeilageSection() { - // Check which pages are currently visible - const visibleIndexes = []; - window.currentPageContainers.forEach((container, index) => { - const containerRect = container.getBoundingClientRect(); - const viewportHeight = window.innerHeight; - - const visibleTop = Math.max(containerRect.top, 0); - const visibleBottom = Math.min(containerRect.bottom, viewportHeight); - const visibleHeight = Math.max(0, visibleBottom - visibleTop); - const containerHeight = containerRect.height; - - const visibilityRatio = visibleHeight / containerHeight; - if (visibilityRatio >= 0.3) { - // Consider visible if 30% or more is showing - visibleIndexes.push(index); - } - }); - - // Check if any visible page is a Beilage page - for (const index of visibleIndexes) { - const container = window.currentPageContainers[index]; - if (container && container.id && container.id.includes("beilage-")) { - return true; - } - } - - return false; -} - -function updateButtonStates() { - const prevBtn = document.getElementById("prevPageBtn"); - const nextBtn = document.getElementById("nextPageBtn"); - const beilageBtn = document.getElementById("beilageBtn"); - - if (prevBtn) { - if (window.currentActiveIndex <= 0) { - prevBtn.style.display = "none"; - } else { - prevBtn.style.display = "flex"; - } - } - - if (nextBtn) { - if (window.currentActiveIndex >= window.currentPageContainers.length - 1) { - nextBtn.style.display = "none"; - } else { - nextBtn.style.display = "flex"; - } - } - - // Update Beilage button based on current location - if (beilageBtn) { - const isViewingBeilage = isCurrentlyInBeilageSection(); - const icon = beilageBtn.querySelector("i"); - - if (isViewingBeilage) { - // Show "Go to Main Issue" state - use gray styling - beilageBtn.title = "Zur Hauptausgabe"; - beilageBtn.className = - "w-14 h-10 lg:w-16 lg:h-12 px-2 py-1 bg-gray-100 hover:bg-gray-200 text-gray-700 hover:text-gray-800 border border-gray-300 transition-colors duration-200 flex items-center justify-center cursor-pointer"; - if (icon) { - icon.className = "ri-file-text-line text-lg lg:text-xl"; - } - } else { - // Show "Go to Beilage" state - use amber styling - beilageBtn.title = "Zu Beilage"; - beilageBtn.className = - "w-14 h-10 lg:w-16 lg:h-12 px-2 py-1 bg-amber-100 hover:bg-amber-200 text-amber-700 hover:text-amber-800 border border-amber-300 transition-colors duration-200 flex items-center justify-center cursor-pointer"; - if (icon) { - icon.className = "ri-attachment-line text-lg lg:text-xl"; - } - } - } -} - -// Share and citation functions -function shareCurrentPage() { - const button = document.getElementById("shareLinkBtn"); - - // Get current page information - let pageInfo = ""; - - // Try to get the currently visible page number from active containers - if ( - window.currentActiveIndex !== undefined && - window.currentPageContainers && - window.currentPageContainers[window.currentActiveIndex] - ) { - const activeContainer = window.currentPageContainers[window.currentActiveIndex]; - const pageElement = activeContainer.querySelector("[data-page]"); - if (pageElement) { - const pageNumber = pageElement.getAttribute("data-page"); - pageInfo = `/${pageNumber}`; - } - } - - // Construct the shareable URL - const currentUrl = window.location.origin + window.location.pathname + pageInfo; - - // Try to use Web Share API if available (mobile browsers) - if (navigator.share) { - navigator - .share({ - title: document.title, - url: currentUrl, - }) - .catch((err) => { - // Fallback to clipboard - copyToClipboard(currentUrl, button); - }); - } else { - // Fallback: copy to clipboard - copyToClipboard(currentUrl, button); - } -} - -function copyToClipboard(text, button) { - if (navigator.clipboard) { - navigator.clipboard - .writeText(text) - .then(() => { - showSimplePopup(button, "Link kopiert!"); - }) - .catch((err) => { - showSimplePopup(button, "Kopieren fehlgeschlagen"); - }); - } else { - // Fallback for older browsers - const textarea = document.createElement("textarea"); - textarea.value = text; - document.body.appendChild(textarea); - textarea.select(); - try { - const successful = document.execCommand("copy"); - showSimplePopup(button, successful ? "Link kopiert!" : "Kopieren fehlgeschlagen"); - } catch (err) { - showSimplePopup(button, "Kopieren fehlgeschlagen"); - } finally { - document.body.removeChild(textarea); - } - } -} - -function generateCitation() { - const button = document.getElementById("citationBtn"); - - // Get current page and issue information - const issueInfo = document.title || "KGPZ"; - - // Use clean URL without hash fragments - let cleanUrl = window.location.origin + window.location.pathname; - - // Remove any hash fragments that might still exist - if (cleanUrl.includes("#")) { - cleanUrl = cleanUrl.split("#")[0]; - } - - // Basic citation format (can be expanded later) - const currentDate = new Date().toLocaleDateString("de-DE"); - const citation = `Königsberger Gelehrte und Politische Zeitung (KGPZ). ${issueInfo}. Digital verfügbar unter: ${cleanUrl} (Zugriff: ${currentDate}).`; - - // Copy to clipboard - if (navigator.clipboard) { - navigator.clipboard - .writeText(citation) - .then(() => { - showSimplePopup(button, "Zitation kopiert!"); - }) - .catch((err) => { - showSimplePopup(button, "Kopieren fehlgeschlagen"); - }); - } else { - // Fallback for older browsers - const textarea = document.createElement("textarea"); - textarea.value = citation; - document.body.appendChild(textarea); - textarea.select(); - try { - const successful = document.execCommand("copy"); - showSimplePopup(button, successful ? "Zitation kopiert!" : "Kopieren fehlgeschlagen"); - } catch (err) { - showSimplePopup(button, "Kopieren fehlgeschlagen"); - } finally { - document.body.removeChild(textarea); - } - } -} - -function showSimplePopup(button, message) { - // Remove any existing popup - const existingPopup = document.querySelector(".simple-popup"); - if (existingPopup) { - existingPopup.remove(); - } - - // Create popup element - const popup = document.createElement("div"); - popup.className = "simple-popup"; - popup.textContent = message; - - // Style the popup - popup.style.cssText = ` - position: fixed; - background: #374151; - color: white; - padding: 6px 12px; - border-radius: 6px; - font-size: 13px; - font-weight: 500; - z-index: 1000; - pointer-events: none; - opacity: 0; - transition: opacity 0.2s ease; - white-space: nowrap; - `; - - // Position popup next to button - const buttonRect = button.getBoundingClientRect(); - const viewportHeight = window.innerHeight; - const viewportWidth = window.innerWidth; - - // Calculate position relative to viewport (since we're using fixed positioning) - let left = buttonRect.left - 10; - let top = buttonRect.bottom + 8; - - // Ensure popup doesn't go off-screen - const popupWidth = 120; // Estimated popup width - const popupHeight = 32; // Estimated popup height - - // Adjust horizontal position if too far right - if (left + popupWidth > viewportWidth) { - left = buttonRect.right - popupWidth + 10; - } - - // Adjust vertical position if too far down (show above button instead) - if (top + popupHeight > viewportHeight) { - top = buttonRect.top - popupHeight - 8; - } - - popup.style.left = Math.max(5, left) + "px"; - popup.style.top = Math.max(5, top) + "px"; - - // Add to page - document.body.appendChild(popup); - - // Fade in - setTimeout(() => { - popup.style.opacity = "1"; - }, 10); - - // Auto-remove after 2 seconds - setTimeout(() => { - popup.style.opacity = "0"; - setTimeout(() => { - if (popup.parentNode) { - popup.remove(); - } - }, 200); - }, 2000); -} - -// URL navigation functions -function scrollToPageFromURL() { - // Skip auto-scrolling during HTMX navigation to prevent random jumps - if (window.htmxNavigating) { - return; - } - - let pageNumber = ""; - let targetContainer = null; - - // Check if URL ends with a page number (e.g., /1768/42/166) - const pathParts = window.location.pathname.split("/"); - if (pathParts.length >= 4 && !isNaN(pathParts[pathParts.length - 1])) { - pageNumber = pathParts[pathParts.length - 1]; - - // Try to find exact page container first - targetContainer = document.getElementById(`page-${pageNumber}`); - - // If not found, try to find container that contains this page - if (!targetContainer) { - // Look for double-spread containers that contain this page - const containers = document.querySelectorAll(".newspaper-page-container[data-pages]"); - for (const container of containers) { - const pages = container.getAttribute("data-pages"); - if (pages && pages.split(",").includes(pageNumber)) { - targetContainer = container; - break; - } - } - } - - // If still not found, try beilage containers - if (!targetContainer) { - targetContainer = - document.getElementById(`beilage-1-page-${pageNumber}`) || - document.getElementById(`beilage-2-page-${pageNumber}`) || - document.querySelector(`[id*="beilage"][id*="page-${pageNumber}"]`); - } - } - - if (targetContainer && pageNumber) { - setTimeout(() => { - targetContainer.scrollIntoView({ - behavior: "smooth", - block: "start", - }); - - // Highlight the specific page in the table of contents - markCurrentPageInInhaltsverzeichnis(pageNumber); - }, 300); - } -} - -// Page-specific utilities -function copyPagePermalink(pageNumber, button, isBeilage = false) { - let pageUrl = ""; - if (isBeilage) { - // For beilage pages, still use hash for now until beilage URLs are updated - pageUrl = window.location.origin + window.location.pathname + `#beilage-1-page-${pageNumber}`; - } else { - // For regular pages, use the new URL format - const pathParts = window.location.pathname.split("/"); - if (pathParts.length >= 3) { - // Current URL format: /year/issue or /year/issue/page - // New format: /year/issue/page - const year = pathParts[1]; - const issue = pathParts[2]; - pageUrl = `${window.location.origin}/${year}/${issue}/${pageNumber}`; - } else { - // Fallback to current URL with page appended - pageUrl = window.location.origin + window.location.pathname + `/${pageNumber}`; - } - } - - const currentUrl = pageUrl; - - // Copy to clipboard - if (navigator.clipboard) { - navigator.clipboard - .writeText(currentUrl) - .then(() => { - showSimplePopup(button, "Link kopiert!"); - }) - .catch((err) => { - showSimplePopup(button, "Kopieren fehlgeschlagen"); - }); - } else { - // Fallback for older browsers - const textarea = document.createElement("textarea"); - textarea.value = currentUrl; - document.body.appendChild(textarea); - textarea.select(); - try { - const successful = document.execCommand("copy"); - showSimplePopup(button, successful ? "Link kopiert!" : "Kopieren fehlgeschlagen"); - } catch (err) { - showSimplePopup(button, "Kopieren fehlgeschlagen"); - } finally { - document.body.removeChild(textarea); - } - } -} - -function generatePageCitation(pageNumber, button) { - // Get current issue information - const issueInfo = document.title || "KGPZ"; - - // Generate page URL in new format - const pathParts = window.location.pathname.split("/"); - let pageUrl; - if (pathParts.length >= 3) { - const year = pathParts[1]; - const issue = pathParts[2]; - pageUrl = `${window.location.origin}/${year}/${issue}/${pageNumber}`; - } else { - pageUrl = `${window.location.origin}${window.location.pathname}/${pageNumber}`; - } - - const currentUrl = pageUrl; - - // Basic citation format for specific page - const currentDate = new Date().toLocaleDateString("de-DE"); - const citation = `Königsberger Gelehrte und Politische Zeitung (KGPZ). ${issueInfo}, Seite ${pageNumber}. Digital verfügbar unter: ${currentUrl} (Zugriff: ${currentDate}).`; - - // Copy to clipboard - if (navigator.clipboard) { - navigator.clipboard - .writeText(citation) - .then(() => { - showSimplePopup(button, "Zitation kopiert!"); - }) - .catch((err) => { - showSimplePopup(button, "Kopieren fehlgeschlagen"); - }); - } else { - // Fallback for older browsers - const textarea = document.createElement("textarea"); - textarea.value = citation; - document.body.appendChild(textarea); - textarea.select(); - try { - const successful = document.execCommand("copy"); - showSimplePopup(button, successful ? "Zitation kopiert!" : "Kopieren fehlgeschlagen"); - } catch (err) { - showSimplePopup(button, "Kopieren fehlgeschlagen"); - } finally { - document.body.removeChild(textarea); - } - } -} - -// Initialize scrollspy functionality for author/agent pages -function initializeScrollspy() { - // Clean up any existing scrollspy - cleanupScrollspy(); - - const sections = document.querySelectorAll(".author-section"); - const navLinks = document.querySelectorAll(".scrollspy-link"); - - if (sections.length === 0 || navLinks.length === 0) { - return; - } - - function ensureMarkerVisibility() { - const slider = document.getElementById("scrollspy-slider"); - const nav = document.getElementById("scrollspy-nav"); - - if (!slider || !nav || slider.style.opacity === '0') { - return; - } - - const navRect = nav.getBoundingClientRect(); - const sliderTop = parseFloat(slider.style.top); - const sliderHeight = parseFloat(slider.style.height); - const sliderBottom = sliderTop + sliderHeight; - - // Check if the marker extends beyond the visible area - const navScrollTop = nav.scrollTop; - const navVisibleBottom = navScrollTop + navRect.height; - - if (sliderBottom > navVisibleBottom) { - // Marker extends below visible area - scroll down to show the bottom - const scrollTarget = sliderBottom - navRect.height + 20; // 20px padding - nav.scrollTo({ - top: scrollTarget, - behavior: "smooth" - }); - } else if (sliderTop < navScrollTop) { - // Marker extends above visible area - scroll up to show the top - const scrollTarget = sliderTop - 20; // 20px padding - nav.scrollTo({ - top: Math.max(0, scrollTarget), - behavior: "smooth" - }); - } - } - - function updateActiveLink() { - const visibleSections = []; - const viewportTop = window.scrollY; - const viewportBottom = viewportTop + window.innerHeight; - - // Check which sections have any part of their Werke or Beiträge visible - sections.forEach((section) => { - const sectionId = section.getAttribute("id"); - - // Find Werke and Beiträge sections within this author section - const werkeSection = section.querySelector(".akteur-werke-section"); - const beitraegeSection = section.querySelector(".akteur-beitraege-section"); - - let isVisible = false; - - // Check if any part of Werke section is visible - if (werkeSection) { - const werkeRect = werkeSection.getBoundingClientRect(); - const werkeTopVisible = werkeRect.top < window.innerHeight; - const werkeBottomVisible = werkeRect.bottom > 0; - if (werkeTopVisible && werkeBottomVisible) { - isVisible = true; - } - } - - // Check if any part of Beiträge section is visible - if (beitraegeSection && !isVisible) { - const beitraegeRect = beitraegeSection.getBoundingClientRect(); - const beitraegeTopVisible = beitraegeRect.top < window.innerHeight; - const beitraegeBottomVisible = beitraegeRect.bottom > 0; - if (beitraegeTopVisible && beitraegeBottomVisible) { - isVisible = true; - } - } - - // Fallback: if no Werke/Beiträge sections, check header visibility (for authors without content) - if (!werkeSection && !beitraegeSection) { - const headerElement = section.querySelector("div:first-child"); - if (headerElement) { - const headerRect = headerElement.getBoundingClientRect(); - const headerTopVisible = headerRect.top >= 0; - const headerBottomVisible = headerRect.bottom <= window.innerHeight; - if (headerTopVisible && headerBottomVisible) { - isVisible = true; - } - } - } - - if (isVisible) { - visibleSections.push(sectionId); - } - }); - - // Update highlighting with sliding background animation - const activeLinks = []; - const slider = document.getElementById("scrollspy-slider"); - - // Reset all links to default state (no background, just font weight for active) - navLinks.forEach((link) => { - link.classList.remove("font-medium"); - - const targetId = link.getAttribute("data-target"); - if (visibleSections.includes(targetId)) { - link.classList.add("font-medium"); - activeLinks.push(link); - } - }); - - // Calculate and animate the sliding background - if (activeLinks.length > 0 && slider) { - // Get the nav container for relative positioning - const nav = document.getElementById("scrollspy-nav"); - const navRect = nav.getBoundingClientRect(); - - // Calculate the combined area of all active links - let minTop = Infinity; - let maxBottom = -Infinity; - - activeLinks.forEach((link) => { - const linkRect = link.getBoundingClientRect(); - const relativeTop = linkRect.top - navRect.top + nav.scrollTop; - const relativeBottom = relativeTop + linkRect.height; - - minTop = Math.min(minTop, relativeTop); - maxBottom = Math.max(maxBottom, relativeBottom); - }); - - // Handle gaps between non-consecutive active links - let totalHeight = maxBottom - minTop; - - // Position and size the slider - slider.style.top = `${minTop}px`; - slider.style.height = `${totalHeight}px`; - slider.style.opacity = '1'; - - // Ensure the full marker is visible - setTimeout(() => ensureMarkerVisibility(), 100); - } else if (slider) { - // Hide slider when no active links - slider.style.opacity = '0'; - } - - // Implement proportional scrolling to keep active links visible - if (activeLinks.length > 0) { - updateSidebarScroll(activeLinks); - } - } - - function updateActiveLinkImmediate(targetId) { - // Immediately highlight the clicked link - const navLinks = document.querySelectorAll(".scrollspy-link"); - const slider = document.getElementById("scrollspy-slider"); - - // Reset all links - navLinks.forEach((link) => { - link.classList.remove("font-medium"); - }); - - // Highlight the clicked link - const clickedLink = document.querySelector(`[data-target="${targetId}"]`); - if (clickedLink) { - clickedLink.classList.add("font-medium"); - - // Update slider position for the single clicked link - if (slider) { - const nav = document.getElementById("scrollspy-nav"); - const navRect = nav.getBoundingClientRect(); - const linkRect = clickedLink.getBoundingClientRect(); - - const relativeTop = linkRect.top - navRect.top + nav.scrollTop; - slider.style.top = `${relativeTop}px`; - slider.style.height = `${linkRect.height}px`; - slider.style.opacity = '1'; - } - } - } - - function updateSidebarScroll(activeLinks) { - // Skip automatic scrolling during manual navigation - if (window.scrollspyManualNavigation) return; - - const sidebar = document.getElementById("scrollspy-nav"); - if (!sidebar) return; - - // Get the first active link as reference - const firstActiveLink = activeLinks[0]; - - // Calculate the main content scroll progress - const documentHeight = Math.max( - document.body.scrollHeight, - document.body.offsetHeight, - document.documentElement.clientHeight, - document.documentElement.scrollHeight, - document.documentElement.offsetHeight, - ); - const viewportHeight = window.innerHeight; - const maxScroll = documentHeight - viewportHeight; - const scrollProgress = maxScroll > 0 ? window.scrollY / maxScroll : 0; - - // Calculate sidebar scroll dimensions - const sidebarHeight = sidebar.clientHeight; - const sidebarScrollHeight = sidebar.scrollHeight; - const maxSidebarScroll = sidebarScrollHeight - sidebarHeight; - - if (maxSidebarScroll > 0) { - // Calculate proportional scroll position - const targetSidebarScroll = scrollProgress * maxSidebarScroll; - - // Get the position of the first active link within the sidebar - const linkRect = firstActiveLink.getBoundingClientRect(); - const sidebarRect = sidebar.getBoundingClientRect(); - const linkOffsetInSidebar = linkRect.top - sidebarRect.top + sidebar.scrollTop; - - // Calculate the desired position (center the active link in the sidebar viewport) - const sidebarCenter = sidebarHeight / 2; - const centeredPosition = linkOffsetInSidebar - sidebarCenter; - - // Use a blend of proportional scrolling and centering for smooth behavior - const blendFactor = 0.7; // 70% proportional, 30% centering - const finalScrollPosition = - blendFactor * targetSidebarScroll + (1 - blendFactor) * centeredPosition; - - // Clamp to valid scroll range - const clampedPosition = Math.max(0, Math.min(maxSidebarScroll, finalScrollPosition)); - - // Apply smooth scrolling, but only if the difference is significant - const currentScrollTop = sidebar.scrollTop; - const scrollDifference = Math.abs(clampedPosition - currentScrollTop); - - if (scrollDifference > 10) { - // Only scroll if more than 10px difference - sidebar.scrollTo({ - top: clampedPosition, - behavior: "smooth", - }); - } - } - } - - // Store scroll handler reference for cleanup - window.scrollspyScrollHandler = function () { - clearTimeout(window.scrollspyTimeout); - window.scrollspyTimeout = setTimeout(() => { - updateActiveLink(); - updateSidebarScrollToTopButton(); - }, 50); - }; - - function updateSidebarScrollToTopButton() { - const button = document.getElementById("sidebar-scroll-to-top"); - if (!button) return; - - const scrollTop = window.pageYOffset || document.documentElement.scrollTop; - const viewportHeight = window.innerHeight; - const shouldShow = scrollTop > viewportHeight * 0.5; // Show after scrolling 50% of viewport - - if (shouldShow) { - button.classList.remove("opacity-0"); - button.classList.add("opacity-100"); - } else { - button.classList.remove("opacity-100"); - button.classList.add("opacity-0"); - } - } - - // Add scroll listener - window.addEventListener("scroll", window.scrollspyScrollHandler); - - // Store click handlers for cleanup - window.scrollspyClickHandlers = []; - - // Add smooth scroll on link click - navLinks.forEach((link) => { - const clickHandler = function (e) { - e.preventDefault(); - const targetId = this.getAttribute("data-target"); - const target = document.getElementById(targetId); - if (target) { - // Immediately update the active link highlighting on click - updateActiveLinkImmediate(targetId); - - // Temporarily disable automatic sidebar scrolling during manual navigation - window.scrollspyManualNavigation = true; - - target.scrollIntoView({ - behavior: "smooth", - block: "start", - }); - - // Re-enable automatic scrolling after navigation completes - setTimeout(() => { - window.scrollspyManualNavigation = false; - // Ensure the full marker is visible after scroll settles - ensureMarkerVisibility(); - }, 1000); - } - }; - - window.scrollspyClickHandlers.push({ link, handler: clickHandler }); - link.addEventListener("click", clickHandler); - }); - - // Initial active link update - updateActiveLink(); - - // Initial scroll-to-top button update - updateSidebarScrollToTopButton(); -} - -// Cleanup scrollspy functionality -function cleanupScrollspy() { - // Remove scroll listener - if (window.scrollspyScrollHandler) { - window.removeEventListener("scroll", window.scrollspyScrollHandler); - window.scrollspyScrollHandler = null; - } - - // Clear timeout - if (window.scrollspyTimeout) { - clearTimeout(window.scrollspyTimeout); - window.scrollspyTimeout = null; - } - - // Remove click handlers - if (window.scrollspyClickHandlers) { - window.scrollspyClickHandlers.forEach(({ link, handler }) => { - link.removeEventListener("click", handler); - }); - window.scrollspyClickHandlers = null; - } - - // Reset slider - const slider = document.getElementById("scrollspy-slider"); - if (slider) { - slider.style.opacity = '0'; - slider.style.height = '0'; - } - - // Reset manual navigation flag - window.scrollspyManualNavigation = false; -} - -// Initialize newspaper layout functionality -function initializeNewspaperLayout() { - // Initialize page highlighting - initializePageHighlighting(); - - // Initialize page tracking - initializePageTracking(); - - // Set up scroll handler - window.addEventListener("scroll", function () { - clearTimeout(window.scrollTimeout); - window.scrollTimeout = setTimeout(() => { - checkAndHighlightVisiblePages(); - updateButtonStates(); // Update button states including Beilage toggle - }, 50); - }); - - // Initialize URL-based page navigation - scrollToPageFromURL(); - - // Set up keyboard shortcuts - document.addEventListener("keydown", function (e) { - if (e.key === "Escape") { - closeModal(); - } - }); -} - // Export functions for global access window.enlargePage = enlargePage; window.closeModal = closeModal; @@ -1369,802 +101,41 @@ window.generateCitation = generateCitation; window.copyPagePermalink = copyPagePermalink; window.generatePageCitation = generatePageCitation; -// Apply page-specific backdrop styling based on URL -function applyPageBackdrop() { - const path = window.location.pathname; - const body = document.body; - - // Remove any existing page-specific classes - body.classList.remove('page-akteure', 'page-ausgabe', 'page-search', 'page-ort', 'page-kategorie', 'page-piece', 'page-edition'); - - // Determine page type from URL path and apply appropriate class - if (path.includes('/akteure/') || path.includes('/autoren')) { - body.classList.add('page-akteure'); - } else if (path.match(/\/\d{4}\/\d+/)) { // Issue URLs like /1771/42 or /1771/42/166 - body.classList.add('page-ausgabe'); - } else if (path.includes('/search') || path.includes('/suche')) { - body.classList.add('page-search'); - } else if (path.includes('/ort/')) { - body.classList.add('page-ort'); - } else if (path.includes('/kategorie/')) { - body.classList.add('page-kategorie'); - } else if (path.includes('/beitrag/')) { - body.classList.add('page-piece'); - } else if (path.includes('/edition')) { - body.classList.add('page-edition'); - } -} - // INFO: This is intended to be called once on website load function setup() { - setup_xslt(); - setup_templates(); - // Apply page-specific backdrop styling applyPageBackdrop(); + // Update citation links on initial load + updateCitationLinks(); + // Initialize newspaper layout if present if (document.querySelector(".newspaper-page-container")) { initializeNewspaperLayout(); } - // Initialize scrollspy if author/agent sections are present - if (document.querySelector(".author-section")) { - initializeScrollspy(); - } - - // Set up HTMX event handlers - htmx.on("htmx:load", function (_) { - // INFO: We can instead use afterSettle; and also clear the map with - // xslt_processors.clear(); - setup_xslt(); - }); + // Akteure scrollspy web component will auto-initialize when present in template // HTMX event handling for newspaper layout, scrollspy, and scroll-to-top button - document.body.addEventListener("htmx:afterSwap", function (event) { + let htmxAfterSwapHandler = function (event) { // Apply page-specific backdrop styling after navigation applyPageBackdrop(); + // Update citation links after navigation + updateCitationLinks(); - // Prevent auto-scrolling during HTMX navigation - window.htmxNavigating = true; - - // Scroll to top for normal page navigation (not URL anchors) - const currentUrl = window.location.pathname; - const hasPageAnchor = currentUrl.match(/\/\d+$/); // Ends with page number like /1768/42/166 - const isAkteureNavigation = currentUrl.includes('/akteure/') || currentUrl.includes('/autoren'); - - if (!hasPageAnchor && isAkteureNavigation) { - // Small delay to ensure DOM is ready - setTimeout(() => { - window.scrollTo({ - top: 0, - behavior: "instant" // Use instant instead of smooth to avoid conflicts - }); - }, 50); - } - + // Use shorter delay since afterSettle ensures DOM is ready setTimeout(() => { if (document.querySelector(".newspaper-page-container")) { initializeNewspaperLayout(); } - if (document.querySelector(".author-section")) { - initializeScrollspy(); - } - // Reassess scroll-to-top button visibility after page swap - const scrollToTopButton = document.querySelector("scroll-to-top-button"); - if (scrollToTopButton) { - scrollToTopButton.reassessScrollPosition(); - } + }, 50); + }; - // Re-enable auto-scrolling after a delay - setTimeout(() => { - window.htmxNavigating = false; - }, 500); - }, 100); - }); + let htmxBeforeRequestHandler = function (event) {}; - // Remove duplicate event handlers to prevent multiple initialization - document.body.addEventListener("htmx:beforeRequest", function (event) { - // Set flag to prevent auto-scrolling during navigation - window.htmxNavigating = true; - }); + document.body.addEventListener("htmx:afterSettle", htmxAfterSwapHandler); + document.body.addEventListener("htmx:afterSettle", updateCitationLinks); + document.body.addEventListener("htmx:beforeRequest", htmxBeforeRequestHandler); } -// Single Page Viewer Web Component -class SinglePageViewer extends HTMLElement { - constructor() { - super(); - // No shadow DOM - use regular DOM to allow Tailwind CSS - this.resizeObserver = null; - } - - // Dynamically detect sidebar width in pixels - detectSidebarWidth() { - // Find the actual sidebar element in the current layout - const sidebar = document.querySelector('.lg\\:w-1\\/4, .lg\\:w-1\\/3, [class*="lg:w-1/"]'); - - if (sidebar) { - const sidebarRect = sidebar.getBoundingClientRect(); - const sidebarWidth = sidebarRect.width; - console.log("Detected sidebar width:", sidebarWidth, "px"); - return `${sidebarWidth}px`; - } - - // Fallback: calculate based on viewport width and responsive breakpoints - const viewportWidth = window.innerWidth; - - if (viewportWidth < 1024) { - // Below lg breakpoint - no sidebar space needed - return "0px"; - } else if (viewportWidth < 1280) { - // lg breakpoint: assume 1/4 of viewport (similar to both layouts) - return `${Math.floor(viewportWidth * 0.25)}px`; - } else { - // xl breakpoint: assume 1/5 of viewport (narrower on larger screens) - return `${Math.floor(viewportWidth * 0.2)}px`; - } - } - - connectedCallback() { - // Detect sidebar width dynamically - const sidebarWidth = this.detectSidebarWidth(); - - this.innerHTML = ` -
- - - - -
-
- -
- -
- - - - -
- - -
-
- - -
- - - - - - - -
- - - - - - - - - -
-
- - -
- -
-
-
-
- `; - - // Set up resize observer to handle window resizing - this.setupResizeObserver(); - } - - // Set up resize observer to dynamically update sidebar width - setupResizeObserver() { - // Clean up existing observer - if (this.resizeObserver) { - this.resizeObserver.disconnect(); - } - - // Create new resize observer - this.resizeObserver = new ResizeObserver(() => { - this.updateSidebarWidth(); - }); - - // Observe window resizing by watching the document body - this.resizeObserver.observe(document.body); - } - - // Update sidebar width when window is resized - updateSidebarWidth() { - const sidebarSpacer = this.querySelector("#sidebar-spacer"); - if (sidebarSpacer && !sidebarSpacer.style.width.includes("0px")) { - // Only update if sidebar is not collapsed (not 0px width) - const newWidth = this.detectSidebarWidth(); - sidebarSpacer.style.width = newWidth; - console.log("Updated sidebar width to:", newWidth); - } - } - - show(imgSrc, imgAlt, pageNumber, isBeilage = false, targetPage = 0, partNumber = null) { - const img = this.querySelector("#single-page-image"); - const pageNumberSpan = this.querySelector("#page-number"); - const pageIconSpan = this.querySelector("#page-icon"); - const pageIndicator = this.querySelector("#page-indicator"); - - img.src = imgSrc; - img.alt = imgAlt; - - // Store current page info for button actions - this.currentPageNumber = pageNumber; - this.currentIsBeilage = isBeilage; - this.currentPartNumber = partNumber; - - // Get issue context from document title or URL - const issueContext = this.getIssueContext(pageNumber); - - // Set page number with issue context in the box - pageNumberSpan.innerHTML = issueContext ? `${issueContext}, ${pageNumber}` : `${pageNumber}`; - - // Add red dot if this is the target page - if (targetPage && pageNumber === targetPage) { - pageNumberSpan.style.position = "relative"; - // Remove any existing red dot - const existingDot = pageNumberSpan.querySelector(".target-page-dot"); - if (existingDot) { - existingDot.remove(); - } - // Add new red dot - const redDot = document.createElement("span"); - redDot.className = - "target-page-dot absolute -top-1 -right-1 w-3 h-3 bg-red-500 rounded-full z-10"; - redDot.title = "verlinkte Seite"; - pageNumberSpan.appendChild(redDot); - } - - // Set page icon or part number based on view type - if (partNumber !== null) { - // Piece view: Show part number instead of icon - pageIconSpan.innerHTML = `${partNumber}. Teil`; - } else { - // Issue view: Show icon based on position and type - const iconType = this.determinePageIconType(pageNumber, isBeilage); - pageIconSpan.innerHTML = this.getPageIconHTML(iconType); - } - - // Page indicator styling is now consistent (white background) - - // Update navigation button visibility - this.updateNavigationButtons(); - - this.style.display = "block"; - - // Prevent background scrolling but allow scrolling within the viewer - document.body.style.overflow = "hidden"; - - // Mark current page in Inhaltsverzeichnis - markCurrentPageInInhaltsverzeichnis(pageNumber); - } - - close() { - this.style.display = "none"; - - // Restore background scrolling - document.body.style.overflow = ""; - } - - // Clean up component completely - destroy() { - // Clean up resize observer - if (this.resizeObserver) { - this.resizeObserver.disconnect(); - this.resizeObserver = null; - } - - // Restore background scrolling - document.body.style.overflow = ""; - - // Remove the component from DOM - if (this.parentNode) { - this.parentNode.removeChild(this); - } - } - - // Determine page icon type based on page position and whether it's beilage - determinePageIconType(pageNumber, isBeilage) { - // Get all page containers to determine position - const containerSelector = isBeilage - ? '.newspaper-page-container[data-beilage="true"]' - : ".newspaper-page-container:not([data-beilage])"; - const pageContainers = Array.from(document.querySelectorAll(containerSelector)); - - // Extract page numbers and sort them - const allPages = pageContainers - .map((container) => { - const pageAttr = container.getAttribute("data-page-container"); - return pageAttr ? parseInt(pageAttr) : null; - }) - .filter((p) => p !== null) - .sort((a, b) => a - b); - - if (allPages.length === 0) { - return "first"; - } - - const firstPage = allPages[0]; - const lastPage = allPages[allPages.length - 1]; - - // Same logic as Go determinePageIcon function - if (pageNumber === firstPage) { - return "first"; // Front page - normal icon - } else if (pageNumber === lastPage) { - return "last"; // Back page - mirrored icon - } else { - // For middle pages in newspaper layout - if (pageNumber === firstPage + 1) { - return "even"; // Page 2 - black + mirrored grey - } else if (pageNumber === lastPage - 1) { - return "odd"; // Page 3 - grey + black - } else { - // For newspapers with more than 4 pages, use alternating pattern - if (pageNumber % 2 === 0) { - return "even"; - } else { - return "odd"; - } - } - } - } - - // Generate page icon HTML based on type (same as Go PageIcon function) - getPageIconHTML(iconType) { - const baseClass = "ri-file-text-line text-lg"; - - switch (iconType) { - case "first": - return ``; - case "last": - return ``; - case "even": - return ``; - case "odd": - return ``; - default: - return ``; - } - } - - // Share current page - shareCurrentPage() { - if (typeof copyPagePermalink === "function") { - // Use the actual button element - const shareBtn = this.querySelector("#share-btn"); - copyPagePermalink(this.currentPageNumber, shareBtn, this.currentIsBeilage); - } - } - - // Generate citation for current page - generatePageCitation() { - if (typeof generatePageCitation === "function") { - // Use the actual button element - const citeBtn = this.querySelector("#cite-btn"); - generatePageCitation(this.currentPageNumber, citeBtn); - } - } - - // Update navigation button visibility based on available pages - updateNavigationButtons() { - const prevBtn = this.querySelector("#prev-page-btn"); - const nextBtn = this.querySelector("#next-page-btn"); - - const { prevPage, nextPage } = this.getAdjacentPages(); - - // Enable/disable previous page button - if (prevPage !== null) { - prevBtn.disabled = false; - prevBtn.className = prevBtn.className.replace("opacity-50 cursor-not-allowed", ""); - prevBtn.className = prevBtn.className.replace( - "bg-gray-50 text-gray-400", - "bg-gray-100 text-gray-700", - ); - } else { - prevBtn.disabled = true; - if (!prevBtn.className.includes("opacity-50")) { - prevBtn.className += " opacity-50 cursor-not-allowed"; - } - prevBtn.className = prevBtn.className.replace( - "bg-gray-100 text-gray-700", - "bg-gray-50 text-gray-400", - ); - } - - // Enable/disable next page button - if (nextPage !== null) { - nextBtn.disabled = false; - nextBtn.className = nextBtn.className.replace("opacity-50 cursor-not-allowed", ""); - nextBtn.className = nextBtn.className.replace( - "bg-gray-50 text-gray-400", - "bg-gray-100 text-gray-700", - ); - } else { - nextBtn.disabled = true; - if (!nextBtn.className.includes("opacity-50")) { - nextBtn.className += " opacity-50 cursor-not-allowed"; - } - nextBtn.className = nextBtn.className.replace( - "bg-gray-100 text-gray-700", - "bg-gray-50 text-gray-400", - ); - } - } - - // Get previous and next page numbers - getAdjacentPages() { - // Get all page containers of the same type (main or beilage) - let containerSelector; - if (this.currentIsBeilage) { - containerSelector = '.newspaper-page-container[data-beilage="true"]'; - } else { - containerSelector = ".newspaper-page-container:not([data-beilage])"; - } - - const pageContainers = Array.from(document.querySelectorAll(containerSelector)); - console.log( - "Found containers:", - pageContainers.length, - "for", - this.currentIsBeilage ? "beilage" : "main", - ); - - // Extract page numbers and sort them - const allPages = pageContainers - .map((container) => { - const pageAttr = container.getAttribute("data-page-container"); - const pageNum = pageAttr ? parseInt(pageAttr) : null; - console.log("Container page:", pageAttr, "parsed:", pageNum); - return pageNum; - }) - .filter((p) => p !== null) - .sort((a, b) => a - b); - - console.log("All pages found:", allPages); - console.log("Current page:", this.currentPageNumber); - - const currentIndex = allPages.indexOf(this.currentPageNumber); - console.log("Current index:", currentIndex); - - let prevPage = null; - let nextPage = null; - - if (currentIndex > 0) { - prevPage = allPages[currentIndex - 1]; - } - - if (currentIndex < allPages.length - 1) { - nextPage = allPages[currentIndex + 1]; - } - - console.log("Adjacent pages - prev:", prevPage, "next:", nextPage); - return { prevPage, nextPage }; - } - - // Navigate to previous page - goToPreviousPage() { - const { prevPage } = this.getAdjacentPages(); - if (prevPage !== null) { - this.navigateToPage(prevPage); - } - } - - // Navigate to next page - goToNextPage() { - const { nextPage } = this.getAdjacentPages(); - if (nextPage !== null) { - this.navigateToPage(nextPage); - } - } - - // Navigate to a specific page - navigateToPage(pageNumber) { - // Find the image element for the target page - const containerSelector = this.currentIsBeilage - ? '.newspaper-page-container[data-beilage="true"]' - : ".newspaper-page-container:not([data-beilage])"; - const targetContainer = document.querySelector( - `${containerSelector}[data-page-container="${pageNumber}"]`, - ); - - if (targetContainer) { - const imgElement = targetContainer.querySelector(".newspaper-page-image"); - if (imgElement) { - // Determine part number for piece view - let newPartNumber = null; - if (this.currentPartNumber !== null) { - // We're in piece view, try to find the part number for the new page - newPartNumber = this.getPartNumberForPage(pageNumber); - } - - // Update the current view with the new page - this.show( - imgElement.src, - imgElement.alt, - pageNumber, - this.currentIsBeilage, - 0, - newPartNumber, - ); - } - } - } - - // Get part number for a specific page in piece view - getPartNumberForPage(pageNumber) { - // Try to find the part number from the page container in piece view - const pageContainer = document.querySelector(`[data-page-container="${pageNumber}"]`); - if (pageContainer) { - const partNumberElement = pageContainer.querySelector(".part-number"); - if (partNumberElement) { - // Extract just the number from "X. Teil" format - const match = partNumberElement.textContent.match(/(\d+)\./); - if (match) { - return parseInt(match[1]); - } - } - } - - // Fallback: if we can't find it, return null to show icon instead - return null; - } - - // Toggle sidebar visibility - toggleSidebar() { - const sidebarSpacer = this.querySelector("#sidebar-spacer"); - const toggleBtn = this.querySelector("#sidebar-toggle-btn"); - const toggleIcon = toggleBtn.querySelector("i"); - - // Check if sidebar is currently collapsed by looking at width - const currentWidth = sidebarSpacer.style.width; - const isCollapsed = currentWidth === "0px" || currentWidth === "0"; - - console.log("Current state - isCollapsed:", isCollapsed); - console.log("Current width:", currentWidth); - - if (isCollapsed) { - // Sidebar is collapsed, expand it - const fullWidth = this.detectSidebarWidth(); - sidebarSpacer.style.width = fullWidth; - - // Update button to normal state (sidebar visible) - toggleBtn.className = - "w-10 h-10 bg-slate-100 hover:bg-slate-200 text-slate-700 border border-slate-300 rounded flex items-center justify-center transition-colors duration-200 cursor-pointer"; - toggleIcon.className = "ri-sidebar-fold-line text-lg font-bold"; - toggleBtn.title = "Inhaltsverzeichnis ausblenden"; - console.log("Expanding sidebar to:", fullWidth); - } else { - // Sidebar is expanded, collapse it - sidebarSpacer.style.width = "0px"; - - // Update button to active state (sidebar hidden - orange highlight) - toggleBtn.className = - "w-10 h-10 bg-orange-100 hover:bg-orange-200 text-orange-700 border border-orange-300 rounded flex items-center justify-center transition-colors duration-200 cursor-pointer"; - toggleIcon.className = "ri-sidebar-unfold-line text-lg font-bold"; - toggleBtn.title = "Inhaltsverzeichnis einblenden"; - console.log("Collapsing sidebar"); - } - - console.log("New width:", sidebarSpacer.style.width); - } - - // Extract issue context from document title, URL, or page container - getIssueContext(pageNumber) { - // Determine if we're in a piece view (beitrag) or issue view (ausgabe) - const path = window.location.pathname; - const isPieceView = path.includes("/beitrag/"); - - if (isPieceView) { - // For piece view: Return full format "1765 Nr. 2" - // Try to get context from page container first (for piece view) - const pageContainer = document.querySelector(`[data-page-container="${pageNumber}"]`); - if (pageContainer) { - // Look for existing page indicator with context - const pageIndicator = pageContainer.querySelector(".page-indicator"); - if (pageIndicator) { - const text = pageIndicator.textContent.trim(); - // Extract full date and issue from text like "3.7.1767 Nr. 53, 213" - const fullDateMatch = text.match(/(\d{1,2}\.\d{1,2}\.\d{4}\s+Nr\.\s+\d+)/); - if (fullDateMatch) { - return fullDateMatch[1]; - } - // Fallback: Extract year and issue from text like "1768 Nr. 20, 79" - const yearMatch = text.match(/(\d{4})\s+Nr\.\s+(\d+)/); - if (yearMatch) { - return `${yearMatch[1]} Nr. ${yearMatch[2]}`; - } - } - } - - // Fallback: Try to extract from document title - const title = document.title; - const titleMatch = title.match(/(\d{4}).*Nr\.\s*(\d+)/); - if (titleMatch) { - return `${titleMatch[1]} Nr. ${titleMatch[2]}`; - } - } else { - // For issue view: Return just empty string (page number only) - return ""; - } - - // Final fallback: Try to extract from URL path - const urlMatch = path.match(/\/(\d{4})\/(\d+)/); - if (urlMatch) { - return isPieceView ? `${urlMatch[1]} Nr. ${urlMatch[2]}` : ""; - } - - // Fallback - try to get from any visible page context - const anyPageIndicator = document.querySelector(".page-indicator"); - if (anyPageIndicator) { - const text = anyPageIndicator.textContent.trim(); - const match = text.match(/(\d{4})\s+Nr\.\s+(\d+)/); - if (match) { - return `${match[1]} Nr. ${match[2]}`; - } - } - - // Ultimate fallback - return "KGPZ"; - } -} - -// Register the web component -customElements.define("single-page-viewer", SinglePageViewer); - -// Clean up single page viewer on HTMX navigation -document.body.addEventListener("htmx:beforeRequest", function (event) { - // Find any active single page viewer - const viewer = document.querySelector("single-page-viewer"); - if (viewer && viewer.style.display !== "none") { - console.log("Cleaning up single page viewer before HTMX navigation"); - viewer.destroy(); - } - - // Clean up scrollspy before navigating - cleanupScrollspy(); -}); - -// Also clean up on page unload as fallback -window.addEventListener("beforeunload", function () { - const viewer = document.querySelector("single-page-viewer"); - if (viewer) { - viewer.destroy(); - } -}); - -// Scroll to Top Web Component -class ScrollToTopButton extends HTMLElement { - constructor() { - super(); - this.isVisible = false; - this.scrollHandler = null; - } - - connectedCallback() { - // Create the button without shadow DOM so Tailwind works - this.innerHTML = ` - - `; - - // Set up scroll listener - this.scrollHandler = () => { - this.handleScroll(); - }; - - window.addEventListener('scroll', this.scrollHandler); - - // Initial check - this.handleScroll(); - } - - disconnectedCallback() { - // Clean up event listener - if (this.scrollHandler) { - window.removeEventListener('scroll', this.scrollHandler); - this.scrollHandler = null; - } - } - - // Method to reassess scroll position (called after HTMX swaps) - reassessScrollPosition() { - // Small delay to ensure DOM is settled after HTMX swap - setTimeout(() => { - this.handleScroll(); - }, 100); - } - - handleScroll() { - const button = this.querySelector('#scroll-to-top-btn'); - if (!button) return; - - const scrollTop = window.pageYOffset || document.documentElement.scrollTop; - const viewportHeight = window.innerHeight; - const shouldShow = scrollTop > viewportHeight; - - if (shouldShow && !this.isVisible) { - // Show button - this.isVisible = true; - button.classList.remove('opacity-0', 'pointer-events-none'); - button.classList.add('opacity-100', 'pointer-events-auto'); - } else if (!shouldShow && this.isVisible) { - // Hide button - this.isVisible = false; - button.classList.remove('opacity-100', 'pointer-events-auto'); - button.classList.add('opacity-0', 'pointer-events-none'); - } - } - - scrollToTop() { - window.scrollTo({ - top: 0, - behavior: 'smooth' - }); - } -} - -// Register the scroll to top component -customElements.define('scroll-to-top-button', ScrollToTopButton); - export { setup }; diff --git a/views/transform/scroll-to-top.js b/views/transform/scroll-to-top.js new file mode 100644 index 0000000..bf05d7e --- /dev/null +++ b/views/transform/scroll-to-top.js @@ -0,0 +1,94 @@ +// =========================== +// SCROLL TO TOP COMPONENT +// =========================== + +// Scroll to Top Web Component +export class ScrollToTopButton extends HTMLElement { + constructor() { + super(); + this.isVisible = false; + this.scrollHandler = null; + this.htmxAfterSwapHandler = null; + } + + connectedCallback() { + // Create the button without shadow DOM so Tailwind works + this.innerHTML = ` + + `; + + // Set up scroll listener + this.scrollHandler = () => { + this.handleScroll(); + }; + + // Set up HTMX event listener + this.htmxAfterSwapHandler = () => { + this.reassessScrollPosition(); + }; + + window.addEventListener('scroll', this.scrollHandler); + document.body.addEventListener('htmx:afterSettle', this.htmxAfterSwapHandler); + + // Initial check + this.handleScroll(); + } + + disconnectedCallback() { + // Clean up event listeners + if (this.scrollHandler) { + window.removeEventListener('scroll', this.scrollHandler); + this.scrollHandler = null; + } + + if (this.htmxAfterSwapHandler) { + document.body.removeEventListener('htmx:afterSettle', this.htmxAfterSwapHandler); + this.htmxAfterSwapHandler = null; + } + } + + // Method to reassess scroll position (called after HTMX swaps) + reassessScrollPosition() { + // Small delay to ensure DOM is settled after HTMX swap + setTimeout(() => { + this.handleScroll(); + }, 100); + } + + handleScroll() { + const button = this.querySelector('#scroll-to-top-btn'); + if (!button) return; + + const scrollTop = window.pageYOffset || document.documentElement.scrollTop; + const viewportHeight = window.innerHeight; + const shouldShow = scrollTop > viewportHeight; + + if (shouldShow && !this.isVisible) { + // Show button + this.isVisible = true; + button.classList.remove('opacity-0', 'pointer-events-none'); + button.classList.add('opacity-100', 'pointer-events-auto'); + } else if (!shouldShow && this.isVisible) { + // Hide button + this.isVisible = false; + button.classList.remove('opacity-100', 'pointer-events-auto'); + button.classList.add('opacity-0', 'pointer-events-none'); + } + } + + scrollToTop() { + window.scrollTo({ + top: 0, + behavior: 'smooth' + }); + } +} + +// Register the scroll to top component +customElements.define('scroll-to-top-button', ScrollToTopButton); \ No newline at end of file diff --git a/views/transform/single-page-viewer.js b/views/transform/single-page-viewer.js new file mode 100644 index 0000000..e2045ab --- /dev/null +++ b/views/transform/single-page-viewer.js @@ -0,0 +1,609 @@ +// =========================== +// SINGLE PAGE VIEWER COMPONENT +// =========================== + +// Single Page Viewer Web Component +export class SinglePageViewer extends HTMLElement { + constructor() { + super(); + // No shadow DOM - use regular DOM to allow Tailwind CSS + this.resizeObserver = null; + } + + // Dynamically detect sidebar width in pixels + detectSidebarWidth() { + // Find the actual sidebar element in the current layout + const sidebar = document.querySelector('.lg\\:w-1\\/4, .lg\\:w-1\\/3, [class*="lg:w-1/"]'); + + if (sidebar) { + const sidebarRect = sidebar.getBoundingClientRect(); + const sidebarWidth = sidebarRect.width; + console.log("Detected sidebar width:", sidebarWidth, "px"); + return `${sidebarWidth}px`; + } + + // Fallback: calculate based on viewport width and responsive breakpoints + const viewportWidth = window.innerWidth; + + if (viewportWidth < 1024) { + // Below lg breakpoint - no sidebar space needed + return "0px"; + } else if (viewportWidth < 1280) { + // lg breakpoint: assume 1/4 of viewport (similar to both layouts) + return `${Math.floor(viewportWidth * 0.25)}px`; + } else { + // xl breakpoint: assume 1/5 of viewport (narrower on larger screens) + return `${Math.floor(viewportWidth * 0.2)}px`; + } + } + + connectedCallback() { + // Detect sidebar width dynamically + const sidebarWidth = this.detectSidebarWidth(); + + this.innerHTML = ` +
+ + + + +
+
+ +
+ +
+ + + + +
+ + +
+
+ + +
+ + + + + + + +
+ + + + + + + + + +
+
+ + +
+ +
+
+
+
+ `; + + // Set up resize observer to handle window resizing + this.setupResizeObserver(); + } + + // Set up resize observer to dynamically update sidebar width + setupResizeObserver() { + // Clean up existing observer + if (this.resizeObserver) { + this.resizeObserver.disconnect(); + } + + // Create new resize observer + this.resizeObserver = new ResizeObserver(() => { + this.updateSidebarWidth(); + }); + + // Observe window resizing by watching the document body + this.resizeObserver.observe(document.body); + } + + // Update sidebar width when window is resized + updateSidebarWidth() { + const sidebarSpacer = this.querySelector("#sidebar-spacer"); + if (sidebarSpacer && !sidebarSpacer.style.width.includes("0px")) { + // Only update if sidebar is not collapsed (not 0px width) + const newWidth = this.detectSidebarWidth(); + sidebarSpacer.style.width = newWidth; + console.log("Updated sidebar width to:", newWidth); + } + } + + show(imgSrc, imgAlt, pageNumber, isBeilage = false, targetPage = 0, partNumber = null) { + const img = this.querySelector("#single-page-image"); + const pageNumberSpan = this.querySelector("#page-number"); + const pageIconSpan = this.querySelector("#page-icon"); + const pageIndicator = this.querySelector("#page-indicator"); + + img.src = imgSrc; + img.alt = imgAlt; + + // Store current page info for button actions + this.currentPageNumber = pageNumber; + this.currentIsBeilage = isBeilage; + this.currentPartNumber = partNumber; + + // Get issue context from document title or URL + const issueContext = this.getIssueContext(pageNumber); + + // Set page number with issue context in the box + pageNumberSpan.innerHTML = issueContext ? `${issueContext}, ${pageNumber}` : `${pageNumber}`; + + // Add red dot if this is the target page + if (targetPage && pageNumber === targetPage) { + pageNumberSpan.style.position = "relative"; + // Remove any existing red dot + const existingDot = pageNumberSpan.querySelector(".target-page-dot"); + if (existingDot) { + existingDot.remove(); + } + // Add new red dot + const redDot = document.createElement("span"); + redDot.className = + "target-page-dot absolute -top-1 -right-1 w-3 h-3 bg-red-500 rounded-full z-10"; + redDot.title = "verlinkte Seite"; + pageNumberSpan.appendChild(redDot); + } + + // Set page icon or part number based on view type + if (partNumber !== null) { + // Piece view: Show part number instead of icon + pageIconSpan.innerHTML = `${partNumber}. Teil`; + } else { + // Issue view: Show icon based on position and type + const iconType = this.determinePageIconType(pageNumber, isBeilage); + pageIconSpan.innerHTML = this.getPageIconHTML(iconType); + } + + // Page indicator styling is now consistent (white background) + + // Update navigation button visibility + this.updateNavigationButtons(); + + this.style.display = "block"; + + // Prevent background scrolling but allow scrolling within the viewer + document.body.style.overflow = "hidden"; + } + + close() { + this.style.display = "none"; + + // Restore background scrolling + document.body.style.overflow = ""; + } + + disconnectedCallback() { + // Clean up resize observer + if (this.resizeObserver) { + this.resizeObserver.disconnect(); + this.resizeObserver = null; + } + + // Restore background scrolling + document.body.style.overflow = ""; + } + + // Determine page icon type based on page position and whether it's beilage + determinePageIconType(pageNumber, isBeilage) { + // Get all page containers to determine position + const containerSelector = isBeilage + ? '.newspaper-page-container[data-beilage="true"]' + : ".newspaper-page-container:not([data-beilage])"; + const pageContainers = Array.from(document.querySelectorAll(containerSelector)); + + // Extract page numbers and sort them + const allPages = pageContainers + .map((container) => { + const pageAttr = container.getAttribute("data-page-container"); + return pageAttr ? parseInt(pageAttr) : null; + }) + .filter((p) => p !== null) + .sort((a, b) => a - b); + + if (allPages.length === 0) { + return "first"; + } + + const firstPage = allPages[0]; + const lastPage = allPages[allPages.length - 1]; + + // Same logic as Go determinePageIcon function + if (pageNumber === firstPage) { + return "first"; // Front page - normal icon + } else if (pageNumber === lastPage) { + return "last"; // Back page - mirrored icon + } else { + // For middle pages in newspaper layout + if (pageNumber === firstPage + 1) { + return "even"; // Page 2 - black + mirrored grey + } else if (pageNumber === lastPage - 1) { + return "odd"; // Page 3 - grey + black + } else { + // For newspapers with more than 4 pages, use alternating pattern + if (pageNumber % 2 === 0) { + return "even"; + } else { + return "odd"; + } + } + } + } + + // Generate page icon HTML based on type (same as Go PageIcon function) + getPageIconHTML(iconType) { + const baseClass = "ri-file-text-line text-lg"; + + switch (iconType) { + case "first": + return ``; + case "last": + return ``; + case "even": + return ``; + case "odd": + return ``; + default: + return ``; + } + } + + // Share current page + shareCurrentPage() { + if (typeof copyPagePermalink === "function") { + // Use the actual button element + const shareBtn = this.querySelector("#share-btn"); + copyPagePermalink(this.currentPageNumber, shareBtn, this.currentIsBeilage); + } + } + + // Generate citation for current page + generatePageCitation() { + if (typeof generatePageCitation === "function") { + // Use the actual button element + const citeBtn = this.querySelector("#cite-btn"); + generatePageCitation(this.currentPageNumber, citeBtn); + } + } + + // Update navigation button visibility based on available pages + updateNavigationButtons() { + const prevBtn = this.querySelector("#prev-page-btn"); + const nextBtn = this.querySelector("#next-page-btn"); + + const { prevPage, nextPage } = this.getAdjacentPages(); + + // Enable/disable previous page button + if (prevPage !== null) { + prevBtn.disabled = false; + prevBtn.className = prevBtn.className.replace("opacity-50 cursor-not-allowed", ""); + prevBtn.className = prevBtn.className.replace( + "bg-gray-50 text-gray-400", + "bg-gray-100 text-gray-700", + ); + } else { + prevBtn.disabled = true; + if (!prevBtn.className.includes("opacity-50")) { + prevBtn.className += " opacity-50 cursor-not-allowed"; + } + prevBtn.className = prevBtn.className.replace( + "bg-gray-100 text-gray-700", + "bg-gray-50 text-gray-400", + ); + } + + // Enable/disable next page button + if (nextPage !== null) { + nextBtn.disabled = false; + nextBtn.className = nextBtn.className.replace("opacity-50 cursor-not-allowed", ""); + nextBtn.className = nextBtn.className.replace( + "bg-gray-50 text-gray-400", + "bg-gray-100 text-gray-700", + ); + } else { + nextBtn.disabled = true; + if (!nextBtn.className.includes("opacity-50")) { + nextBtn.className += " opacity-50 cursor-not-allowed"; + } + nextBtn.className = nextBtn.className.replace( + "bg-gray-100 text-gray-700", + "bg-gray-50 text-gray-400", + ); + } + } + + // Get previous and next page numbers + getAdjacentPages() { + // Get all page containers of the same type (main or beilage) + let containerSelector; + if (this.currentIsBeilage) { + containerSelector = '.newspaper-page-container[data-beilage="true"]'; + } else { + containerSelector = ".newspaper-page-container:not([data-beilage])"; + } + + const pageContainers = Array.from(document.querySelectorAll(containerSelector)); + console.log( + "Found containers:", + pageContainers.length, + "for", + this.currentIsBeilage ? "beilage" : "main", + ); + + // Extract page numbers and sort them + const allPages = pageContainers + .map((container) => { + const pageAttr = container.getAttribute("data-page-container"); + const pageNum = pageAttr ? parseInt(pageAttr) : null; + console.log("Container page:", pageAttr, "parsed:", pageNum); + return pageNum; + }) + .filter((p) => p !== null) + .sort((a, b) => a - b); + + console.log("All pages found:", allPages); + console.log("Current page:", this.currentPageNumber); + + const currentIndex = allPages.indexOf(this.currentPageNumber); + console.log("Current index:", currentIndex); + + let prevPage = null; + let nextPage = null; + + if (currentIndex > 0) { + prevPage = allPages[currentIndex - 1]; + } + + if (currentIndex < allPages.length - 1) { + nextPage = allPages[currentIndex + 1]; + } + + console.log("Adjacent pages - prev:", prevPage, "next:", nextPage); + return { prevPage, nextPage }; + } + + // Navigate to previous page + goToPreviousPage() { + const { prevPage } = this.getAdjacentPages(); + if (prevPage !== null) { + this.navigateToPage(prevPage); + } + } + + // Navigate to next page + goToNextPage() { + const { nextPage } = this.getAdjacentPages(); + if (nextPage !== null) { + this.navigateToPage(nextPage); + } + } + + // Navigate to a specific page + navigateToPage(pageNumber) { + // Find the image element for the target page + const containerSelector = this.currentIsBeilage + ? '.newspaper-page-container[data-beilage="true"]' + : ".newspaper-page-container:not([data-beilage])"; + const targetContainer = document.querySelector( + `${containerSelector}[data-page-container="${pageNumber}"]`, + ); + + if (targetContainer) { + const imgElement = targetContainer.querySelector(".newspaper-page-image"); + if (imgElement) { + // Determine part number for piece view + let newPartNumber = null; + if (this.currentPartNumber !== null) { + // We're in piece view, try to find the part number for the new page + newPartNumber = this.getPartNumberForPage(pageNumber); + } + + // Update the current view with the new page + this.show( + imgElement.src, + imgElement.alt, + pageNumber, + this.currentIsBeilage, + 0, + newPartNumber, + ); + } + } + } + + // Get part number for a specific page in piece view + getPartNumberForPage(pageNumber) { + // Try to find the part number from the page container in piece view + const pageContainer = document.querySelector(`[data-page-container="${pageNumber}"]`); + if (pageContainer) { + const partNumberElement = pageContainer.querySelector(".part-number"); + if (partNumberElement) { + // Extract just the number from "X. Teil" format + const match = partNumberElement.textContent.match(/(\d+)\./); + if (match) { + return parseInt(match[1]); + } + } + } + + // Fallback: if we can't find it, return null to show icon instead + return null; + } + + // Toggle sidebar visibility + toggleSidebar() { + const sidebarSpacer = this.querySelector("#sidebar-spacer"); + const toggleBtn = this.querySelector("#sidebar-toggle-btn"); + const toggleIcon = toggleBtn.querySelector("i"); + + // Check if sidebar is currently collapsed by looking at width + const currentWidth = sidebarSpacer.style.width; + const isCollapsed = currentWidth === "0px" || currentWidth === "0"; + + console.log("Current state - isCollapsed:", isCollapsed); + console.log("Current width:", currentWidth); + + if (isCollapsed) { + // Sidebar is collapsed, expand it + const fullWidth = this.detectSidebarWidth(); + sidebarSpacer.style.width = fullWidth; + + // Update button to normal state (sidebar visible) + toggleBtn.className = + "w-10 h-10 bg-slate-100 hover:bg-slate-200 text-slate-700 border border-slate-300 rounded flex items-center justify-center transition-colors duration-200 cursor-pointer"; + toggleIcon.className = "ri-sidebar-fold-line text-lg font-bold"; + toggleBtn.title = "Inhaltsverzeichnis ausblenden"; + console.log("Expanding sidebar to:", fullWidth); + } else { + // Sidebar is expanded, collapse it + sidebarSpacer.style.width = "0px"; + + // Update button to active state (sidebar hidden - orange highlight) + toggleBtn.className = + "w-10 h-10 bg-orange-100 hover:bg-orange-200 text-orange-700 border border-orange-300 rounded flex items-center justify-center transition-colors duration-200 cursor-pointer"; + toggleIcon.className = "ri-sidebar-unfold-line text-lg font-bold"; + toggleBtn.title = "Inhaltsverzeichnis einblenden"; + console.log("Collapsing sidebar"); + } + + console.log("New width:", sidebarSpacer.style.width); + } + + // Extract issue context from document title, URL, or page container + getIssueContext(pageNumber) { + // Determine if we're in a piece view (beitrag) or issue view (ausgabe) + const path = window.location.pathname; + const isPieceView = path.includes("/beitrag/"); + + if (isPieceView) { + // For piece view: Return full format "1765 Nr. 2" + // Try to get context from page container first (for piece view) + const pageContainer = document.querySelector(`[data-page-container="${pageNumber}"]`); + if (pageContainer) { + // Look for existing page indicator with context + const pageIndicator = pageContainer.querySelector(".page-indicator"); + if (pageIndicator) { + const text = pageIndicator.textContent.trim(); + // Extract full date and issue from text like "3.7.1767 Nr. 53, 213" + const fullDateMatch = text.match(/(\d{1,2}\.\d{1,2}\.\d{4}\s+Nr\.\s+\d+)/); + if (fullDateMatch) { + return fullDateMatch[1]; + } + // Fallback: Extract year and issue from text like "1768 Nr. 20, 79" + const yearMatch = text.match(/(\d{4})\s+Nr\.\s+(\d+)/); + if (yearMatch) { + return `${yearMatch[1]} Nr. ${yearMatch[2]}`; + } + } + } + + // Fallback: Try to extract from document title + const title = document.title; + const titleMatch = title.match(/(\d{4}).*Nr\.\s*(\d+)/); + if (titleMatch) { + return `${titleMatch[1]} Nr. ${titleMatch[2]}`; + } + } else { + // For issue view: Return just empty string (page number only) + return ""; + } + + // Final fallback: Try to extract from URL path + const urlMatch = path.match(/\/(\d{4})\/(\d+)/); + if (urlMatch) { + return isPieceView ? `${urlMatch[1]} Nr. ${urlMatch[2]}` : ""; + } + + // Fallback - try to get from any visible page context + const anyPageIndicator = document.querySelector(".page-indicator"); + if (anyPageIndicator) { + const text = anyPageIndicator.textContent.trim(); + const match = text.match(/(\d{4})\s+Nr\.\s+(\d+)/); + if (match) { + return `${match[1]} Nr. ${match[2]}`; + } + } + + // Ultimate fallback + return "KGPZ"; + } +} + +// Register the web component +customElements.define("single-page-viewer", SinglePageViewer); + +// Clean up single page viewer on HTMX navigation +document.body.addEventListener("htmx:beforeRequest", function (event) { + // Find any active single page viewer + const viewer = document.querySelector("single-page-viewer"); + if (viewer && viewer.style.display !== "none") { + console.log("Cleaning up single page viewer before HTMX navigation"); + viewer.destroy(); + } +}); + +// Also clean up on page unload as fallback +window.addEventListener("beforeunload", function () { + const viewer = document.querySelector("single-page-viewer"); + if (viewer) { + viewer.destroy(); + } +}); \ No newline at end of file diff --git a/views/transform/site.css b/views/transform/site.css index 3bea248..179bbe9 100644 --- a/views/transform/site.css +++ b/views/transform/site.css @@ -5,6 +5,9 @@ --font-sans: "Source Sans 3", "Merriweather Sans", ui-sans-serif; --font-serif: "Merriweather", ui-serif; + /* Custom breakpoint for 4K+ screens */ + --breakpoint-3xl: 120.0625rem; /* 1921px */ + /* Custom Black Colors */ --color-abyss: #0b1215; --color-shadow: #0f171f;