Compare commits
4 commits
77ddefc3d1
...
df3e997f36
| Author | SHA1 | Date | |
|---|---|---|---|
| df3e997f36 | |||
| 34cb308f9f | |||
| 8763513101 | |||
| f0183f5fba |
1 changed files with 6 additions and 2 deletions
|
|
@ -19,7 +19,10 @@ entrySpans.forEach((span, index) => {
|
||||||
const id = `entry-${slugify(term)}`;
|
const id = `entry-${slugify(term)}`;
|
||||||
span.setAttribute("id", id);
|
span.setAttribute("id", id);
|
||||||
span.classList.add("entry-title");
|
span.classList.add("entry-title");
|
||||||
span.style.setProperty("--entry-delay", `${Math.min(index * 0.01, 0.4)}s`);
|
/** @type {HTMLElement} */ (span).style.setProperty(
|
||||||
|
"--entry-delay",
|
||||||
|
`${Math.min(index * 0.01, 0.4)}s`,
|
||||||
|
);
|
||||||
entryMap.set(term, id);
|
entryMap.set(term, id);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -54,7 +57,8 @@ Array.from(firstByLetter.entries())
|
||||||
|
|
||||||
const searchInput = document.getElementById("toc-search");
|
const searchInput = document.getElementById("toc-search");
|
||||||
searchInput?.addEventListener("input", (event) => {
|
searchInput?.addEventListener("input", (event) => {
|
||||||
const query = event.target.value.trim().toLowerCase();
|
const target = /** @type {HTMLInputElement} */ (event.target);
|
||||||
|
const query = target.value.trim().toLowerCase();
|
||||||
Array.from(tocList?.querySelectorAll("li") ?? []).forEach((item) => {
|
Array.from(tocList?.querySelectorAll("li") ?? []).forEach((item) => {
|
||||||
const text = item.textContent.toLowerCase();
|
const text = item.textContent.toLowerCase();
|
||||||
item.style.display = text.includes(query) ? "" : "none";
|
item.style.display = text.includes(query) ? "" : "none";
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue