@xiee/utils
Advanced tools
Comparing version 1.13.49 to 1.13.50
@@ -6,3 +6,4 @@ // copy chapter TOC to each chapter's first page (under h1) | ||
if (h?.tagName !== 'H1') return; | ||
if (h.nextElementSibling?.tagName === 'H1') return; | ||
const h2 = h.nextElementSibling; | ||
if (h2?.tagName === 'H1') return; | ||
const u = a.nextElementSibling; | ||
@@ -14,5 +15,5 @@ if (u?.tagName === 'UL') { | ||
toc.firstChild.className = a.parentNode.parentNode.className; | ||
h.after(toc); | ||
(h2?.classList.contains('epigraph') ? h2 : h).after(toc); | ||
} | ||
}); | ||
})(document); |
@@ -1,2 +0,2 @@ | ||
(e=>{e.querySelector(".chapter-toc")||e.querySelectorAll('#TOC > ul > li > a[href^="#"]').forEach((t=>{const a=t.getAttribute("href"),r=e.getElementById(a.replace(/^#/,""));if("H1"!==r?.tagName)return;if("H1"===r.nextElementSibling?.tagName)return;const l=t.nextElementSibling;if("UL"===l?.tagName){const a=e.createElement("div");a.className="chapter-toc",a.id="TOC",a.append(l.cloneNode(!0)),a.firstChild.className=t.parentNode.parentNode.className,r.after(a)}}))})(document); | ||
(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 |
{ | ||
"name": "@xiee/utils", | ||
"version": "1.13.49", | ||
"version": "1.13.50", | ||
"description": "Miscellaneous tools and utilities to manipulate HTML pages", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
236956
2877