@xiee/utils 1.12.15 → 1.12.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/article.css +1 -1
- package/css/article.min.css +1 -1
- package/css/book.css +16 -14
- package/css/book.min.css +1 -1
- package/css/default.css +20 -11
- package/css/default.min.css +1 -1
- package/js/snap.js +1 -1
- package/js/snap.min.js +1 -1
- package/js/toc-highlight.js +1 -4
- package/js/toc-highlight.min.js +1 -1
- package/package.json +1 -1
package/css/article.css
CHANGED
package/css/article.min.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.menu,.side,blockquote,body{background:#fafafa}.article-list,.body,.body~.appendix,.embed-left,.embed-right,.frontmatter,.fullwidth,.single .appendix,.single main{margin-top:2em;padding:1em;box-shadow:0 0 8px #ccc;background:#fff}.article-meta{background:#f8f8f8}.appendix,.article-meta .terms,.body .side,.caption,.footnotes,figcaption,main .side>*{font-size:.9em}.body~.appendix,.frontmatter,.single .appendix{background:0 0}.appendix h2{border-bottom:1px dashed #666}#TOC{top:0}#TOC ul{list-style-position:inside}#TOC>ul{padding:0;margin:0}#TOC li>ul{padding-left:1em}#TOC .numbered{list-style:none}#TOC a{text-decoration:none}#TOC ul ul{border-left:1px solid #b0c4de}.bg-number{padding:1px 5px;border-radius:5px;background:#778899;color:#fff}.side{width:200px;margin:0 auto}.side-left{float:left;clear:left;margin-left:calc(-200px - 2em);position:sticky}.side-right{float:right;clear:right;margin-right:calc(-200px - 2em)}.quote-left,.quote-right{width:45%}.embed-left,.embed-right{margin-top:auto;padding:0}.embed-left,.quote-left{float:left;margin-right:1em}.embed-right,.quote-right{float:right;margin-left:1em}.embed-left{margin-left:calc(-200px - 2em)}.embed-right{margin-right:calc(-200px - 2em)}.embed-left>:first-child,.embed-right>:first-child,.side>:first-child{margin-top:0}.embed-left>:last-child,.embed-right>:last-child{margin-bottom:0}.quote-left>:first-child,.quote-right>:first-child{padding-top:.1px}.quote-left>:last-child,.quote-right>:last-child{padding-bottom:.1px}.fullwidth,.fullwidth *{margin:auto 0}.fullwidth *{max-width:calc(100vw - 4em)}.fullscroll *{max-width:initial}.fullwidth{max-width:calc(100vw - 2em);margin:1em 0 1em 50%;transform:translateX(-50%);float:left;min-width:100%;background:#fff}.fullscroll,.fullscroll .figure,.fullscroll figure{overflow-x:auto}.fullwidth .caption,.fullwidth figcaption{margin-left:calc(50% - 400px);width:800px;padding:1em 1em 0}@media (min-width:1280.02px){.appendix,.article,.body{position:relative}#TOC .active{color:#32cd32}#TOC li li .active{border-left:3px solid;margin-left:calc(-1em - 3px);padding-left:1em}#TOC li:not(.
|
|
1
|
+
.menu,.side,blockquote,body{background:#fafafa}.article-list,.body,.body~.appendix,.embed-left,.embed-right,.frontmatter,.fullwidth,.single .appendix,.single main{margin-top:2em;padding:1em;box-shadow:0 0 8px #ccc;background:#fff}.article-meta{background:#f8f8f8}.appendix,.article-meta .terms,.body .side,.caption,.footnotes,figcaption,main .side>*{font-size:.9em}.body~.appendix,.frontmatter,.single .appendix{background:0 0}.appendix h2{border-bottom:1px dashed #666}#TOC{top:0}#TOC ul{list-style-position:inside}#TOC>ul{padding:0;margin:0}#TOC li>ul{padding-left:1em}#TOC .numbered{list-style:none}#TOC a{text-decoration:none}#TOC ul ul{border-left:1px solid #b0c4de}.bg-number{padding:1px 5px;border-radius:5px;background:#778899;color:#fff}.side{width:200px;margin:0 auto}.side-left{float:left;clear:left;margin-left:calc(-200px - 2em);position:sticky}.side-right{float:right;clear:right;margin-right:calc(-200px - 2em)}.quote-left,.quote-right{width:45%}.embed-left,.embed-right{margin-top:auto;padding:0}.embed-left,.quote-left{float:left;margin-right:1em}.embed-right,.quote-right{float:right;margin-left:1em}.embed-left{margin-left:calc(-200px - 2em)}.embed-right{margin-right:calc(-200px - 2em)}.embed-left>:first-child,.embed-right>:first-child,.side>:first-child{margin-top:0}.embed-left>:last-child,.embed-right>:last-child{margin-bottom:0}.quote-left>:first-child,.quote-right>:first-child{padding-top:.1px}.quote-left>:last-child,.quote-right>:last-child{padding-bottom:.1px}.fullwidth,.fullwidth *{margin:auto 0}.fullwidth *{max-width:calc(100vw - 4em)}.fullscroll *{max-width:initial}.fullwidth{max-width:calc(100vw - 2em);margin:1em 0 1em 50%;transform:translateX(-50%);float:left;min-width:100%;background:#fff}.fullscroll,.fullscroll .figure,.fullscroll figure{overflow-x:auto}.fullwidth .caption,.fullwidth figcaption{margin-left:calc(50% - 400px);width:800px;padding:1em 1em 0}@media (min-width:1280.02px){.appendix,.article,.body{position:relative}#TOC .active{color:#32cd32}#TOC li li .active{border-left:3px solid;margin-left:calc(-1em - 3px);padding-left:1em}#TOC li:not(:has(.active)) ul{display:none}.note-ref{cursor:pointer}.note-ref:hover+.side{display:inline-block;background-color:#f8f8f8;position:absolute;margin-left:1em;padding:.5em;box-sizing:content-box}}@media (max-width:1280px){#TOC{border:1px solid #eee;border-radius:5px;padding:1em;position:initial;float:none;columns:2}.side{width:100%}.body .side,main .side{padding:0 2em;color:#2f4f4f}.side-left,.side-right{clear:both;margin:1em auto;background:0 0}:not(.note-ref)+.side{float:none}.side>:last-child{margin-bottom:0}.embed-left,.embed-right{float:inherit;margin:auto;padding:1em}}@media (max-width:800px){body{padding:initial}.body,main{padding:0 .5em 0}#TOC{columns:1}.quote-left,.quote-right{width:inherit;float:inherit;margin:auto}.fullwidth:not(.fullscroll) *{max-width:100%}.fullwidth{margin:initial;transform:initial;float:none;min-width:initial;background:0 0;border:none}.fullwidth .caption,.fullwidth figcaption{margin:initial;padding:initial}}
|
package/css/book.css
CHANGED
|
@@ -13,15 +13,15 @@ body {
|
|
|
13
13
|
background-size: 2em 2em;
|
|
14
14
|
background-color: #fff;
|
|
15
15
|
padding-bottom: 0;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
& > div {
|
|
17
|
+
margin: 0 -1em;
|
|
18
|
+
background-color: #ebf6f9;
|
|
19
|
+
padding: 1em;
|
|
20
|
+
}
|
|
21
|
+
& .title {
|
|
22
|
+
padding: 20vh 1em 1em;
|
|
23
|
+
margin-top: -1em;
|
|
24
|
+
}
|
|
25
25
|
}
|
|
26
26
|
#TOC {
|
|
27
27
|
margin-left: calc(-200px - .8em);
|
|
@@ -31,11 +31,13 @@ body {
|
|
|
31
31
|
margin-left: auto;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
.chapter:not(.appendix) .main-number
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
.chapter:not(.appendix) .main-number {
|
|
35
|
+
&::before {
|
|
36
|
+
content: "Chapter ";
|
|
37
|
+
}
|
|
38
|
+
&::after {
|
|
39
|
+
content: none;
|
|
40
|
+
}
|
|
39
41
|
}
|
|
40
42
|
.chapter h1 {
|
|
41
43
|
margin: 1em auto 3em;
|
package/css/book.min.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
body{font-size:1em;font-family:Palatino,Georgia,serif}.body .side,.footnotes,.side,code{font-size:.85em}.chapter,.frontmatter{min-height:calc(100vh - 1em)}.frontmatter{background-image:radial-gradient(#b6cee2 1px,#fff 1px);background-size:2em 2em;background-color:#fff;padding-bottom:0
|
|
1
|
+
body{font-size:1em;font-family:Palatino,Georgia,serif}.body .side,.footnotes,.side,code{font-size:.85em}.chapter,.frontmatter{min-height:calc(100vh - 1em)}.frontmatter{background-image:radial-gradient(#b6cee2 1px,#fff 1px);background-size:2em 2em;background-color:#fff;padding-bottom:0;background-color:#ebf6f9;padding:1em}& .title{padding:20vh 1em 1em;margin-top:-1em}@media (max-width:1280px){#TOC{margin-left:auto}}.chapter h1{margin:1em auto 3em;border-bottom:1px solid}h1 .section-number{display:inline-block;border-bottom:4px solid;margin-bottom:-4px}.body h2{border-bottom-style:dashed}
|
package/css/default.css
CHANGED
|
@@ -8,6 +8,7 @@ body {
|
|
|
8
8
|
}
|
|
9
9
|
body, .footnotes, code { font-size: .9em; }
|
|
10
10
|
li li { font-size: .95em; }
|
|
11
|
+
ul:has(li > input[type="checkbox"]) { list-style: none; padding-left: 1em; }
|
|
11
12
|
*, *:before, *:after { box-sizing: inherit; }
|
|
12
13
|
a { color: steelblue; }
|
|
13
14
|
pre, img { max-width: 100%; }
|
|
@@ -35,10 +36,12 @@ pre[class*=language-].line-numbers { padding: 1em 0; margin-left: 3.5em; }
|
|
|
35
36
|
.box > :first-child, .box > :first-child > p:first-child { margin-top: 0; }
|
|
36
37
|
.box > :last-child, .box > :last-child > p:last-child { margin-bottom: 0; }
|
|
37
38
|
.figure > p { text-align: center; }
|
|
38
|
-
table {
|
|
39
|
-
|
|
40
|
-
th
|
|
41
|
-
|
|
39
|
+
table {
|
|
40
|
+
margin: auto; border-top: 1px solid #666;
|
|
41
|
+
thead th { border-bottom: 1px solid #ddd; }
|
|
42
|
+
th, td { padding: 5px; }
|
|
43
|
+
thead, tfoot, tr:nth-child(even) { background: #eee; }
|
|
44
|
+
}
|
|
42
45
|
blockquote {
|
|
43
46
|
color: #666;
|
|
44
47
|
margin: 0;
|
|
@@ -47,9 +50,11 @@ blockquote {
|
|
|
47
50
|
}
|
|
48
51
|
hr, .footnotes::before { border: 1px dashed #ddd; }
|
|
49
52
|
.frontmatter { text-align: center; }
|
|
50
|
-
#TOC .numbered
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
#TOC .numbered {
|
|
54
|
+
padding-left: 0;
|
|
55
|
+
li { list-style: none; }
|
|
56
|
+
ul { padding-left: 1em; }
|
|
57
|
+
}
|
|
53
58
|
table, .body h2 { border-bottom: 1px solid #666; }
|
|
54
59
|
.body .appendix, .appendix ~ h2 { border-bottom-style: dashed; }
|
|
55
60
|
.main-number::after { content: "."; }
|
|
@@ -58,10 +63,14 @@ table, .body h2 { border-bottom: 1px solid #666; }
|
|
|
58
63
|
.cross-ref-sec::before { content: "Section "; }
|
|
59
64
|
.cross-ref-fig::before, .ref-number-fig::before { content: "Figure "; }
|
|
60
65
|
.cross-ref-tab::before, .ref-number-tab::before { content: "Table "; }
|
|
61
|
-
.footnote-ref a
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
66
|
+
.footnote-ref a {
|
|
67
|
+
&::before { content: "["; }
|
|
68
|
+
&::after { content: "]"; }
|
|
69
|
+
}
|
|
70
|
+
section.footnotes {
|
|
71
|
+
margin-top: 2em;
|
|
72
|
+
&::before { content: ""; display: block; max-width: 20em; }
|
|
73
|
+
}
|
|
65
74
|
|
|
66
75
|
@media print {
|
|
67
76
|
body { font-size: 12pt; max-width: 100%; }
|
package/css/default.min.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
body{font-family:sans-serif;max-width:800px;margin:auto;padding:1em;line-height:1.5;box-sizing:border-box}.footnotes,body,code{font-size:.9em}li li{font-size:.95em}*,:after,:before{box-sizing:inherit}a{color:#4682b4}img,pre{max-width:100%}pre,pre:hover{white-space:pre-wrap;word-break:break-all}pre code{display:block;overflow-x:auto}code{font-family:'DejaVu Sans Mono','Droid Sans Mono','Lucida Console',Consolas,Monaco,monospace}.box>div,.line-numbers,:not(pre)>code,code[class]{background-color:#f8f8f8}.box,pre>.language-plain,pre>code:not([class]){background-color:inherit;border:1px solid #eee}pre>.message{border-color:#9eeaf9}pre>.warning{background:#fff3cd;border-color:#fff3cd}pre>.error{background:#f8d7da;border-color:#f8d7da}.fenced-chunk{border-left:1px solid #666}.code-fence{opacity:.4;border:1px dashed #666;border-left:2px solid}.code-fence:hover{opacity:inherit}.line-numbers code{display:table;padding:0 0 0 1em}pre[class*=language-].line-numbers{padding:1em 0;margin-left:3.5em}.line-numbers .line-numbers-rows{left:-3.5em}.line-numbers-rows>span:before{padding-right:.5em}.box{margin:1em 0}.box>:first-child>p:first-child,.box>:last-child>p:last-child{padding:1em}.box>:first-child,.box>:first-child>p:first-child{margin-top:0}.box>:last-child,.box>:last-child>p:last-child{margin-bottom:0}.figure>p{text-align:center}table{margin:auto;border-top:1px solid #666}
|
|
1
|
+
body{font-family:sans-serif;max-width:800px;margin:auto;padding:1em;line-height:1.5;box-sizing:border-box}.footnotes,body,code{font-size:.9em}li li{font-size:.95em}ul:has(li > input[type=checkbox]){list-style:none;padding-left:1em}*,:after,:before{box-sizing:inherit}a{color:#4682b4}img,pre{max-width:100%}pre,pre:hover{white-space:pre-wrap;word-break:break-all}pre code{display:block;overflow-x:auto}code{font-family:'DejaVu Sans Mono','Droid Sans Mono','Lucida Console',Consolas,Monaco,monospace}.box>div,.line-numbers,:not(pre)>code,code[class]{background-color:#f8f8f8}.box,pre>.language-plain,pre>code:not([class]){background-color:inherit;border:1px solid #eee}pre>.message{border-color:#9eeaf9}pre>.warning{background:#fff3cd;border-color:#fff3cd}pre>.error{background:#f8d7da;border-color:#f8d7da}.fenced-chunk{border-left:1px solid #666}.code-fence{opacity:.4;border:1px dashed #666;border-left:2px solid}.code-fence:hover{opacity:inherit}.line-numbers code{display:table;padding:0 0 0 1em}pre[class*=language-].line-numbers{padding:1em 0;margin-left:3.5em}.line-numbers .line-numbers-rows{left:-3.5em}.line-numbers-rows>span:before{padding-right:.5em}.box{margin:1em 0}.box>:first-child>p:first-child,.box>:last-child>p:last-child{padding:1em}.box>:first-child,.box>:first-child>p:first-child{margin-top:0}.box>:last-child,.box>:last-child>p:last-child{margin-bottom:0}.figure>p{text-align:center}table{margin:auto;border-top:1px solid #666}td,th{padding:5px}tfoot,thead,tr:nth-child(2n){background:#eee}.footnotes::before,hr{border:1px dashed #ddd}.frontmatter{text-align:center}#TOC .numbered{padding-left:0}ul{padding-left:1em}.body h2{border-bottom:1px solid #666}.appendix~h2,.body .appendix{border-bottom-style:dashed}.main-number::after{content:"."}.ref-number-fig::after,.ref-number-tab::after{content:":"}.cross-ref-chp::before{content:"Chapter "}.cross-ref-sec::before{content:"Section "}.cross-ref-fig::before,.ref-number-fig::before{content:"Figure "}.cross-ref-tab::before,.ref-number-tab::before{content:"Table "}section.footnotes{margin-top:2em}@media print{body{font-size:12pt;max-width:100%}img,tr{page-break-inside:avoid}}@media only screen and (min-width:992px){pre{white-space:pre}}
|
package/js/snap.js
CHANGED
package/js/snap.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e){let t=e.body;const n=":scope > h2";function o(e,n=1){if(t.querySelectorAll(e).length>=n)return!0;for(let o=0;o<t.children.length;o++)if(t.children[o].querySelectorAll(e).length>=n){t=t.children[o];break}return!1}function r(t,n){const o=e.createElement(t);return n&&(o.className=n),o}if(!o(":scope > hr:not([class])",3)&&"BODY"===t.tagName){if(!o(n)&&"BODY"===t.tagName)return;t.querySelectorAll(n).forEach((e=>e.before(r("hr"))))}function i(e){return""===e?.
|
|
1
|
+
!function(e){let t=e.body;const n=":scope > h2";function o(e,n=1){if(t.querySelectorAll(e).length>=n)return!0;for(let o=0;o<t.children.length;o++)if(t.children[o].querySelectorAll(e).length>=n){t=t.children[o];break}return!1}function r(t,n){const o=e.createElement(t);return n&&(o.className=n),o}if(!o(":scope > hr:not([class])",3)&&"BODY"===t.tagName){if(!o(n)&&"BODY"===t.tagName)return;t.querySelectorAll(n).forEach((e=>e.before(r("hr"))))}function i(e){return""===e?.innerHTML?e:r("div","slide")}function s(e){return"HR"===e.tagName&&0===e.attributes.length}t.classList.add("slide-container"),[".frontmatter","#TOC"].forEach((t=>{const n=e.body.querySelector(t);if(n)if(".frontmatter"===t)n.classList.add("slide");else{const e=i();n.before(e),e.append(n)}}));let l=t.firstElementChild;if(s(l)&&l.remove(),l=t.firstElementChild,!l)return;let c=i();for(l.before(c);;){let e=c.nextSibling;if(!e)break;s(e)?(c=i(c),e.before(c),e.remove()):e.classList?.contains("slide")?(c=i(c),e.after(c)):c.append(e)}function a(e,t){const n=r("div");n.innerHTML=`<div ${t}></div>`;const o=n.firstElementChild.attributes;for(const t of o)e.setAttribute(t.name,t.value);n.remove()}function d(e){setTimeout((()=>e?.scrollIntoView()),100)}const f=e.documentElement,u=e.body.classList,h=e.querySelectorAll("div.slide"),m=h.length,p=e.querySelector("span.timer"),y=e.querySelector(".footnotes");h.forEach(((e,t)=>{const n=r("div","header"),o=r("div","main"),i=r("div","footer");o.append(...e.childNodes),e.append(o),e.insertAdjacentElement("afterbegin",n),e.insertAdjacentElement("beforeend",i),y&&e.querySelectorAll('.footnote-ref > a[href^="#fn"]').forEach((t=>{const n=y.querySelector("li"+t.getAttribute("href"));if(!n)return;let o=e.querySelector("section.footnotes");o&&!o.contains(n)||(o=r("section","footnotes"),i.before(o)),o.append(n),n.firstElementChild?.insertAdjacentHTML("afterbegin",`[${t.innerHTML}] `),n.outerHTML=n.innerHTML})),i.append(p?p.cloneNode():r("span","timer"));const s=r("span","page-number");s.innerText=t+1+"/"+m,s.onclick=e=>location.hash=t+1,i.append(s);for(const t of o.childNodes){if(t.nodeType!==Node.COMMENT_NODE)continue;let n=t.textContent;if(!/^#/.test(n))continue;n=n.replace(/^#/,"");const o=/[\s\n]class="([^"]+)"/,r=n.match(o);r&&(n=n.replace(o,"").trim(),e.className+=" "+r[1]),n&&a(e,n);break}e.addEventListener("click",(e=>{(e.altKey||e.ctrlKey)&&(L(e),d(e.target))}))})),[...e.querySelectorAll("a.footnote-backref"),y,p].forEach((e=>e?.remove()));const g=e.querySelectorAll("span.timer"),b=1e3*g[0].dataset.total;let v;function E(){v=new Date,setInterval(S,1e3)}function S(){if(!u.contains("slide-mode"))return;let e=new Date-v;b&&(e=b-e);const t=new Date(Math.abs(e)).toISOString().substr(11,8).replace(/^00:/,"");g.forEach((n=>{n.innerText=t,e<0&&(n.style.opacity=Math.ceiling(e/1e3)%2)}))}function L(e){u.toggle("overview")?u.remove("slide-mode"):H(e)}e.addEventListener("keyup",(t=>{t.target===e.body&&("f"===t.key&&f.requestFullscreen(),"o"===t.key&&L(t),"m"===t.key&&u.toggle("mirrored"),sessionStorage.setItem("body-class",e.body.className))})),e.onfullscreenchange=t=>{e.fullscreenElement&&(!v&&E(),H(t))},g.forEach((e=>e.addEventListener("click",(e=>E()))));let q=-1;function T(){if(q>=0)return q;const e=r("div","slide");return t.querySelector(".slide:last-of-type").after(e),q=e.offsetHeight,e.remove(),q}const w=r("style");w.setAttribute("type","text/css"),e.head.append(w),w.innerHTML=`:root{--slide-ratio:${screen.height/screen.width}}`;const A=+getComputedStyle(f).getPropertyValue("--slide-ratio");function H(t){if("load"===t.type&&d(h[location.hash.replace(/^#/,"")-1]),u.contains("overview"))return;let n=window.innerHeight,o=n/900,i=n/window.innerWidth,s=e.fullscreenElement;u.toggle("slide-mode",s||i<=A)&&!s&&f.scrollWidth>f.offsetWidth&&u.remove("slide-mode"),w.innerHTML=`:root{--slide-ratio:${A};--slide-scale:${o};--slide-top:${(o-1)/2*e.body.scrollHeight+"px"};}`,!e.querySelector(".spacer.fade")&&u.contains("slide-mode")&&h.forEach((e=>{const t=r("div","spacer fade"),n=e.offsetHeight,i=T();e.append(t),n<=i||(t.style.height=(i-n%i)*o+"px")}))}["load","resize"].forEach((e=>window.addEventListener(e,H)));const N=sessionStorage.getItem("body-class");N&&(e.body.className+=" "+N)}(document);
|
package/js/toc-highlight.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
if (!toc) return;
|
|
6
6
|
const links = toc.querySelectorAll('a[href^="#"]');
|
|
7
7
|
if (!links.length) return;
|
|
8
|
-
const
|
|
8
|
+
const dict = {};
|
|
9
9
|
links.forEach(a => dict[a.getAttribute('href').replace('#', '')] = a);
|
|
10
10
|
const ids = Object.keys(dict);
|
|
11
11
|
|
|
@@ -26,9 +26,6 @@
|
|
|
26
26
|
for (const i in dict) {
|
|
27
27
|
dict[i].classList[i === id_active ? 'add' : 'remove']('active');
|
|
28
28
|
}
|
|
29
|
-
lis.forEach(li => {
|
|
30
|
-
li.classList[li.querySelector('.active') ? 'add' : 'remove']('open');
|
|
31
|
-
});
|
|
32
29
|
}));
|
|
33
30
|
|
|
34
31
|
// observe all section headings associated with TOC links
|
package/js/toc-highlight.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(e=>{const t=e.querySelector("#TableOfContents, #TOC");if(!t)return;const r=t.querySelectorAll('a[href^="#"]');if(!r.length)return;const n=
|
|
1
|
+
(e=>{const t=e.querySelector("#TableOfContents, #TOC");if(!t)return;const r=t.querySelectorAll('a[href^="#"]');if(!r.length)return;const n={};r.forEach((e=>n[e.getAttribute("href").replace("#","")]=e));const o=Object.keys(n),c=[],s=new IntersectionObserver((e=>e.forEach((e=>{const t=e.target.id,r=c.indexOf(t);let s;e.isIntersecting?c.push(t):r>-1&&c.splice(r,1);const i=c.length;if(i)s=c[i-1];else{if(e.target.getBoundingClientRect().top<0)return;const r=o.indexOf(t)-1;r>=0&&(s=o[r])}for(const e in n)n[e].classList[e===s?"add":"remove"]("active")}))));e.querySelectorAll("h1,h2,h3,h4,h5,h6").forEach((e=>{1===e.nodeType&&n.hasOwnProperty(e.id)&&s.observe(e)}))})(document);
|