@anywhichway/autohelm
Advanced tools
Comparing version 0.0.25 to 0.0.26
26
index.js
@@ -66,5 +66,7 @@ const toTOC = (dom,headings,toc,previousLevel,previousHeading) => { | ||
toc.style.display = "none"; | ||
open.classList.add("autohelm-open-toc"); | ||
open.innerHTML = "▼"; | ||
open.style.display = "inline"; | ||
open.style.fontSize = "15px"; | ||
close.classList.add("autohelm-close-toc"); | ||
close.innerHTML = "▲"; | ||
@@ -75,12 +77,2 @@ close.style.display = "none"; | ||
tocEl.appendChild(close); | ||
open.addEventListener("click",() => { | ||
toc.style.display = "block"; | ||
open.style.display = "none"; | ||
close.style.display = "inline"; | ||
}) | ||
close.addEventListener("click",() => { | ||
toc.style.display = "none"; | ||
open.style.display = "inline"; | ||
close.style.display = "none"; | ||
}) | ||
} | ||
@@ -133,2 +125,16 @@ } | ||
if(tocEl) { | ||
if(event.target.classList.contains("autohelm-open-toc")) { | ||
event.preventDefault(); | ||
tocEl.nextElementSibling.style.display = "block"; | ||
event.target.style.display = "none"; | ||
document.getElementsByClassName("autohelm-close-toc")[0].style.display = "inline"; | ||
return; | ||
} | ||
if(event.target.classList.contains("autohelm-close-toc")) { | ||
event.preventDefault(); | ||
tocEl.nextElementSibling.style.display = "none"; | ||
event.target.style.display = "none"; | ||
document.getElementsByClassName("autohelm-open-toc")[0].style.display = "inline"; | ||
return; | ||
} | ||
const anchors = [...document.body.querySelectorAll(`.autohelm-toc a[href="#${tocEl.id}"]`)]; | ||
@@ -135,0 +141,0 @@ if(anchors.includes(event.target)) { |
{ | ||
"name": "@anywhichway/autohelm", | ||
"version": "0.0.25", | ||
"version": "0.0.26", | ||
"description": "A library to support standardized table of contents and footnote navigation in HTML files", | ||
@@ -5,0 +5,0 @@ "type": "module", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11494
165