Compare commits

..

2 commits

Author SHA1 Message Date
06eecff942
Remove reference to HTML Tidy 2025-12-26 07:56:56 -05:00
9b0debd0ba
Scroll TOC list when clicking a letter 2025-12-26 07:56:20 -05:00
3 changed files with 15 additions and 18 deletions

View file

@ -8727,7 +8727,7 @@
<p>
<span class="none2">OFFSHORE ISLANDS</span>
<span class="none3"
>exist in some quantity, some having human
>exist in some quantity, some hav i ng human
inhabitants, and one at least being the abode of
DRAGONS.</span
>

View file

@ -52,6 +52,15 @@ Array.from(firstByLetter.entries())
tocLetters?.appendChild(link);
});
// scroll TOC list when clicking a letter
tocLetters?.addEventListener("click", (e) => {
if (e.target.tagName !== "A") return;
const href = e.target.getAttribute("href");
if (!href) return;
const tocLink = tocList?.querySelector(`a[href="${href}"]`);
tocLink?.scrollIntoView({ block: "start" });
});
const searchInput = document.getElementById("toc-search");
let searchTimeout;
searchInput?.addEventListener("input", (event) => {
@ -344,20 +353,13 @@ tocList?.addEventListener("click", (e) => {
}
});
// highlight active TOC entry based on hash
const updateActiveTocEntry = () => {
// scroll TOC item into view when navigating via hash
window.addEventListener("hashchange", () => {
const id = location.hash.slice(1);
tocList?.querySelector("a.active")?.classList.remove("active");
if (id) {
const link = tocList?.querySelector(`a[href="#${id}"]`);
link?.classList.add("active");
tocList?.querySelector(`a[href="#${id}"]`)?.scrollIntoView({ block: "nearest" });
}
};
window.addEventListener("hashchange", updateActiveTocEntry);
if (location.hash) {
updateActiveTocEntry();
}
});
// Entry popup preview on hover
const popup = document.createElement("div");

View file

@ -140,6 +140,7 @@ body {
padding: 6px 8px;
border-radius: 10px;
display: block;
scroll-margin-top: 1rem;
transition:
background 0.2s ease,
color 0.2s ease;
@ -151,12 +152,6 @@ body {
color: var(--accent-deep);
}
.toc-list a.active {
background: rgba(182, 82, 47, 0.22);
color: var(--accent-deep);
font-weight: 600;
}
.content {
background: rgba(255, 255, 255, 0.6);
border-radius: clamp(12px, 3vw, 24px);