mirror of
https://github.com/Theodor-Springmann-Stiftung/kgpz_web.git
synced 2025-10-29 17:15:31 +00:00
BUGFIX RUN: Single page view
This commit is contained in:
@@ -1,13 +1,13 @@
|
|||||||
const L = "script[xslt-onload]", w = "xslt-template", E = "xslt-transformed", y = /* @__PURE__ */ new Map();
|
const L = "script[xslt-onload]", w = "xslt-template", E = "xslt-transformed", y = /* @__PURE__ */ new Map();
|
||||||
function v() {
|
function v() {
|
||||||
let i = htmx.findAll(L);
|
let o = htmx.findAll(L);
|
||||||
for (let t of i)
|
for (let t of o)
|
||||||
k(t);
|
q(t);
|
||||||
}
|
}
|
||||||
function k(i) {
|
function q(o) {
|
||||||
if (i.getAttribute(E) === "true" || !i.hasAttribute(w))
|
if (o.getAttribute(E) === "true" || !o.hasAttribute(w))
|
||||||
return;
|
return;
|
||||||
let t = "#" + i.getAttribute(w), e = y.get(t);
|
let t = "#" + o.getAttribute(w), e = y.get(t);
|
||||||
if (!e) {
|
if (!e) {
|
||||||
let a = htmx.find(t);
|
let a = htmx.find(t);
|
||||||
if (a) {
|
if (a) {
|
||||||
@@ -16,10 +16,10 @@ function k(i) {
|
|||||||
} else
|
} else
|
||||||
throw new Error("Unknown XSLT template: " + t);
|
throw new Error("Unknown XSLT template: " + t);
|
||||||
}
|
}
|
||||||
let n = new DOMParser().parseFromString(i.innerHTML, "application/xml"), o = e.transformToFragment(n, document), r = new XMLSerializer().serializeToString(o);
|
let n = new DOMParser().parseFromString(o.innerHTML, "application/xml"), i = e.transformToFragment(n, document), r = new XMLSerializer().serializeToString(i);
|
||||||
i.outerHTML = r;
|
o.outerHTML = r;
|
||||||
}
|
}
|
||||||
function q() {
|
function k() {
|
||||||
document.querySelectorAll("template[simple]").forEach((t) => {
|
document.querySelectorAll("template[simple]").forEach((t) => {
|
||||||
let e = t.getAttribute("id"), n = t.content;
|
let e = t.getAttribute("id"), n = t.content;
|
||||||
customElements.define(
|
customElements.define(
|
||||||
@@ -29,11 +29,11 @@ function q() {
|
|||||||
super(), this.appendChild(n.cloneNode(!0)), this.slots = this.querySelectorAll("slot");
|
super(), this.appendChild(n.cloneNode(!0)), this.slots = this.querySelectorAll("slot");
|
||||||
}
|
}
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
let o = [];
|
let i = [];
|
||||||
this.slots.forEach((r) => {
|
this.slots.forEach((r) => {
|
||||||
let a = r.getAttribute("name"), s = this.querySelector(`[slot="${a}"]`);
|
let a = r.getAttribute("name"), s = this.querySelector(`[slot="${a}"]`);
|
||||||
s && (r.replaceWith(s.cloneNode(!0)), o.push(s));
|
s && (r.replaceWith(s.cloneNode(!0)), i.push(s));
|
||||||
}), o.forEach((r) => {
|
}), i.forEach((r) => {
|
||||||
r.remove();
|
r.remove();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -48,7 +48,7 @@ window.pageObserver = window.pageObserver || null;
|
|||||||
window.scrollTimeout = window.scrollTimeout || null;
|
window.scrollTimeout = window.scrollTimeout || null;
|
||||||
function B() {
|
function B() {
|
||||||
window.highlightObserver && (window.highlightObserver.disconnect(), window.highlightObserver = null);
|
window.highlightObserver && (window.highlightObserver.disconnect(), window.highlightObserver = null);
|
||||||
const i = document.querySelectorAll(".newspaper-page-container");
|
const o = document.querySelectorAll(".newspaper-page-container");
|
||||||
window.highlightObserver = new IntersectionObserver(
|
window.highlightObserver = new IntersectionObserver(
|
||||||
(t) => {
|
(t) => {
|
||||||
C();
|
C();
|
||||||
@@ -56,53 +56,53 @@ function B() {
|
|||||||
{
|
{
|
||||||
rootMargin: "-20% 0px -70% 0px"
|
rootMargin: "-20% 0px -70% 0px"
|
||||||
}
|
}
|
||||||
), i.forEach((t) => {
|
), o.forEach((t) => {
|
||||||
window.highlightObserver.observe(t);
|
window.highlightObserver.observe(t);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function C() {
|
function C() {
|
||||||
const i = [];
|
const o = [];
|
||||||
document.querySelectorAll(".newspaper-page-container").forEach((e) => {
|
document.querySelectorAll(".newspaper-page-container").forEach((e) => {
|
||||||
const n = e.getBoundingClientRect(), o = window.innerHeight, r = Math.max(n.top, 0), a = Math.min(n.bottom, o), s = Math.max(0, a - r), l = n.height, g = s / l >= 0.5, u = e.querySelector("img[data-page]"), f = u ? u.getAttribute("data-page") : "unknown";
|
const n = e.getBoundingClientRect(), i = window.innerHeight, r = Math.max(n.top, 0), a = Math.min(n.bottom, i), s = Math.max(0, a - r), l = n.height, g = s / l >= 0.5, u = e.querySelector("img[data-page]"), f = u ? u.getAttribute("data-page") : "unknown";
|
||||||
g && u && f && !i.includes(f) && i.push(f);
|
g && u && f && !o.includes(f) && o.push(f);
|
||||||
}), M(i), i.length > 0 && I(i);
|
}), M(o), o.length > 0 && I(o);
|
||||||
}
|
}
|
||||||
function M(i) {
|
function M(o) {
|
||||||
document.querySelectorAll(".continuation-entry").forEach((t) => {
|
document.querySelectorAll(".continuation-entry").forEach((t) => {
|
||||||
t.style.display = "none";
|
t.style.display = "none";
|
||||||
}), i.forEach((t) => {
|
}), o.forEach((t) => {
|
||||||
const e = document.querySelector(`[data-page-container="${t}"]`);
|
const e = document.querySelector(`[data-page-container="${t}"]`);
|
||||||
e && e.querySelectorAll(".continuation-entry").forEach((o) => {
|
e && e.querySelectorAll(".continuation-entry").forEach((i) => {
|
||||||
o.style.display = "";
|
i.style.display = "";
|
||||||
});
|
});
|
||||||
}), H(i), $();
|
}), H(o), N();
|
||||||
}
|
}
|
||||||
function H(i) {
|
function H(o) {
|
||||||
document.querySelectorAll(".work-title").forEach((t) => {
|
document.querySelectorAll(".work-title").forEach((t) => {
|
||||||
const e = t.getAttribute("data-short-title");
|
const e = t.getAttribute("data-short-title");
|
||||||
e && (t.textContent = e);
|
e && (t.textContent = e);
|
||||||
}), i.forEach((t) => {
|
}), o.forEach((t) => {
|
||||||
const e = document.querySelector(`[data-page-container="${t}"]`);
|
const e = document.querySelector(`[data-page-container="${t}"]`);
|
||||||
e && e.querySelectorAll(".work-title").forEach((o) => {
|
e && e.querySelectorAll(".work-title").forEach((i) => {
|
||||||
const r = o.getAttribute("data-full-title");
|
const r = i.getAttribute("data-full-title");
|
||||||
r && r !== o.getAttribute("data-short-title") && (o.textContent = r);
|
r && r !== i.getAttribute("data-short-title") && (i.textContent = r);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function $() {
|
function N() {
|
||||||
document.querySelectorAll(".page-entry").forEach((i) => {
|
document.querySelectorAll(".page-entry").forEach((o) => {
|
||||||
const t = i.querySelectorAll(".inhalts-entry");
|
const t = o.querySelectorAll(".inhalts-entry");
|
||||||
let e = !1;
|
let e = !1;
|
||||||
t.forEach((n) => {
|
t.forEach((n) => {
|
||||||
window.getComputedStyle(n).display !== "none" && (e = !0);
|
window.getComputedStyle(n).display !== "none" && (e = !0);
|
||||||
}), e ? i.style.display = "" : i.style.display = "none";
|
}), e ? o.style.display = "" : o.style.display = "none";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function S(i) {
|
function S(o) {
|
||||||
I([i]);
|
I([o]);
|
||||||
}
|
}
|
||||||
function I(i) {
|
function I(o) {
|
||||||
console.log("markCurrentPagesInInhaltsverzeichnis called with:", i), document.querySelectorAll("[data-page-container]").forEach((e) => {
|
console.log("markCurrentPagesInInhaltsverzeichnis called with:", o), document.querySelectorAll("[data-page-container]").forEach((e) => {
|
||||||
e.hasAttribute("data-beilage") ? (e.classList.remove("border-red-500"), e.classList.add("border-amber-400")) : (e.classList.remove("border-red-500"), e.classList.add("border-slate-300"));
|
e.hasAttribute("data-beilage") ? (e.classList.remove("border-red-500"), e.classList.add("border-amber-400")) : (e.classList.remove("border-red-500"), e.classList.add("border-slate-300"));
|
||||||
}), document.querySelectorAll(".page-number-inhalts").forEach((e) => {
|
}), document.querySelectorAll(".page-number-inhalts").forEach((e) => {
|
||||||
e.classList.remove("text-red-600", "font-bold"), e.classList.add("text-slate-700", "font-semibold"), e.style.textDecoration = "", e.style.pointerEvents = "", e.classList.contains("bg-blue-50") ? e.classList.add("hover:bg-blue-100") : e.classList.contains("bg-amber-50") && e.classList.add("hover:bg-amber-100"), !e.classList.contains("bg-amber-50") && !e.classList.contains("bg-blue-50") && e.classList.add("bg-blue-50");
|
e.classList.remove("text-red-600", "font-bold"), e.classList.add("text-slate-700", "font-semibold"), e.style.textDecoration = "", e.style.pointerEvents = "", e.classList.contains("bg-blue-50") ? e.classList.add("hover:bg-blue-100") : e.classList.contains("bg-amber-50") && e.classList.add("hover:bg-amber-100"), !e.classList.contains("bg-amber-50") && !e.classList.contains("bg-blue-50") && e.classList.add("bg-blue-50");
|
||||||
@@ -112,7 +112,7 @@ function I(i) {
|
|||||||
e.classList.remove("no-underline"), e.classList.contains("bg-blue-50") && e.classList.add("hover:bg-blue-100");
|
e.classList.remove("no-underline"), e.classList.contains("bg-blue-50") && e.classList.add("hover:bg-blue-100");
|
||||||
});
|
});
|
||||||
const t = [];
|
const t = [];
|
||||||
i.forEach((e) => {
|
o.forEach((e) => {
|
||||||
const n = document.querySelector(
|
const n = document.querySelector(
|
||||||
`.page-number-inhalts[data-page-number="${e}"]`
|
`.page-number-inhalts[data-page-number="${e}"]`
|
||||||
);
|
);
|
||||||
@@ -122,8 +122,8 @@ function I(i) {
|
|||||||
"hover:bg-blue-100",
|
"hover:bg-blue-100",
|
||||||
"hover:bg-amber-100"
|
"hover:bg-amber-100"
|
||||||
), n.classList.add("text-red-600", "font-bold"), n.style.textDecoration = "none", n.style.pointerEvents = "none", t.push(n);
|
), n.classList.add("text-red-600", "font-bold"), n.style.textDecoration = "none", n.style.pointerEvents = "none", t.push(n);
|
||||||
const o = document.querySelector(`[data-page-container="${e}"]`);
|
const i = document.querySelector(`[data-page-container="${e}"]`);
|
||||||
o && (o.classList.remove("border-slate-300", "border-amber-400"), o.classList.add("border-red-500"));
|
i && (i.classList.remove("border-slate-300", "border-amber-400"), i.classList.add("border-red-500"));
|
||||||
const r = n.closest(".page-entry");
|
const r = n.closest(".page-entry");
|
||||||
r && (r.querySelectorAll(".inhalts-entry").forEach((s) => {
|
r && (r.querySelectorAll(".inhalts-entry").forEach((s) => {
|
||||||
s.classList.remove("hover:bg-slate-100"), s.style.cursor = "default";
|
s.classList.remove("hover:bg-slate-100"), s.style.cursor = "default";
|
||||||
@@ -131,28 +131,28 @@ function I(i) {
|
|||||||
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"));
|
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"));
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}), t.length > 0 && N(t[0]), document.querySelectorAll(".page-indicator").forEach((e) => {
|
}), t.length > 0 && $(t[0]), document.querySelectorAll(".page-indicator").forEach((e) => {
|
||||||
e.classList.remove("text-red-600", "font-bold"), e.classList.add("text-slate-600", "font-semibold"), e.classList.contains("bg-amber-50") || e.classList.add("bg-blue-50");
|
e.classList.remove("text-red-600", "font-bold"), e.classList.add("text-slate-600", "font-semibold"), e.classList.contains("bg-amber-50") || e.classList.add("bg-blue-50");
|
||||||
}), i.forEach((e) => {
|
}), o.forEach((e) => {
|
||||||
const n = document.querySelector(`.page-indicator[data-page="${e}"]`);
|
const n = document.querySelector(`.page-indicator[data-page="${e}"]`);
|
||||||
n && (n.classList.remove("text-slate-600"), n.classList.add("text-red-600", "font-bold"));
|
n && (n.classList.remove("text-slate-600"), n.classList.add("text-red-600", "font-bold"));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function N(i) {
|
function $(o) {
|
||||||
const t = i.closest(".lg\\:overflow-y-auto");
|
const t = o.closest(".lg\\:overflow-y-auto");
|
||||||
if (t) {
|
if (t) {
|
||||||
const e = t.getBoundingClientRect(), n = i.getBoundingClientRect(), o = n.top < e.top, r = n.bottom > e.bottom;
|
const e = t.getBoundingClientRect(), n = o.getBoundingClientRect(), i = n.top < e.top, r = n.bottom > e.bottom;
|
||||||
(o || r) && i.scrollIntoView({
|
(i || r) && o.scrollIntoView({
|
||||||
behavior: "smooth",
|
behavior: "smooth",
|
||||||
block: "center"
|
block: "center"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function R(i, t, e) {
|
function R(o, t, e) {
|
||||||
let n = document.querySelector("single-page-viewer");
|
let n = document.querySelector("single-page-viewer");
|
||||||
n || (n = document.createElement("single-page-viewer"), document.body.appendChild(n));
|
n || (n = document.createElement("single-page-viewer"), document.body.appendChild(n));
|
||||||
const o = i.closest('[data-beilage="true"]') !== null;
|
const i = o.closest('[data-beilage="true"]') !== null;
|
||||||
n.show(i.src, i.alt, t, o);
|
n.show(o.src, o.alt, t, i);
|
||||||
}
|
}
|
||||||
function T() {
|
function T() {
|
||||||
document.getElementById("pageModal").classList.add("hidden");
|
document.getElementById("pageModal").classList.add("hidden");
|
||||||
@@ -165,11 +165,11 @@ function O() {
|
|||||||
window.pageObserver = new IntersectionObserver(
|
window.pageObserver = new IntersectionObserver(
|
||||||
(e) => {
|
(e) => {
|
||||||
if (e.forEach((n) => {
|
if (e.forEach((n) => {
|
||||||
const o = window.currentPageContainers.indexOf(n.target);
|
const i = window.currentPageContainers.indexOf(n.target);
|
||||||
o !== -1 && (n.isIntersecting ? t.add(o) : t.delete(o));
|
i !== -1 && (n.isIntersecting ? t.add(i) : t.delete(i));
|
||||||
}), t.size > 0) {
|
}), t.size > 0) {
|
||||||
const o = Array.from(t).sort((r, a) => r - a)[0];
|
const i = Array.from(t).sort((r, a) => r - a)[0];
|
||||||
o !== window.currentActiveIndex && (window.currentActiveIndex = o, p());
|
i !== window.currentActiveIndex && (window.currentActiveIndex = i, p());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -180,21 +180,21 @@ function O() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function V() {
|
function K() {
|
||||||
if (window.currentActiveIndex > 0) {
|
if (window.currentActiveIndex > 0) {
|
||||||
let i = -1;
|
let o = -1;
|
||||||
const t = [];
|
const t = [];
|
||||||
window.currentPageContainers.forEach((n, o) => {
|
window.currentPageContainers.forEach((n, i) => {
|
||||||
const r = n.getBoundingClientRect(), a = window.innerHeight, s = Math.max(r.top, 0), l = Math.min(r.bottom, a), c = Math.max(0, l - s), g = r.height;
|
const r = n.getBoundingClientRect(), a = window.innerHeight, s = Math.max(r.top, 0), l = Math.min(r.bottom, a), c = Math.max(0, l - s), g = r.height;
|
||||||
c / g >= 0.3 && t.push(o);
|
c / g >= 0.3 && t.push(i);
|
||||||
});
|
});
|
||||||
const e = Math.min(...t);
|
const e = Math.min(...t);
|
||||||
for (let n = e - 1; n >= 0; n--)
|
for (let n = e - 1; n >= 0; n--)
|
||||||
if (!t.includes(n)) {
|
if (!t.includes(n)) {
|
||||||
i = n;
|
o = n;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
i === -1 && e > 0 && (i = e - 1), i >= 0 && (window.currentActiveIndex = i, window.currentPageContainers[window.currentActiveIndex].scrollIntoView({
|
o === -1 && e > 0 && (o = e - 1), o >= 0 && (window.currentActiveIndex = o, window.currentPageContainers[window.currentActiveIndex].scrollIntoView({
|
||||||
behavior: "smooth",
|
behavior: "smooth",
|
||||||
block: "start"
|
block: "start"
|
||||||
}), setTimeout(() => {
|
}), setTimeout(() => {
|
||||||
@@ -202,21 +202,21 @@ function V() {
|
|||||||
}, 100));
|
}, 100));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function K() {
|
function V() {
|
||||||
if (window.currentActiveIndex < window.currentPageContainers.length - 1) {
|
if (window.currentActiveIndex < window.currentPageContainers.length - 1) {
|
||||||
let i = -1;
|
let o = -1;
|
||||||
const t = [];
|
const t = [];
|
||||||
window.currentPageContainers.forEach((n, o) => {
|
window.currentPageContainers.forEach((n, i) => {
|
||||||
const r = n.getBoundingClientRect(), a = window.innerHeight, s = Math.max(r.top, 0), l = Math.min(r.bottom, a), c = Math.max(0, l - s), g = r.height;
|
const r = n.getBoundingClientRect(), a = window.innerHeight, s = Math.max(r.top, 0), l = Math.min(r.bottom, a), c = Math.max(0, l - s), g = r.height;
|
||||||
c / g >= 0.3 && t.push(o);
|
c / g >= 0.3 && t.push(i);
|
||||||
});
|
});
|
||||||
const e = Math.max(...t);
|
const e = Math.max(...t);
|
||||||
for (let n = e + 1; n < window.currentPageContainers.length; n++)
|
for (let n = e + 1; n < window.currentPageContainers.length; n++)
|
||||||
if (!t.includes(n)) {
|
if (!t.includes(n)) {
|
||||||
i = n;
|
o = n;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
i === -1 && e < window.currentPageContainers.length - 1 && (i = e + 1), i >= 0 && i < window.currentPageContainers.length && (window.currentActiveIndex = i, window.currentPageContainers[window.currentActiveIndex].scrollIntoView({
|
o === -1 && e < window.currentPageContainers.length - 1 && (o = e + 1), o >= 0 && o < window.currentPageContainers.length && (window.currentActiveIndex = o, window.currentPageContainers[window.currentActiveIndex].scrollIntoView({
|
||||||
behavior: "smooth",
|
behavior: "smooth",
|
||||||
block: "start"
|
block: "start"
|
||||||
}), setTimeout(() => {
|
}), setTimeout(() => {
|
||||||
@@ -240,12 +240,12 @@ function z() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
function A() {
|
function A() {
|
||||||
const i = [];
|
const o = [];
|
||||||
window.currentPageContainers.forEach((t, e) => {
|
window.currentPageContainers.forEach((t, e) => {
|
||||||
const n = t.getBoundingClientRect(), o = window.innerHeight, r = Math.max(n.top, 0), a = Math.min(n.bottom, o), s = Math.max(0, a - r), l = n.height;
|
const n = t.getBoundingClientRect(), i = window.innerHeight, r = Math.max(n.top, 0), a = Math.min(n.bottom, i), s = Math.max(0, a - r), l = n.height;
|
||||||
s / l >= 0.3 && i.push(e);
|
s / l >= 0.3 && o.push(e);
|
||||||
});
|
});
|
||||||
for (const t of i) {
|
for (const t of o) {
|
||||||
const e = window.currentPageContainers[t];
|
const e = window.currentPageContainers[t];
|
||||||
if (e && e.id && e.id.includes("beilage-"))
|
if (e && e.id && e.id.includes("beilage-"))
|
||||||
return !0;
|
return !0;
|
||||||
@@ -253,37 +253,37 @@ function A() {
|
|||||||
return !1;
|
return !1;
|
||||||
}
|
}
|
||||||
function p() {
|
function p() {
|
||||||
const i = document.getElementById("prevPageBtn"), t = document.getElementById("nextPageBtn"), e = document.getElementById("beilageBtn");
|
const o = document.getElementById("prevPageBtn"), t = document.getElementById("nextPageBtn"), e = document.getElementById("beilageBtn");
|
||||||
if (i && (window.currentActiveIndex <= 0 ? i.style.display = "none" : i.style.display = "flex"), t && (window.currentActiveIndex >= window.currentPageContainers.length - 1 ? t.style.display = "none" : t.style.display = "flex"), e) {
|
if (o && (window.currentActiveIndex <= 0 ? o.style.display = "none" : o.style.display = "flex"), t && (window.currentActiveIndex >= window.currentPageContainers.length - 1 ? t.style.display = "none" : t.style.display = "flex"), e) {
|
||||||
const n = A(), o = e.querySelector("i");
|
const n = A(), i = e.querySelector("i");
|
||||||
n ? (e.title = "Zur Hauptausgabe", e.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", o && (o.className = "ri-file-text-line text-lg lg:text-xl")) : (e.title = "Zu Beilage", e.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", o && (o.className = "ri-attachment-line text-lg lg:text-xl"));
|
n ? (e.title = "Zur Hauptausgabe", e.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")) : (e.title = "Zu Beilage", e.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 j() {
|
function j() {
|
||||||
const i = document.getElementById("shareLinkBtn");
|
const o = document.getElementById("shareLinkBtn");
|
||||||
let t = "";
|
let t = "";
|
||||||
if (window.currentActiveIndex !== void 0 && window.currentPageContainers && window.currentPageContainers[window.currentActiveIndex]) {
|
if (window.currentActiveIndex !== void 0 && window.currentPageContainers && window.currentPageContainers[window.currentActiveIndex]) {
|
||||||
const o = window.currentPageContainers[window.currentActiveIndex].querySelector("[data-page]");
|
const i = window.currentPageContainers[window.currentActiveIndex].querySelector("[data-page]");
|
||||||
o && (t = `#page-${o.getAttribute("data-page")}`);
|
i && (t = `#page-${i.getAttribute("data-page")}`);
|
||||||
}
|
}
|
||||||
const e = window.location.origin + window.location.pathname + t;
|
const e = window.location.origin + window.location.pathname + t;
|
||||||
navigator.share ? navigator.share({
|
navigator.share ? navigator.share({
|
||||||
title: document.title,
|
title: document.title,
|
||||||
url: e
|
url: e
|
||||||
}).catch((n) => {
|
}).catch((n) => {
|
||||||
x(e, i);
|
x(e, o);
|
||||||
}) : x(e, i);
|
}) : x(e, o);
|
||||||
}
|
}
|
||||||
function x(i, t) {
|
function x(o, t) {
|
||||||
if (navigator.clipboard)
|
if (navigator.clipboard)
|
||||||
navigator.clipboard.writeText(i).then(() => {
|
navigator.clipboard.writeText(o).then(() => {
|
||||||
d(t, "Link kopiert!");
|
d(t, "Link kopiert!");
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
d(t, "Kopieren fehlgeschlagen");
|
d(t, "Kopieren fehlgeschlagen");
|
||||||
});
|
});
|
||||||
else {
|
else {
|
||||||
const e = document.createElement("textarea");
|
const e = document.createElement("textarea");
|
||||||
e.value = i, document.body.appendChild(e), e.select();
|
e.value = o, document.body.appendChild(e), e.select();
|
||||||
try {
|
try {
|
||||||
const n = document.execCommand("copy");
|
const n = document.execCommand("copy");
|
||||||
d(t, n ? "Link kopiert!" : "Kopieren fehlgeschlagen");
|
d(t, n ? "Link kopiert!" : "Kopieren fehlgeschlagen");
|
||||||
@@ -295,27 +295,27 @@ function x(i, t) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
function D() {
|
function D() {
|
||||||
const i = document.getElementById("citationBtn"), t = document.title || "KGPZ", e = window.location.href, n = (/* @__PURE__ */ new Date()).toLocaleDateString("de-DE"), o = `Königsberger Gelehrte und Politische Zeitung (KGPZ). ${t}. Digital verfügbar unter: ${e} (Zugriff: ${n}).`;
|
const o = document.getElementById("citationBtn"), t = document.title || "KGPZ", e = window.location.href, n = (/* @__PURE__ */ new Date()).toLocaleDateString("de-DE"), i = `Königsberger Gelehrte und Politische Zeitung (KGPZ). ${t}. Digital verfügbar unter: ${e} (Zugriff: ${n}).`;
|
||||||
if (navigator.clipboard)
|
if (navigator.clipboard)
|
||||||
navigator.clipboard.writeText(o).then(() => {
|
navigator.clipboard.writeText(i).then(() => {
|
||||||
d(i, "Zitation kopiert!");
|
d(o, "Zitation kopiert!");
|
||||||
}).catch((r) => {
|
}).catch((r) => {
|
||||||
d(i, "Kopieren fehlgeschlagen");
|
d(o, "Kopieren fehlgeschlagen");
|
||||||
});
|
});
|
||||||
else {
|
else {
|
||||||
const r = document.createElement("textarea");
|
const r = document.createElement("textarea");
|
||||||
r.value = o, document.body.appendChild(r), r.select();
|
r.value = i, document.body.appendChild(r), r.select();
|
||||||
try {
|
try {
|
||||||
const a = document.execCommand("copy");
|
const a = document.execCommand("copy");
|
||||||
d(i, a ? "Zitation kopiert!" : "Kopieren fehlgeschlagen");
|
d(o, a ? "Zitation kopiert!" : "Kopieren fehlgeschlagen");
|
||||||
} catch {
|
} catch {
|
||||||
d(i, "Kopieren fehlgeschlagen");
|
d(o, "Kopieren fehlgeschlagen");
|
||||||
} finally {
|
} finally {
|
||||||
document.body.removeChild(r);
|
document.body.removeChild(r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function d(i, t) {
|
function d(o, t) {
|
||||||
const e = document.querySelector(".simple-popup");
|
const e = document.querySelector(".simple-popup");
|
||||||
e && e.remove();
|
e && e.remove();
|
||||||
const n = document.createElement("div");
|
const n = document.createElement("div");
|
||||||
@@ -333,10 +333,10 @@ function d(i, t) {
|
|||||||
transition: opacity 0.2s ease;
|
transition: opacity 0.2s ease;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
`;
|
`;
|
||||||
const o = i.getBoundingClientRect(), r = window.innerHeight, a = window.innerWidth;
|
const i = o.getBoundingClientRect(), r = window.innerHeight, a = window.innerWidth;
|
||||||
let s = o.left - 10, l = o.bottom + 8;
|
let s = i.left - 10, l = i.bottom + 8;
|
||||||
const c = 120, g = 32;
|
const c = 120, g = 32;
|
||||||
s + c > a && (s = o.right - c + 10), l + g > r && (l = o.top - g - 8), n.style.left = Math.max(5, s) + "px", n.style.top = Math.max(5, l) + "px", document.body.appendChild(n), setTimeout(() => {
|
s + c > a && (s = i.right - c + 10), l + g > r && (l = i.top - g - 8), n.style.left = Math.max(5, s) + "px", n.style.top = Math.max(5, l) + "px", document.body.appendChild(n), setTimeout(() => {
|
||||||
n.style.opacity = "1";
|
n.style.opacity = "1";
|
||||||
}, 10), setTimeout(() => {
|
}, 10), setTimeout(() => {
|
||||||
n.style.opacity = "0", setTimeout(() => {
|
n.style.opacity = "0", setTimeout(() => {
|
||||||
@@ -345,25 +345,25 @@ function d(i, t) {
|
|||||||
}, 2e3);
|
}, 2e3);
|
||||||
}
|
}
|
||||||
function P() {
|
function P() {
|
||||||
const i = window.location.hash;
|
const o = window.location.hash;
|
||||||
let t = "", e = null;
|
let t = "", e = null;
|
||||||
if (i.startsWith("#page-")) {
|
if (o.startsWith("#page-")) {
|
||||||
if (t = i.replace("#page-", ""), e = document.getElementById(`page-${t}`), !e) {
|
if (t = o.replace("#page-", ""), e = document.getElementById(`page-${t}`), !e) {
|
||||||
const n = document.querySelectorAll(".newspaper-page-container[data-pages]");
|
const n = document.querySelectorAll(".newspaper-page-container[data-pages]");
|
||||||
for (const o of n) {
|
for (const i of n) {
|
||||||
const r = o.getAttribute("data-pages");
|
const r = i.getAttribute("data-pages");
|
||||||
if (r && r.split(",").includes(t)) {
|
if (r && r.split(",").includes(t)) {
|
||||||
e = o;
|
e = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
e || (e = document.getElementById(`beilage-1-page-${t}`) || document.getElementById(`beilage-2-page-${t}`) || document.querySelector(`[id*="beilage"][id*="page-${t}"]`));
|
e || (e = document.getElementById(`beilage-1-page-${t}`) || document.getElementById(`beilage-2-page-${t}`) || document.querySelector(`[id*="beilage"][id*="page-${t}"]`));
|
||||||
} else if (i.startsWith("#beilage-")) {
|
} else if (o.startsWith("#beilage-")) {
|
||||||
const n = i.match(/#beilage-(\d+)-page-(\d+)/);
|
const n = o.match(/#beilage-(\d+)-page-(\d+)/);
|
||||||
if (n) {
|
if (n) {
|
||||||
const o = n[1];
|
const i = n[1];
|
||||||
t = n[2], e = document.getElementById(`beilage-${o}-page-${t}`);
|
t = n[2], e = document.getElementById(`beilage-${i}-page-${t}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
e && t && setTimeout(() => {
|
e && t && setTimeout(() => {
|
||||||
@@ -373,19 +373,19 @@ function P() {
|
|||||||
}), S(t);
|
}), S(t);
|
||||||
}, 300);
|
}, 300);
|
||||||
}
|
}
|
||||||
function b(i, t, e = !1) {
|
function b(o, t, e = !1) {
|
||||||
let n = "";
|
let n = "";
|
||||||
e ? n = `#beilage-1-page-${i}` : n = `#page-${i}`;
|
e ? n = `#beilage-1-page-${o}` : n = `#page-${o}`;
|
||||||
const o = window.location.origin + window.location.pathname + n;
|
const i = window.location.origin + window.location.pathname + n;
|
||||||
if (navigator.clipboard)
|
if (navigator.clipboard)
|
||||||
navigator.clipboard.writeText(o).then(() => {
|
navigator.clipboard.writeText(i).then(() => {
|
||||||
d(t, "Link kopiert!");
|
d(t, "Link kopiert!");
|
||||||
}).catch((r) => {
|
}).catch((r) => {
|
||||||
d(t, "Kopieren fehlgeschlagen");
|
d(t, "Kopieren fehlgeschlagen");
|
||||||
});
|
});
|
||||||
else {
|
else {
|
||||||
const r = document.createElement("textarea");
|
const r = document.createElement("textarea");
|
||||||
r.value = o, document.body.appendChild(r), r.select();
|
r.value = i, document.body.appendChild(r), r.select();
|
||||||
try {
|
try {
|
||||||
const a = document.execCommand("copy");
|
const a = document.execCommand("copy");
|
||||||
d(t, a ? "Link kopiert!" : "Kopieren fehlgeschlagen");
|
d(t, a ? "Link kopiert!" : "Kopieren fehlgeschlagen");
|
||||||
@@ -396,8 +396,8 @@ function b(i, t, e = !1) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function m(i, t) {
|
function m(o, t) {
|
||||||
const e = document.title || "KGPZ", n = `${window.location.origin}${window.location.pathname}#page-${i}`, o = (/* @__PURE__ */ new Date()).toLocaleDateString("de-DE"), r = `Königsberger Gelehrte und Politische Zeitung (KGPZ). ${e}, Seite ${i}. Digital verfügbar unter: ${n} (Zugriff: ${o}).`;
|
const e = document.title || "KGPZ", n = `${window.location.origin}${window.location.pathname}#page-${o}`, i = (/* @__PURE__ */ new Date()).toLocaleDateString("de-DE"), r = `Königsberger Gelehrte und Politische Zeitung (KGPZ). ${e}, Seite ${o}. Digital verfügbar unter: ${n} (Zugriff: ${i}).`;
|
||||||
if (navigator.clipboard)
|
if (navigator.clipboard)
|
||||||
navigator.clipboard.writeText(r).then(() => {
|
navigator.clipboard.writeText(r).then(() => {
|
||||||
d(t, "Zitation kopiert!");
|
d(t, "Zitation kopiert!");
|
||||||
@@ -422,31 +422,31 @@ function h() {
|
|||||||
clearTimeout(window.scrollTimeout), window.scrollTimeout = setTimeout(() => {
|
clearTimeout(window.scrollTimeout), window.scrollTimeout = setTimeout(() => {
|
||||||
C(), p();
|
C(), p();
|
||||||
}, 50);
|
}, 50);
|
||||||
}), P(), window.addEventListener("hashchange", P), document.addEventListener("keydown", function(i) {
|
}), P(), window.addEventListener("hashchange", P), document.addEventListener("keydown", function(o) {
|
||||||
i.key === "Escape" && T();
|
o.key === "Escape" && T();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
window.enlargePage = R;
|
window.enlargePage = R;
|
||||||
window.closeModal = T;
|
window.closeModal = T;
|
||||||
window.scrollToPreviousPage = V;
|
window.scrollToPreviousPage = K;
|
||||||
window.scrollToNextPage = K;
|
window.scrollToNextPage = V;
|
||||||
window.scrollToBeilage = z;
|
window.scrollToBeilage = z;
|
||||||
window.shareCurrentPage = j;
|
window.shareCurrentPage = j;
|
||||||
window.generateCitation = D;
|
window.generateCitation = D;
|
||||||
window.copyPagePermalink = b;
|
window.copyPagePermalink = b;
|
||||||
window.generatePageCitation = m;
|
window.generatePageCitation = m;
|
||||||
function _() {
|
function _() {
|
||||||
v(), q(), document.querySelector(".newspaper-page-container") && h(), htmx.on("htmx:load", function(i) {
|
v(), k(), document.querySelector(".newspaper-page-container") && h(), htmx.on("htmx:load", function(o) {
|
||||||
v();
|
v();
|
||||||
}), document.body.addEventListener("htmx:afterSwap", function(i) {
|
}), document.body.addEventListener("htmx:afterSwap", function(o) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
document.querySelector(".newspaper-page-container") && h();
|
document.querySelector(".newspaper-page-container") && h();
|
||||||
}, 100);
|
}, 100);
|
||||||
}), document.body.addEventListener("htmx:afterSettle", function(i) {
|
}), document.body.addEventListener("htmx:afterSettle", function(o) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
document.querySelector(".newspaper-page-container") && h();
|
document.querySelector(".newspaper-page-container") && h();
|
||||||
}, 200);
|
}, 200);
|
||||||
}), document.body.addEventListener("htmx:load", function(i) {
|
}), document.body.addEventListener("htmx:load", function(o) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
document.querySelector(".newspaper-page-container") && h();
|
document.querySelector(".newspaper-page-container") && h();
|
||||||
}, 100);
|
}, 100);
|
||||||
@@ -458,12 +458,12 @@ class Z extends HTMLElement {
|
|||||||
}
|
}
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
this.innerHTML = `
|
this.innerHTML = `
|
||||||
<div class="fixed inset-0 z-50 flex">
|
<div class="fixed inset-0 z-50 flex pointer-events-none">
|
||||||
<!-- Keep Inhaltsverzeichnis area empty/transparent (collapsible) -->
|
<!-- Keep Inhaltsverzeichnis area empty/transparent (collapsible) -->
|
||||||
<div id="sidebar-spacer" class="lg:w-1/4 xl:w-1/5 flex-shrink-0 transition-all duration-300"></div>
|
<div id="sidebar-spacer" class="lg:w-1/4 xl:w-1/5 flex-shrink-0 transition-all duration-300"></div>
|
||||||
|
|
||||||
<!-- Cover the right columns with the zoomed view -->
|
<!-- Cover the right columns with the zoomed view -->
|
||||||
<div class="flex-1 bg-slate-50 overflow-auto">
|
<div class="flex-1 bg-slate-50 overflow-auto pointer-events-auto">
|
||||||
<div class="relative min-h-full flex flex-col">
|
<div class="relative min-h-full flex flex-col">
|
||||||
<!-- Header with page info and buttons -->
|
<!-- Header with page info and buttons -->
|
||||||
<div class="flex items-center justify-between p-4">
|
<div class="flex items-center justify-between p-4">
|
||||||
@@ -542,7 +542,9 @@ class Z extends HTMLElement {
|
|||||||
id="single-page-image"
|
id="single-page-image"
|
||||||
src=""
|
src=""
|
||||||
alt=""
|
alt=""
|
||||||
class="w-full h-auto rounded-lg shadow-2xl"
|
class="w-full h-auto rounded-lg shadow-2xl cursor-pointer"
|
||||||
|
onclick="this.closest('single-page-viewer').close()"
|
||||||
|
title="Klicken zum Schließen"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -550,15 +552,19 @@ class Z extends HTMLElement {
|
|||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
show(t, e, n, o = !1) {
|
show(t, e, n, i = !1) {
|
||||||
const r = this.querySelector("#single-page-image"), a = this.querySelector("#page-number"), s = this.querySelector("#page-icon");
|
const r = this.querySelector("#single-page-image"), a = this.querySelector("#page-number"), s = this.querySelector("#page-icon");
|
||||||
this.querySelector("#page-indicator"), r.src = t, r.alt = e, this.currentPageNumber = n, this.currentIsBeilage = o, a.textContent = n;
|
this.querySelector("#page-indicator"), r.src = t, r.alt = e, this.currentPageNumber = n, this.currentIsBeilage = i, a.textContent = n;
|
||||||
const l = this.determinePageIconType(n, o);
|
const l = this.determinePageIconType(n, i);
|
||||||
s.innerHTML = this.getPageIconHTML(l), this.updateNavigationButtons(), this.style.display = "block", document.body.style.overflow = "hidden", S(n);
|
s.innerHTML = this.getPageIconHTML(l), this.updateNavigationButtons(), this.style.display = "block", document.body.style.overflow = "hidden", S(n);
|
||||||
}
|
}
|
||||||
close() {
|
close() {
|
||||||
this.style.display = "none", document.body.style.overflow = "";
|
this.style.display = "none", document.body.style.overflow = "";
|
||||||
}
|
}
|
||||||
|
// Clean up component completely
|
||||||
|
destroy() {
|
||||||
|
document.body.style.overflow = "", this.parentNode && this.parentNode.removeChild(this);
|
||||||
|
}
|
||||||
// Determine page icon type based on page position and whether it's beilage
|
// Determine page icon type based on page position and whether it's beilage
|
||||||
determinePageIconType(t, e) {
|
determinePageIconType(t, e) {
|
||||||
const n = e ? '.newspaper-page-container[data-beilage="true"]' : ".newspaper-page-container:not([data-beilage])", r = Array.from(document.querySelectorAll(n)).map((l) => {
|
const n = e ? '.newspaper-page-container[data-beilage="true"]' : ".newspaper-page-container:not([data-beilage])", r = Array.from(document.querySelectorAll(n)).map((l) => {
|
||||||
@@ -602,8 +608,8 @@ class Z extends HTMLElement {
|
|||||||
}
|
}
|
||||||
// Update navigation button visibility based on available pages
|
// Update navigation button visibility based on available pages
|
||||||
updateNavigationButtons() {
|
updateNavigationButtons() {
|
||||||
const t = this.querySelector("#prev-page-btn"), e = this.querySelector("#next-page-btn"), { prevPage: n, nextPage: o } = this.getAdjacentPages();
|
const t = this.querySelector("#prev-page-btn"), e = this.querySelector("#next-page-btn"), { prevPage: n, nextPage: i } = this.getAdjacentPages();
|
||||||
n !== null ? (t.disabled = !1, t.className = t.className.replace("opacity-50 cursor-not-allowed", ""), t.className = t.className.replace("bg-gray-50 text-gray-400", "bg-gray-100 text-gray-700")) : (t.disabled = !0, t.className.includes("opacity-50") || (t.className += " opacity-50 cursor-not-allowed"), t.className = t.className.replace("bg-gray-100 text-gray-700", "bg-gray-50 text-gray-400")), o !== 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("bg-gray-100 text-gray-700", "bg-gray-50 text-gray-400"));
|
n !== null ? (t.disabled = !1, t.className = t.className.replace("opacity-50 cursor-not-allowed", ""), t.className = t.className.replace("bg-gray-50 text-gray-400", "bg-gray-100 text-gray-700")) : (t.disabled = !0, t.className.includes("opacity-50") || (t.className += " opacity-50 cursor-not-allowed"), t.className = t.className.replace("bg-gray-100 text-gray-700", "bg-gray-50 text-gray-400")), i !== 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("bg-gray-100 text-gray-700", "bg-gray-50 text-gray-400"));
|
||||||
}
|
}
|
||||||
// Get previous and next page numbers
|
// Get previous and next page numbers
|
||||||
getAdjacentPages() {
|
getAdjacentPages() {
|
||||||
@@ -616,10 +622,10 @@ class Z extends HTMLElement {
|
|||||||
return console.log("Container page:", l, "parsed:", c), c;
|
return console.log("Container page:", l, "parsed:", c), c;
|
||||||
}).filter((s) => s !== null).sort((s, l) => s - l);
|
}).filter((s) => s !== null).sort((s, l) => s - l);
|
||||||
console.log("All pages found:", n), console.log("Current page:", this.currentPageNumber);
|
console.log("All pages found:", n), console.log("Current page:", this.currentPageNumber);
|
||||||
const o = n.indexOf(this.currentPageNumber);
|
const i = n.indexOf(this.currentPageNumber);
|
||||||
console.log("Current index:", o);
|
console.log("Current index:", i);
|
||||||
let r = null, a = null;
|
let r = null, a = null;
|
||||||
return o > 0 && (r = n[o - 1]), o < n.length - 1 && (a = n[o + 1]), console.log("Adjacent pages - prev:", r, "next:", a), { prevPage: r, nextPage: a };
|
return i > 0 && (r = n[i - 1]), i < n.length - 1 && (a = n[i + 1]), console.log("Adjacent pages - prev:", r, "next:", a), { prevPage: r, nextPage: a };
|
||||||
}
|
}
|
||||||
// Navigate to previous page
|
// Navigate to previous page
|
||||||
goToPreviousPage() {
|
goToPreviousPage() {
|
||||||
@@ -635,17 +641,25 @@ class Z extends HTMLElement {
|
|||||||
navigateToPage(t) {
|
navigateToPage(t) {
|
||||||
const e = this.currentIsBeilage ? '.newspaper-page-container[data-beilage="true"]' : ".newspaper-page-container:not([data-beilage])", n = document.querySelector(`${e}[data-page-container="${t}"]`);
|
const e = this.currentIsBeilage ? '.newspaper-page-container[data-beilage="true"]' : ".newspaper-page-container:not([data-beilage])", n = document.querySelector(`${e}[data-page-container="${t}"]`);
|
||||||
if (n) {
|
if (n) {
|
||||||
const o = n.querySelector(".newspaper-page-image");
|
const i = n.querySelector(".newspaper-page-image");
|
||||||
o && this.show(o.src, o.alt, t, this.currentIsBeilage);
|
i && this.show(i.src, i.alt, t, this.currentIsBeilage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Toggle sidebar visibility
|
// Toggle sidebar visibility
|
||||||
toggleSidebar() {
|
toggleSidebar() {
|
||||||
const t = this.querySelector("#sidebar-spacer"), e = this.querySelector("#sidebar-toggle-btn"), n = e.querySelector("i"), o = t.classList.contains("w-0");
|
const t = this.querySelector("#sidebar-spacer"), e = this.querySelector("#sidebar-toggle-btn"), n = e.querySelector("i"), i = t.classList.contains("w-0");
|
||||||
console.log("Current state - isCollapsed:", o), console.log("Current classes:", t.className), o ? (t.classList.remove("w-0"), t.classList.add("lg:w-1/4", "xl:w-1/5"), e.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-unfold-line text-lg font-bold", e.title = "Inhaltsverzeichnis ausblenden", console.log("Expanding sidebar")) : (t.classList.remove("lg:w-1/4", "xl:w-1/5"), t.classList.add("w-0"), e.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-fold-line text-lg font-bold", e.title = "Inhaltsverzeichnis einblenden", console.log("Collapsing sidebar")), console.log("New classes:", t.className);
|
console.log("Current state - isCollapsed:", i), console.log("Current classes:", t.className), i ? (t.classList.remove("w-0"), t.classList.add("lg:w-1/4", "xl:w-1/5"), e.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-unfold-line text-lg font-bold", e.title = "Inhaltsverzeichnis ausblenden", console.log("Expanding sidebar")) : (t.classList.remove("lg:w-1/4", "xl:w-1/5"), t.classList.add("w-0"), e.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-fold-line text-lg font-bold", e.title = "Inhaltsverzeichnis einblenden", console.log("Collapsing sidebar")), console.log("New classes:", t.className);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
customElements.define("single-page-viewer", Z);
|
customElements.define("single-page-viewer", Z);
|
||||||
|
document.body.addEventListener("htmx:beforeRequest", function(o) {
|
||||||
|
const t = document.querySelector("single-page-viewer");
|
||||||
|
t && t.style.display !== "none" && (console.log("Cleaning up single page viewer before HTMX navigation"), t.destroy());
|
||||||
|
});
|
||||||
|
window.addEventListener("beforeunload", function() {
|
||||||
|
const o = document.querySelector("single-page-viewer");
|
||||||
|
o && o.destroy();
|
||||||
|
});
|
||||||
export {
|
export {
|
||||||
_ as setup
|
_ as setup
|
||||||
};
|
};
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1042,12 +1042,12 @@ class SinglePageViewer extends HTMLElement {
|
|||||||
|
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
this.innerHTML = `
|
this.innerHTML = `
|
||||||
<div class="fixed inset-0 z-50 flex">
|
<div class="fixed inset-0 z-50 flex pointer-events-none">
|
||||||
<!-- Keep Inhaltsverzeichnis area empty/transparent (collapsible) -->
|
<!-- Keep Inhaltsverzeichnis area empty/transparent (collapsible) -->
|
||||||
<div id="sidebar-spacer" class="lg:w-1/4 xl:w-1/5 flex-shrink-0 transition-all duration-300"></div>
|
<div id="sidebar-spacer" class="lg:w-1/4 xl:w-1/5 flex-shrink-0 transition-all duration-300"></div>
|
||||||
|
|
||||||
<!-- Cover the right columns with the zoomed view -->
|
<!-- Cover the right columns with the zoomed view -->
|
||||||
<div class="flex-1 bg-slate-50 overflow-auto">
|
<div class="flex-1 bg-slate-50 overflow-auto pointer-events-auto">
|
||||||
<div class="relative min-h-full flex flex-col">
|
<div class="relative min-h-full flex flex-col">
|
||||||
<!-- Header with page info and buttons -->
|
<!-- Header with page info and buttons -->
|
||||||
<div class="flex items-center justify-between p-4">
|
<div class="flex items-center justify-between p-4">
|
||||||
@@ -1126,7 +1126,9 @@ class SinglePageViewer extends HTMLElement {
|
|||||||
id="single-page-image"
|
id="single-page-image"
|
||||||
src=""
|
src=""
|
||||||
alt=""
|
alt=""
|
||||||
class="w-full h-auto rounded-lg shadow-2xl"
|
class="w-full h-auto rounded-lg shadow-2xl cursor-pointer"
|
||||||
|
onclick="this.closest('single-page-viewer').close()"
|
||||||
|
title="Klicken zum Schließen"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1176,6 +1178,17 @@ class SinglePageViewer extends HTMLElement {
|
|||||||
document.body.style.overflow = '';
|
document.body.style.overflow = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clean up component completely
|
||||||
|
destroy() {
|
||||||
|
// 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
|
// Determine page icon type based on page position and whether it's beilage
|
||||||
determinePageIconType(pageNumber, isBeilage) {
|
determinePageIconType(pageNumber, isBeilage) {
|
||||||
// Get all page containers to determine position
|
// Get all page containers to determine position
|
||||||
@@ -1407,4 +1420,22 @@ class SinglePageViewer extends HTMLElement {
|
|||||||
// Register the web component
|
// Register the web component
|
||||||
customElements.define('single-page-viewer', SinglePageViewer);
|
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();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export { setup };
|
export { setup };
|
||||||
|
|||||||
Reference in New Issue
Block a user