Compare commits
2 commits
3a4d95ea77
...
06eecff942
| Author | SHA1 | Date | |
|---|---|---|---|
| 06eecff942 | |||
| 9b0debd0ba |
3 changed files with 15 additions and 18 deletions
|
|
@ -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
|
||||
>
|
||||
|
|
|
|||
24
script.js
24
script.js
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue