UNPKG

@xiee/utils

Version:

Miscellaneous tools and utilities to manipulate HTML pages

2 lines 567 B
(e=>{e.querySelector(".chapter-toc")||e.querySelectorAll('#TOC > ul > li > a[href^="#"]').forEach(t=>{const a=t.getAttribute("href"),n=e.getElementById(a.replace(/^#/,""));if("H1"!==n?.tagName)return;const r=n.nextElementSibling;if("H1"===r?.tagName)return;const c=t.nextElementSibling;if("UL"===c?.tagName){const a=e.createElement("div");a.className="chapter-toc",a.id="TOC",a.append(c.cloneNode(!0)),a.firstChild.className=t.parentNode.parentNode.className,(r?.classList.contains("epigraph")?r:n).after(a)}})})(document); //# sourceMappingURL=chapter-toc.min.js.map