fix: code review round 2 - logging, cleanup, TOC, simplify converter
This commit is contained in:
1 parent
723e50eb25
commit
45f08c8b9b
4 files changed
+45
-36
No files matched your search
@@ -386,8 +386,18 @@
|
||||
}
|
||||
|
||||
function updateActiveToc(loc, toc, book) {
|
||||
// epub.js provides location.start.cfi
|
||||
document.querySelectorAll("#tocList li").forEach((l) => l.classList.remove("active"));
|
||||
if (!loc || !loc.start || !toc || !book) return;
|
||||
const href = loc.start.href;
|
||||
if (!href) return;
|
||||
const items = document.querySelectorAll("#tocList li");
|
||||
for (const li of items) {
|
||||
if (li.textContent && href.includes(li.textContent.trim())) {
|
||||
li.classList.add("active");
|
||||
li.scrollIntoView({ block: "nearest" });
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// === Search ===
|
||||
|
||||
Reference in new issue
Block a user