@xiee/utils 1.12.27 → 1.12.29
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/default.css +11 -1
- package/css/default.min.css +1 -1
- package/css/default.min.css.map +1 -1
- package/js/code-line-numbers.js +1 -1
- package/js/code-line-numbers.min.js +1 -1
- package/js/sidenotes.js +26 -26
- package/js/sidenotes.min.js +1 -1
- package/js/snap.js +2 -2
- package/js/snap.min.js +1 -1
- package/package.json +1 -1
package/css/default.css
CHANGED
|
@@ -6,7 +6,7 @@ body {
|
|
|
6
6
|
line-height: 1.5;
|
|
7
7
|
box-sizing: border-box;
|
|
8
8
|
}
|
|
9
|
-
body, .
|
|
9
|
+
body, .abstract, code, .footnotes, #refs { font-size: .9em; }
|
|
10
10
|
li li { font-size: .95em; }
|
|
11
11
|
ul:has(li > input[type="checkbox"]) { list-style: none; padding-left: 1em; }
|
|
12
12
|
*, *:before, *:after { box-sizing: inherit; }
|
|
@@ -59,6 +59,16 @@ table, .body h2 { border-bottom: 1px solid #666; }
|
|
|
59
59
|
.cross-ref-sec::before { content: "Section "; }
|
|
60
60
|
.cross-ref-fig::before, .ref-number-fig::before { content: "Figure "; }
|
|
61
61
|
.cross-ref-tab::before, .ref-number-tab::before { content: "Table "; }
|
|
62
|
+
.abstract, #refs {
|
|
63
|
+
&::before { display: block; margin: 1em auto; font-weight: bold; }
|
|
64
|
+
}
|
|
65
|
+
.abstract::before { content: "Abstract"; text-align: center; }
|
|
66
|
+
#refs::before { content: "Bibliography"; font-size: 1.5em; }
|
|
67
|
+
.ref-paren-open::before { content: "("; }
|
|
68
|
+
.ref-paren-close::after { content: ")"; }
|
|
69
|
+
.ref-semi-colon::after { content: "; "; }
|
|
70
|
+
.ref-and::after { content: " and "; }
|
|
71
|
+
.ref-et-al::after { content: " et al."; font-style: italic; }
|
|
62
72
|
.footnote-ref a {
|
|
63
73
|
&::before { content: "["; }
|
|
64
74
|
&::after { content: "]"; }
|
package/css/default.min.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
body{box-sizing:border-box;max-width:800px;margin:auto;padding:1em;font-family:sans-serif;line-height:1.5}body,.
|
|
1
|
+
body{box-sizing:border-box;max-width:800px;margin:auto;padding:1em;font-family:sans-serif;line-height:1.5}body,.abstract,code,.footnotes,#refs{font-size:.9em}li li{font-size:.95em}ul:has(li>input[type=checkbox]){padding-left:1em;list-style:none}*,:before,:after{box-sizing:inherit}a{color:#4682b4}pre,img{max-width:100%}pre,pre:hover{white-space:pre-wrap;word-break:break-all}pre code{padding:1em;display:block;overflow-x:auto}code{font-family:DejaVu Sans Mono,Droid Sans Mono,Lucida Console,Consolas,Monaco,monospace}:not(pre)>code,code[class],.box>div{background-color:#f8f8f8}pre>code:not([class]),pre>.language-plain,.box{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;&:hover{opacity:inherit}}.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:has(img){text-align:center}table{border-top:1px solid #666;margin:auto;& thead th{border-bottom:1px solid #ddd}& th,& td{padding:5px}& thead,& tfoot,& tr:nth-child(2n){background:#eee}}blockquote{color:#666;border-left:.5em solid #eee;margin:0;padding:1px 1em}hr,.footnotes:before{border:1px dashed #ddd}.frontmatter{text-align:center}#TOC .numbered{padding-left:0;& li{list-style:none}& ul{padding-left:1em}}table,.body h2{border-bottom:1px solid #666}.body .appendix,.appendix~h2{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 "}.abstract,#refs{&:before{margin:1em auto;font-weight:700;display:block}}.abstract:before{content:"Abstract";text-align:center}#refs:before{content:"Bibliography";font-size:1.5em}.ref-paren-open:before{content:"("}.ref-paren-close:after{content:")"}.ref-semi-colon:after{content:"; "}.ref-and:after{content:" and "}.ref-et-al:after{content:" et al.";font-style:italic}.footnote-ref a{&:before{content:"["}&:after{content:"]"}}section.footnotes{margin-top:2em;&:before{content:"";max-width:20em;display:block}}@media print{body{max-width:100%;font-size:12pt}tr,img{page-break-inside:avoid}}@media only screen and (width>=992px){pre{white-space:pre}}
|
|
2
2
|
/*# sourceMappingURL=default.min.css.map */
|
package/css/default.min.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"AAAA,0GAQA,
|
|
1
|
+
{"version":3,"mappings":"AAAA,0GAQA,oDACA,sBACA,iEACA,oCACA,gBACA,uBACA,wDACA,mDACA,2FACA,6DACA,8FACA,kCACA,qDACA,mDACA,yCACA,oEAIE,yBAEF,kBACA,0EACA,+DACA,+DACA,qCACA,4CAEE,wCACA,sBACA,oDAEF,2EAMA,4CACA,+BACA,8BAEE,qBACA,uBAEF,4CACA,wDACA,+BACA,wDACA,yCACA,yCACA,+DACA,8DACA,gBACE,wDAEF,sDACA,oDACA,mCACA,mCACA,mCACA,+BACA,qDACA,gBACE,qBACA,qBAEF,iCAEE,kDAGF,aACE,mCACA,gCAEF,sCACE","sources":["default.css"],"sourcesContent":["body {\n font-family: sans-serif;\n max-width: 800px;\n margin: auto;\n padding: 1em;\n line-height: 1.5;\n box-sizing: border-box;\n}\nbody, .abstract, code, .footnotes, #refs { font-size: .9em; }\nli li { font-size: .95em; }\nul:has(li > input[type=\"checkbox\"]) { list-style: none; padding-left: 1em; }\n*, *:before, *:after { box-sizing: inherit; }\na { color: steelblue; }\npre, img { max-width: 100%; }\npre, pre:hover { white-space: pre-wrap; word-break: break-all; }\npre code { display: block; padding: 1em; overflow-x: auto; }\ncode { font-family: 'DejaVu Sans Mono', 'Droid Sans Mono', 'Lucida Console', Consolas, Monaco, monospace; }\n:not(pre) > code, code[class], .box > div { background-color: #f8f8f8; }\npre > code:not([class]), pre > .language-plain, .box { background-color: inherit; border: 1px solid #eee; }\npre > .message { border-color: #9eeaf9; }\npre > .warning { background: #fff3cd; border-color: #fff3cd; }\npre > .error { background: #f8d7da; border-color: #f8d7da; }\n.fenced-chunk { border-left: 1px solid #666; }\n.code-fence {\n opacity: .4;\n border: 1px dashed #666;\n border-left: 2px solid;\n &:hover { opacity: inherit; }\n}\n.box { margin: 1em 0; }\n.box > :first-child > p:first-child, .box > :last-child > p:last-child { padding: 1em; }\n.box > :first-child, .box > :first-child > p:first-child { margin-top: 0; }\n.box > :last-child, .box > :last-child > p:last-child { margin-bottom: 0; }\n.figure > p:has(img) { text-align: center; }\ntable {\n margin: auto; border-top: 1px solid #666;\n thead th { border-bottom: 1px solid #ddd; }\n th, td { padding: 5px; }\n thead, tfoot, tr:nth-child(even) { background: #eee; }\n}\nblockquote {\n color: #666;\n margin: 0;\n padding: 1px 1em;\n border-left: .5em solid #eee;\n}\nhr, .footnotes::before { border: 1px dashed #ddd; }\n.frontmatter { text-align: center; }\n#TOC .numbered {\n padding-left: 0;\n li { list-style: none; }\n ul { padding-left: 1em; }\n}\ntable, .body h2 { border-bottom: 1px solid #666; }\n.body .appendix, .appendix ~ h2 { border-bottom-style: dashed; }\n.main-number::after { content: \".\"; }\n.ref-number-fig::after, .ref-number-tab::after { content: \":\"; }\n.cross-ref-chp::before { content: \"Chapter \"; }\n.cross-ref-sec::before { content: \"Section \"; }\n.cross-ref-fig::before, .ref-number-fig::before { content: \"Figure \"; }\n.cross-ref-tab::before, .ref-number-tab::before { content: \"Table \"; }\n.abstract, #refs {\n &::before { display: block; margin: 1em auto; font-weight: bold; }\n}\n.abstract::before { content: \"Abstract\"; text-align: center; }\n#refs::before { content: \"Bibliography\"; font-size: 1.5em; }\n.ref-paren-open::before { content: \"(\"; }\n.ref-paren-close::after { content: \")\"; }\n.ref-semi-colon::after { content: \"; \"; }\n.ref-and::after { content: \" and \"; }\n.ref-et-al::after { content: \" et al.\"; font-style: italic; }\n.footnote-ref a {\n &::before { content: \"[\"; }\n &::after { content: \"]\"; }\n}\nsection.footnotes {\n margin-top: 2em;\n &::before { content: \"\"; display: block; max-width: 20em; }\n}\n\n@media print {\n body { font-size: 12pt; max-width: 100%; }\n tr, img { page-break-inside: avoid; }\n}\n@media only screen and (min-width: 992px) {\n pre { white-space: pre; }\n}\n"],"names":[]}
|
package/js/code-line-numbers.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
const s = '<span data-line-number=""></span>', sel = 'span[data-line-number]';
|
|
5
5
|
if (!el.classList.contains('line-numbers') || el.parentNode.tagName !== 'PRE'
|
|
6
6
|
|| el.querySelector(sel)) return;
|
|
7
|
-
el.innerHTML = s + el.innerHTML.replace(
|
|
7
|
+
el.innerHTML = s + el.innerHTML.replace(/\n(?=.|\s)/g, '\n' + s);
|
|
8
8
|
let n1 = +el.dataset.start; if (isNaN(n1)) n1 = 1;
|
|
9
9
|
const spans = el.querySelectorAll(sel), w = ('' + (n1 - 1 + spans.length)).length;
|
|
10
10
|
spans.forEach(sp => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{function e(e){const n='<span data-line-number=""></span>',t="span[data-line-number]";if(!e.classList.contains("line-numbers")||"PRE"!==e.parentNode.tagName||e.querySelector(t))return;e.innerHTML=n+e.innerHTML.replace(
|
|
1
|
+
(()=>{function e(e){const n='<span data-line-number=""></span>',t="span[data-line-number]";if(!e.classList.contains("line-numbers")||"PRE"!==e.parentNode.tagName||e.querySelector(t))return;e.innerHTML=n+e.innerHTML.replace(/\n(?=.|\s)/g,"\n"+n);let r=+e.dataset.start;isNaN(r)&&(r=1);const a=e.querySelectorAll(t),l=(""+(r-1+a.length)).length;a.forEach((e=>{let n=""+r++,t=l-n.length;t>0&&(n="0".repeat(t)+n),e.dataset.lineNumber=n}))}function n(n){n?n.grammar&&e(n.element):document.querySelectorAll("pre > code.line-numbers:first-child").forEach(e)}window.Prism?.hooks?Prism.hooks.add("complete",n):n()})();
|
package/js/sidenotes.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
// move footnotes (ids start with fn) and citations (ids start with ref-) to sidenotes
|
|
2
2
|
(d => {
|
|
3
|
-
d.querySelectorAll('.footnotes > ol > li[id^="fn"], #refs >
|
|
3
|
+
d.querySelectorAll('.footnotes > ol > li[id^="fn"], #refs > *[id^="ref-"]').forEach(el => {
|
|
4
4
|
// find <a> that points to note id in body
|
|
5
|
-
const h = `a[href="#${el.id}"]
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
5
|
+
const h = `a[href="#${el.id}"]`;
|
|
6
|
+
d.querySelectorAll(`${h} > sup, sup > ${h}, .citation > ${h}`).forEach(a => {
|
|
7
|
+
const a2 = a.parentNode;
|
|
8
|
+
(a.tagName === 'A' ? a : a2).removeAttribute('href');
|
|
9
|
+
const s = d.createElement('div'); // insert a side div next to a2 in body
|
|
10
|
+
s.className = 'side side-right';
|
|
11
|
+
if (/^fn/.test(el.id)) {
|
|
12
|
+
s.innerHTML = el.innerHTML;
|
|
13
|
+
// add footnote number
|
|
14
|
+
s.firstElementChild.insertAdjacentHTML('afterbegin', `<span class="bg-number">${a.innerText}</span> `);
|
|
15
|
+
s.querySelector('a[href^="#fnref"]')?.remove(); // remove backreference
|
|
16
|
+
s.className += ' footnotes';
|
|
17
|
+
} else {
|
|
18
|
+
s.innerHTML = el.outerHTML;
|
|
19
|
+
}
|
|
20
|
+
while (s.lastChild?.nodeName === '#text' && /^\s*$/.test(s.lastChild.textContent)) {
|
|
21
|
+
s.lastChild.remove();
|
|
22
|
+
}
|
|
23
|
+
// remove fullwidth classes if present (because they cannot be used in the margin)
|
|
24
|
+
s.querySelectorAll('.fullwidth').forEach(el => el.classList.remove('fullwidth'));
|
|
25
|
+
// insert note after the <sup> or <span> that contains a
|
|
26
|
+
a2.after(s);
|
|
27
|
+
a2.classList.add('note-ref');
|
|
28
|
+
el.remove();
|
|
29
|
+
});
|
|
30
30
|
});
|
|
31
31
|
// remove the footnote/citation section if it's empty now
|
|
32
32
|
d.querySelectorAll('.footnotes, #refs').forEach(el => {
|
package/js/sidenotes.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(e=>{e.querySelectorAll('.footnotes > ol > li[id^="fn"], #refs >
|
|
1
|
+
(e=>{e.querySelectorAll('.footnotes > ol > li[id^="fn"], #refs > *[id^="ref-"]').forEach((t=>{const s=`a[href="#${t.id}"]`;e.querySelectorAll(`${s} > sup, sup > ${s}, .citation > ${s}`).forEach((s=>{const o=s.parentNode;("A"===s.tagName?s:o).removeAttribute("href");const l=e.createElement("div");for(l.className="side side-right",/^fn/.test(t.id)?(l.innerHTML=t.innerHTML,l.firstElementChild.insertAdjacentHTML("afterbegin",`<span class="bg-number">${s.innerText}</span> `),l.querySelector('a[href^="#fnref"]')?.remove(),l.className+=" footnotes"):l.innerHTML=t.outerHTML;"#text"===l.lastChild?.nodeName&&/^\s*$/.test(l.lastChild.textContent);)l.lastChild.remove();l.querySelectorAll(".fullwidth").forEach((e=>e.classList.remove("fullwidth"))),o.after(l),o.classList.add("note-ref"),t.remove()}))})),e.querySelectorAll(".footnotes, #refs").forEach((e=>{/^\s*$/.test(e.innerText)&&e.remove()})),e.getElementById("TOC")?.classList.add("side","side-left");const t=e.querySelectorAll(".side.side-right, .side.side-left"),s=[];e.querySelectorAll(".fullwidth").forEach((e=>{s.push([e,e.getBoundingClientRect()])})),t.length&&e.body.classList.add("has-sidenotes"),t.forEach((e=>{const t=e.getBoundingClientRect();for(let e of s){const s=e[1];t.right<s.left||t.left>s.right||t.bottom<s.top||t.top>s.bottom||e[0].classList.remove("fullwidth")}}))})(document);
|
package/js/snap.js
CHANGED
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
p.classList.add('slide-container');
|
|
29
|
-
// add 'slide' class to the frontmatter
|
|
30
|
-
['.frontmatter', '#TOC'].forEach(sel => {
|
|
29
|
+
// add 'slide' class to the frontmatter/abstract divs and toc
|
|
30
|
+
['.frontmatter', '.abstract', '#TOC'].forEach(sel => {
|
|
31
31
|
const el = d.body.querySelector(sel);
|
|
32
32
|
if (!el) return;
|
|
33
33
|
if (sel === '.frontmatter') {
|
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?.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);
|
|
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",".abstract","#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);
|