fix: keep glossary entry details open on compact viewports
This commit is contained in:
@@ -2718,6 +2718,16 @@ const WHOAMI_FORCE_LOCALHOST = (import.meta.env.PUBLIC_WHOAMI_FORCE_LOCALHOST ??
|
|||||||
const isGlossaryCompactViewport = () =>
|
const isGlossaryCompactViewport = () =>
|
||||||
isGlossaryEdition &&
|
isGlossaryEdition &&
|
||||||
(mqGlossaryCompact.matches || mqGlossaryCompactLandscape.matches);
|
(mqGlossaryCompact.matches || mqGlossaryCompactLandscape.matches);
|
||||||
|
|
||||||
|
function forceOpenGlossaryEntryDetails() {
|
||||||
|
if (!isGlossaryEntryMode || !reading) return;
|
||||||
|
|
||||||
|
reading.querySelectorAll("details.details-section").forEach((details) => {
|
||||||
|
details.open = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
forceOpenGlossaryEntryDetails();
|
||||||
|
|
||||||
function disableFollowForCompactGlossary() {
|
function disableFollowForCompactGlossary() {
|
||||||
followEl.classList.remove("is-on");
|
followEl.classList.remove("is-on");
|
||||||
@@ -2745,16 +2755,11 @@ const WHOAMI_FORCE_LOCALHOST = (import.meta.env.PUBLIC_WHOAMI_FORCE_LOCALHOST ??
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isGlossaryHomeMode || isGlossaryCompactViewport()) {
|
if (isGlossaryHomeMode || isGlossaryCompactViewport()) {
|
||||||
|
forceOpenGlossaryEntryDetails();
|
||||||
disableFollowForCompactGlossary();
|
disableFollowForCompactGlossary();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isGlossaryEntryMode) {
|
|
||||||
reading.querySelectorAll("details.details-section").forEach((details) => {
|
|
||||||
details.open = true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const h1 = reading.querySelector("h1");
|
const h1 = reading.querySelector("h1");
|
||||||
|
|
||||||
const topChapterLabel =
|
const topChapterLabel =
|
||||||
|
|||||||
Reference in New Issue
Block a user