@xiee/utils 1.13.7 → 1.13.9
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/.github/workflows/npm-publish.yml +1 -0
- package/css/pages.css +3 -8
- package/css/pages.min.css +1 -1
- package/css/pages.min.css.map +1 -1
- package/js/pages.js +46 -23
- package/js/pages.min.js +1 -1
- package/js/pages.min.js.map +1 -1
- package/package.json +1 -1
- package/purge.sh +11 -0
package/css/pages.css
CHANGED
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
border: none;
|
|
56
56
|
padding: 0;
|
|
57
57
|
margin-left: auto;
|
|
58
|
-
|
|
58
|
+
&:not(.pagesjs-page:has(#TOC) ~ .pagesjs-page *)::before {
|
|
59
59
|
content: "Contents";
|
|
60
60
|
display: block;
|
|
61
61
|
font-weight: bold;
|
|
@@ -159,13 +159,8 @@
|
|
|
159
159
|
margin: 0;
|
|
160
160
|
gap: 0;
|
|
161
161
|
.page-multiple {
|
|
162
|
-
padding: 0
|
|
163
|
-
|
|
164
|
-
margin-top: calc(0 - var(--page-header-bottom) - var(--page-header-height));
|
|
165
|
-
}
|
|
166
|
-
.pagesjs-footer {
|
|
167
|
-
margin-bottom: calc(0 - var(--page-footer-top) - var(--page-footer-height));
|
|
168
|
-
}
|
|
162
|
+
padding-top: 0
|
|
163
|
+
padding-bottom: 0;
|
|
169
164
|
}
|
|
170
165
|
}
|
|
171
166
|
}
|
package/css/pages.min.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
:root{--paper-width:210mm;--paper-height:297mm;--paper-margin-top:40px;--paper-margin-right:80px;--paper-margin-bottom:40px;--paper-margin-left:80px;--paper-margin:var(--paper-margin-top)var(--paper-margin-right)var(--paper-margin-bottom)var(--paper-margin-left);--page-header-height:40px;--page-header-bottom:40px;--page-footer-height:40px;--page-footer-top:40px}@page{size:var(--paper-width)var(--paper-height);margin:0}@page multiple{margin-top:var(--paper-margin-top);margin-bottom:var(--paper-margin-bottom)}.page-multiple{page:multiple}.pagesjs{flex-wrap:wrap;justify-content:center;gap:5mm;max-width:100%;margin:5mm;padding:0;display:flex;& .frontmatter,& .chapter{min-height:unset;box-shadow:none}& .pagesjs-page{width:var(--paper-width);height:var(--paper-height);padding:var(--paper-margin);page-break-after:always;flex-direction:column;justify-content:space-between;display:flex;& img{max-width:100%}& pre{white-space:pre-wrap}& .chapter-before,& .chapter-after,& .pencil:has(+.chapter-before){display:none}& #TOC{border:none;margin-left:auto;padding:0;&:before{content:"Contents";margin-bottom:1em;font-size:1.5em;font-weight:700;display:block}&>ul{columns:18em}& a{display:flex;&:after{content:attr(data-page-number);align-self:end}& .section-number{margin-right:.3em}& .dot-leader{border-bottom:1px dashed;flex:1 0 2em;margin:0 1ex 1ex}}}& .footnotes:before{content:"";border-top:1px solid;max-width:20em;display:block}&:first-child:is(.page-book *){padding:0;& .pagesjs-header,& .pagesjs-footer{display:none}& .frontmatter{padding:var(--paper-margin);height:100%;margin:0;& .title{margin-top:calc(0px - var(--paper-margin-top))}&>div{margin:0 calc(0px - var(--paper-margin-right))0 calc(0px - var(--paper-margin-left))}}}}}.pagesjs-header,.pagesjs-footer{justify-content:space-between;font-size:.9em;display:flex}.pagesjs-header{flex:0 0 var(--page-header-height);margin-bottom:var(--page-header-bottom);align-items:end;&:before{content:attr(data-main-title)}&:after{content:attr(data-page-title)}}.pagesjs-footer{flex:0 0 var(--page-footer-height);margin-top:var(--page-footer-top);align-items:start;&:before{content:" "}&:after{content:attr(data-page-number)}}.pagesjs-body{flex-grow:1;position:relative}@media only screen{.pagesjs{background-color:#f7f7f7;& .pagesjs-page{background-color:#fff}& .page-multiple{overflow-y:auto}}.pagesjs-filling{display:block;& .pagesjs-page{height:auto}}}@media print{.pagesjs{gap:0;margin:0;& .page-multiple{padding
|
|
1
|
+
:root{--paper-width:210mm;--paper-height:297mm;--paper-margin-top:40px;--paper-margin-right:80px;--paper-margin-bottom:40px;--paper-margin-left:80px;--paper-margin:var(--paper-margin-top)var(--paper-margin-right)var(--paper-margin-bottom)var(--paper-margin-left);--page-header-height:40px;--page-header-bottom:40px;--page-footer-height:40px;--page-footer-top:40px}@page{size:var(--paper-width)var(--paper-height);margin:0}@page multiple{margin-top:var(--paper-margin-top);margin-bottom:var(--paper-margin-bottom)}.page-multiple{page:multiple}.pagesjs{flex-wrap:wrap;justify-content:center;gap:5mm;max-width:100%;margin:5mm;padding:0;display:flex;& .frontmatter,& .chapter{min-height:unset;box-shadow:none}& .pagesjs-page{width:var(--paper-width);height:var(--paper-height);padding:var(--paper-margin);page-break-after:always;flex-direction:column;justify-content:space-between;display:flex;& img{max-width:100%}& pre{white-space:pre-wrap}& .chapter-before,& .chapter-after,& .pencil:has(+.chapter-before){display:none}& #TOC{border:none;margin-left:auto;padding:0;&:not(.pagesjs-page:has(#TOC)~.pagesjs-page *):before{content:"Contents";margin-bottom:1em;font-size:1.5em;font-weight:700;display:block}&>ul{columns:18em}& a{display:flex;&:after{content:attr(data-page-number);align-self:end}& .section-number{margin-right:.3em}& .dot-leader{border-bottom:1px dashed;flex:1 0 2em;margin:0 1ex 1ex}}}& .footnotes:before{content:"";border-top:1px solid;max-width:20em;display:block}&:first-child:is(.page-book *){padding:0;& .pagesjs-header,& .pagesjs-footer{display:none}& .frontmatter{padding:var(--paper-margin);height:100%;margin:0;& .title{margin-top:calc(0px - var(--paper-margin-top))}&>div{margin:0 calc(0px - var(--paper-margin-right))0 calc(0px - var(--paper-margin-left))}}}}}.pagesjs-header,.pagesjs-footer{justify-content:space-between;font-size:.9em;display:flex}.pagesjs-header{flex:0 0 var(--page-header-height);margin-bottom:var(--page-header-bottom);align-items:end;&:before{content:attr(data-main-title)}&:after{content:attr(data-page-title)}}.pagesjs-footer{flex:0 0 var(--page-footer-height);margin-top:var(--page-footer-top);align-items:start;&:before{content:" "}&:after{content:attr(data-page-number)}}.pagesjs-body{flex-grow:1;position:relative}@media only screen{.pagesjs{background-color:#f7f7f7;& .pagesjs-page{background-color:#fff}& .page-multiple{overflow-y:auto}}.pagesjs-filling{display:block;& .pagesjs-page{height:auto}}}@media print{.pagesjs{gap:0;margin:0;& .page-multiple{padding-top:0 padding-bottom: 0}}}
|
|
2
2
|
/*# sourceMappingURL=pages.min.css.map */
|
package/css/pages.min.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"AAAA,4WAaA,0DAIA,2FAIA,6BAGA,wGAQE,2DAIA,yLAQE,qBAGA,2BAGA,gFAGA,8CAIE,
|
|
1
|
+
{"version":3,"mappings":"AAAA,4WAaA,0DAIA,2FAIA,6BAGA,wGAQE,2DAIA,yLAQE,qBAGA,2BAGA,gFAGA,8CAIE,yIAOA,kBAGA,iBAEE,sDAIA,oCAGA,uEAOJ,iFAMA,yCAEE,iDAGA,gEAIE,wDAGA,+FAOR,0FAKA,2GAIE,uCAGA,uCAIF,uGAIE,qBAGA,wCAIF,4CAIA,mBACE,kCAEE,sCAGA,kCAIF,+BAEE,8BAKJ,aACE,wBAGE","sources":["pages.css"],"sourcesContent":[":root {\n --paper-width: 210mm;\n --paper-height: 297mm;\n --paper-margin-top: 40px;\n --paper-margin-right: 80px;\n --paper-margin-bottom: 40px;\n --paper-margin-left: 80px;\n --paper-margin: var(--paper-margin-top) var(--paper-margin-right) var(--paper-margin-bottom) var(--paper-margin-left);\n --page-header-height: 40px;\n --page-header-bottom: 40px;\n --page-footer-height: 40px;\n --page-footer-top: 40px;\n}\n@page {\n size: var(--paper-width) var(--paper-height);\n margin: 0;\n}\n@page multiple {\n margin-top: var(--paper-margin-top);\n margin-bottom: var(--paper-margin-bottom);\n}\n.page-multiple {\n page: multiple;\n}\n.pagesjs {\n padding: 0;\n max-width: 100%;\n margin: 5mm;\n display: flex;\n justify-content: center;\n flex-wrap: wrap;\n gap: 5mm;\n .frontmatter, .chapter {\n min-height: unset;\n box-shadow: none;\n }\n .pagesjs-page {\n width: var(--paper-width);\n height: var(--paper-height);\n padding: var(--paper-margin);\n \tpage-break-after: always;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n img {\n max-width: 100%;\n }\n pre {\n white-space: pre-wrap;\n }\n .chapter-before, .chapter-after, .pencil:has(+ .chapter-before) {\n display: none;\n }\n #TOC {\n border: none;\n padding: 0;\n margin-left: auto;\n &:not(.pagesjs-page:has(#TOC) ~ .pagesjs-page *)::before {\n content: \"Contents\";\n display: block;\n font-weight: bold;\n font-size: 1.5em;\n margin-bottom: 1em;\n }\n & > ul {\n columns: 18em;\n }\n a {\n display: flex;\n &::after {\n content: attr(data-page-number);\n align-self: end;\n }\n .section-number {\n margin-right: .3em;\n }\n .dot-leader {\n flex: 1 0 2em;\n border-bottom: dashed 1px;\n margin: 0 1ex 1ex;\n }\n }\n }\n .footnotes::before {\n content: \"\";\n display: block;\n max-width: 20em;\n border-top: solid 1px;\n }\n &:first-child:is(.page-book *) {\n padding: 0;\n .pagesjs-header, .pagesjs-footer {\n display: none;\n }\n .frontmatter {\n margin: 0;\n padding: var(--paper-margin);\n height: 100%;\n .title {\n margin-top: calc(0px - var(--paper-margin-top));\n }\n & > div {\n margin: 0 calc(0px - var(--paper-margin-right)) 0 calc(0px - var(--paper-margin-left));\n }\n }\n }\n }\n}\n.pagesjs-header, .pagesjs-footer {\n font-size: .9em;\n display: flex;\n justify-content: space-between;\n}\n.pagesjs-header {\n flex: 0 0 var(--page-header-height);\n margin-bottom: var(--page-header-bottom);\n align-items: end;\n &::before {\n content: attr(data-main-title);\n }\n &::after {\n content: attr(data-page-title);\n }\n}\n.pagesjs-footer {\n flex: 0 0 var(--page-footer-height);\n margin-top: var(--page-footer-top);\n align-items: start;\n &::before {\n content: \" \";\n }\n &::after {\n content: attr(data-page-number);\n }\n}\n.pagesjs-body {\n flex-grow: 1;\n position: relative;\n}\n@media only screen {\n .pagesjs {\n background-color: #f7f7f7;\n .pagesjs-page {\n background-color: white;\n }\n .page-multiple {\n overflow-y: auto;\n }\n }\n .pagesjs-filling {\n display: block;\n .pagesjs-page {\n height: auto;\n }\n }\n}\n@media print {\n .pagesjs {\n margin: 0;\n gap: 0;\n .page-multiple {\n padding-top: 0\n padding-bottom: 0;\n }\n }\n}\n"],"names":[]}
|
package/js/pages.js
CHANGED
|
@@ -9,9 +9,11 @@
|
|
|
9
9
|
tpl.innerHTML = `<div class="pagesjs-header"></div>
|
|
10
10
|
<div class="pagesjs-body"></div>
|
|
11
11
|
<div class="pagesjs-footer"></div>`;
|
|
12
|
-
let box, box_body, H;
|
|
12
|
+
let box, box_body, H, box_cls = [];
|
|
13
13
|
function newPage(el) {
|
|
14
|
+
el && !$('.pagesjs-body', el) && el.insertAdjacentHTML('afterbegin', tpl.innerHTML);
|
|
14
15
|
box = el || tpl.cloneNode(true); box_body = box.children[1];
|
|
16
|
+
box_cls.length && box.classList.add(...box_cls);
|
|
15
17
|
return box;
|
|
16
18
|
}
|
|
17
19
|
function removeBlank(el) {
|
|
@@ -23,32 +25,54 @@
|
|
|
23
25
|
function fill(el) {
|
|
24
26
|
// if the element is already a page, just use it as the box
|
|
25
27
|
if (el.classList.contains('pagesjs-page')) {
|
|
26
|
-
box.after(el);
|
|
27
|
-
!$('.pagesjs-body', el) && el.insertAdjacentHTML('afterbegin', tpl.innerHTML);
|
|
28
|
+
box.after(newPage(el));
|
|
28
29
|
// if current element is not empty, fill its content into the box
|
|
29
30
|
if (el.childElementCount > 3) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
newPage(el);
|
|
31
|
+
box_body.append(...[...el.children].slice(3));
|
|
32
|
+
// TODO: should we fragment this page if it's too long?
|
|
33
|
+
box.after(newPage()); // create a new empty page
|
|
34
34
|
}
|
|
35
|
-
return
|
|
35
|
+
return;
|
|
36
36
|
}
|
|
37
37
|
// create a new box when too much content (exceeding original height)
|
|
38
38
|
if (box.scrollHeight > H) {
|
|
39
|
-
const box2
|
|
40
|
-
|
|
41
|
-
// if there's more than one child in the box, move the last child
|
|
42
|
-
|
|
43
|
-
[box, box_body] = [box2, box_body2];
|
|
39
|
+
const [box2, box_body2] = [box, box_body]; // store old box
|
|
40
|
+
box2.after(newPage());
|
|
41
|
+
// if there's more than one child in the box, move the last child to next box
|
|
42
|
+
box_body2.childElementCount > 1 && box_body.append(box_body2.lastElementChild);
|
|
44
43
|
}
|
|
45
44
|
box_body.append(el);
|
|
46
|
-
|
|
45
|
+
fragment(el);
|
|
46
|
+
}
|
|
47
|
+
// break elements that are relatively easy to break (such as <ul>)
|
|
48
|
+
function fragment(el, container, parent, page) {
|
|
49
|
+
if (box.scrollHeight <= H) return;
|
|
50
|
+
const box_cur = page || box, el2 = el.cloneNode(); // shallow clone (wrapper only)
|
|
51
|
+
// add the clone to current box, and move original el to next box
|
|
52
|
+
container ? container.append(el2) : (
|
|
53
|
+
box_body.append(el2), box_cur.after(newPage()), box_body.append(el)
|
|
54
|
+
);
|
|
55
|
+
// for DIVs containing a single child (e.g., #TOC > ul), try to break the child
|
|
56
|
+
if (el.tagName === 'DIV' && el.childElementCount === 1) {
|
|
57
|
+
fragment(el.firstElementChild, el2, el, box_cur);
|
|
58
|
+
}
|
|
59
|
+
// keep moving el's first item to el2 until page height > H
|
|
60
|
+
if (['UL', 'BLOCKQUOTE'].indexOf(el.tagName) > -1 && el.childElementCount > 1) while (true) {
|
|
61
|
+
const item = el.firstChild;
|
|
62
|
+
if (!item) break;
|
|
63
|
+
el2.append(item);
|
|
64
|
+
if (box_cur.scrollHeight > H) {
|
|
65
|
+
el.insertBefore(item, el.firstChild);
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
el2.lastChild || el2.remove(); // remove the clone if empty
|
|
70
|
+
fragment(container ? parent : el);
|
|
47
71
|
}
|
|
48
72
|
|
|
49
73
|
// use data-short-title of a header if exists, and fall back to inner text
|
|
50
74
|
function shortTitle(h) {
|
|
51
|
-
return h && (h.dataset
|
|
75
|
+
return h && (h.dataset.shortTitle || h.innerText);
|
|
52
76
|
}
|
|
53
77
|
const main = shortTitle($('h1.title, .frontmatter h1, .title, h1')), // main title
|
|
54
78
|
ps = (book ? 'h1' : 'h2') + ':not(.frontmatter *)', // page title selector
|
|
@@ -61,7 +85,7 @@
|
|
|
61
85
|
// an estimate; if not accurate, use <div class="pagesjs-page" data-pages-offset="N">
|
|
62
86
|
// to provide a number manually)
|
|
63
87
|
function calcPages(box) {
|
|
64
|
-
let n = +box.dataset
|
|
88
|
+
let n = +box.dataset.pagesOffset;
|
|
65
89
|
if (n) return n;
|
|
66
90
|
const h = box.scrollHeight;
|
|
67
91
|
n = Math.ceil(h/H);
|
|
@@ -92,14 +116,13 @@
|
|
|
92
116
|
|
|
93
117
|
cls.add('pagesjs-filling');
|
|
94
118
|
// iteratively add elements to pages
|
|
95
|
-
$$('.frontmatter, #TOC, .abstract').forEach(el =>
|
|
96
|
-
book ? (box_body.append(el), box.after(newPage())) : fill(el);
|
|
97
|
-
});
|
|
119
|
+
$$('.frontmatter, #TOC, .abstract').forEach(el => (fill(el), book && box.after(newPage())));
|
|
98
120
|
$$('.body').forEach(el => {
|
|
99
121
|
// preserve book chapter classes if exist
|
|
100
|
-
|
|
122
|
+
box_cls = ['chapter', 'appendix'].filter(i => el.classList.contains(i));
|
|
123
|
+
newPage(box);
|
|
101
124
|
book && box.innerText !== '' && box.after(newPage());
|
|
102
|
-
[...el.children].map(
|
|
125
|
+
[...el.children].map(fill);
|
|
103
126
|
el.childElementCount === 0 && el.remove();
|
|
104
127
|
});
|
|
105
128
|
cls.remove('pagesjs-filling');
|
|
@@ -114,7 +137,7 @@
|
|
|
114
137
|
n?.classList.contains('section-number') ? n.after(s) : a.insertAdjacentElement('afterbegin', s);
|
|
115
138
|
while (s.nextSibling) s.append(s.nextSibling);
|
|
116
139
|
a.insertAdjacentHTML('beforeend', '<span class="dot-leader"></span>');
|
|
117
|
-
a.dataset
|
|
140
|
+
a.dataset.pageNumber = '000'; // placeholder for page numbers
|
|
118
141
|
});
|
|
119
142
|
|
|
120
143
|
// add page number, title, etc. to data-* attributes of page elements
|
|
@@ -143,7 +166,7 @@
|
|
|
143
166
|
// add page numbers to TOC with data-* attributes
|
|
144
167
|
$$('a[href^="#"]', toc).forEach(a => {
|
|
145
168
|
const p = $(`.pagesjs-page:has(${a.getAttribute('href')}) .pagesjs-header`);
|
|
146
|
-
a.dataset
|
|
169
|
+
a.dataset.pageNumber = p ? p.dataset.pageNumber : '';
|
|
147
170
|
});
|
|
148
171
|
}
|
|
149
172
|
addEventListener('beforeprint', paginate);
|
package/js/pages.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(e=>{function t(t,n=e){return n?.querySelector(t)}function n(t,n=e){return n?n.querySelectorAll(t):[]}const a=e.createElement("div"),r=n("h1").length>1;let s,i,o;function c(e){return s=e||a.cloneNode(!0),i=s.children[1],s}function
|
|
1
|
+
(e=>{function t(t,n=e){return n?.querySelector(t)}function n(t,n=e){return n?n.querySelectorAll(t):[]}const a=e.createElement("div"),r=n("h1").length>1;a.className="pagesjs-page",a.innerHTML='<div class="pagesjs-header"></div>\n<div class="pagesjs-body"></div>\n<div class="pagesjs-footer"></div>';let s,i,o,l=[];function c(e){return e&&!t(".pagesjs-body",e)&&e.insertAdjacentHTML("afterbegin",a.innerHTML),s=e||a.cloneNode(!0),i=s.children[1],l.length&&s.classList.add(...l),s}function d(e){if(!e)return!1;const t=""===e.innerText.trim();return t&&e.remove(),t}function f(e){if(e.classList.contains("pagesjs-page"))return s.after(c(e)),void(e.childElementCount>3&&(i.append(...[...e.children].slice(3)),s.after(c())));if(s.scrollHeight>o){const[e,t]=[s,i];e.after(c()),t.childElementCount>1&&i.append(t.lastElementChild)}i.append(e),p(e)}function p(e,t,n,a){if(s.scrollHeight<=o)return;const r=a||s,l=e.cloneNode();if(t?t.append(l):(i.append(l),r.after(c()),i.append(e)),"DIV"===e.tagName&&1===e.childElementCount&&p(e.firstElementChild,l,e,r),["UL","BLOCKQUOTE"].indexOf(e.tagName)>-1&&e.childElementCount>1)for(;;){const t=e.firstChild;if(!t)break;if(l.append(t),r.scrollHeight>o){e.insertBefore(t,e.firstChild);break}}l.lastChild||l.remove(),p(t?n:e)}function g(e){return e&&(e.dataset.shortTitle||e.innerText)}const h=g(t("h1.title, .frontmatter h1, .title, h1")),m=(r?"h1":"h2")+":not(.frontmatter *)",u=["top","bottom"].map((t=>+getComputedStyle(e.documentElement).getPropertyValue(`--paper-margin-${t}`).replace("px","")||0));function E(){const a=e.body.classList;if(a.contains("pagesjs"))return;a.add("pagesjs"),r&&a.add("page-book"),e.body.insertAdjacentElement("afterbegin",c()),o=s.clientHeight||window.innerHeight,n(":is(#TOC, .footnotes):is(.side-left, .side-right).side").forEach((e=>{e.classList.remove("side","side-left","side-right")})),a.add("pagesjs-filling"),n(".frontmatter, #TOC, .abstract").forEach((e=>(f(e),r&&s.after(c())))),n(".body").forEach((e=>{l=["chapter","appendix"].filter((t=>e.classList.contains(t))),c(s),r&&""!==s.innerText&&s.after(c()),[...e.children].map(f),0===e.childElementCount&&e.remove()})),a.remove("pagesjs-filling"),r&&d(s.nextElementSibling);const i=t("#TOC");n('a[href^="#"]',i).forEach((t=>{const n=e.createElement("span"),a=t.firstElementChild;for(a?.classList.contains("section-number")?a.after(n):t.insertAdjacentElement("afterbegin",n);n.nextSibling;)n.append(n.nextSibling);t.insertAdjacentHTML("beforeend",'<span class="dot-leader"></span>'),t.dataset.pageNumber="000"}));let p,E=0;n(".pagesjs-page").forEach((e=>{if(d(e))return;r&&t(m,e)&&(p="");const a=function(e){let t=+e.dataset.pagesOffset;if(t)return t;const a=e.scrollHeight;if(t=Math.ceil(a/o),t<=1)return t;const r=u.concat([...n("thead",e)].map((e=>+e.offsetHeight))).reduce(((e,t)=>e+t));if(!r)return t;function s(){return Math.ceil((a+(t-1)*r)/o)}let i=s();for(;i>t;)t=i,i=s();return t}(e);a>1&&e.classList.add("page-multiple"),E+=a;const s={pageNumber:E,mainTitle:h,pageTitle:p};let i;[e.children[0],e.children[2]].forEach((e=>{for(const t in s)s[t]&&(e.dataset[t]=s[t])})),p=g([...n(m,e)].pop())||p,n(".footnotes",e).forEach(((t,n)=>{0===n?(i=t,e.children[1].after(t)):(i.append(...t.children),t.remove())}))})),n('a[href^="#"]',i).forEach((e=>{const n=t(`.pagesjs-page:has(${e.getAttribute("href")}) .pagesjs-header`);e.dataset.pageNumber=n?n.dataset.pageNumber:""}))}addEventListener("beforeprint",E);let b=sessionStorage.getItem("pagesjs");b&&E(),addEventListener("keypress",(e=>"p"===e.key&&(E(),b=b?"":"1",sessionStorage.setItem("pagesjs",b),b||location.reload())))})(document);
|
package/js/pages.min.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["d","$","s","el","querySelector","$$","querySelectorAll","tpl","createElement","book","length","box","box_body","H","newPage","cloneNode","children","removeBlank","v","innerText","trim","remove","fill","
|
|
1
|
+
{"version":3,"names":["d","$","s","el","querySelector","$$","querySelectorAll","tpl","createElement","book","length","className","innerHTML","box","box_body","H","box_cls","newPage","insertAdjacentHTML","cloneNode","children","classList","add","removeBlank","v","innerText","trim","remove","fill","contains","after","childElementCount","append","slice","scrollHeight","box2","box_body2","lastElementChild","fragment","container","parent","page","box_cur","el2","tagName","firstElementChild","indexOf","item","firstChild","insertBefore","lastChild","shortTitle","h","dataset","main","ps","tb","map","i","getComputedStyle","documentElement","getPropertyValue","replace","paginate","cls","body","insertAdjacentElement","clientHeight","window","innerHeight","forEach","filter","nextElementSibling","toc","a","n","nextSibling","pageNumber","page_title","N","pagesOffset","Math","ceil","m","concat","offsetHeight","reduce","m1","m2","newPages","n2","calcPages","info","mainTitle","pageTitle","ft","key","pop","p","getAttribute","addEventListener","pg","sessionStorage","getItem","e","setItem","location","reload","document"],"sources":["pages.js"],"mappings":"AAEA,CAACA,IACC,SAAUC,EAAEC,EAAGC,EAAKH,GAAK,OAAOG,GAAIC,cAAcF,EAAI,CACtD,SAASG,EAAGH,EAAGC,EAAKH,GAAK,OAAOG,EAAKA,EAAGG,iBAAiBJ,GAAK,EAAI,CA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,UAAahB,GAOnD,IAAIiB,EALJ,CAAClF,EAAIO,SAAS,GAAIP,EAAIO,SAAS,IAAIkD,SAAQnE,IACzC,IAAK,MAAM6F,KAAOJ,EAAMA,EAAKI,KAAS7F,EAAGkD,QAAQ2C,GAAOJ,EAAKI,GAAK,IAGpElB,EAAa3B,EAAW,IAAI9C,EAAGkD,EAAI1C,IAAMoF,QAAUnB,EAGnDzE,EAAG,aAAcQ,GAAKyD,SAAQ,CAACnE,EAAIuD,KAC3B,IAANA,GAAWqC,EAAK5F,EAAIU,EAAIO,SAAS,GAAGU,MAAM3B,KAAQ4F,EAAG/D,UAAU7B,EAAGiB,UAAWjB,EAAGwB,SAAS,GACzF,IAIJtB,EAAG,eAAgBoE,GAAKH,SAAQI,IAC9B,MAAMwB,EAAIjG,EAAE,qBAAqByE,EAAEyB,aAAa,4BAChDzB,EAAErB,QAAQwB,WAAaqB,EAAIA,EAAE7C,QAAQwB,WAAa,EAAE,GAExD,CACAuB,iBAAiB,cAAerC,GAEhC,IAAIsC,EAAKC,eAAeC,QAAQ,WAChCF,GAAMtC,IACNqC,iBAAiB,YAAYI,GAAe,MAAVA,EAAER,MAClCjC,IAAYsC,EAAKA,EAAK,GAAK,IAAKC,eAAeG,QAAQ,UAAWJ,GAAKA,GAAMK,SAASC,WAEzF,EAhLD,CAgLGC","ignoreList":[]}
|
package/package.json
CHANGED
package/purge.sh
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
# purge jsdevlivr cache for assets modified between current and previous tags
|
|
4
|
+
JSD_URL="https://purge.jsdelivr.net/npm/@xiee/utils"
|
|
5
|
+
|
|
6
|
+
tag2=$(git describe --tags --abbrev=0)
|
|
7
|
+
tag1=$(git describe --tags --abbrev=0 "$tag2^")
|
|
8
|
+
for i in $(git diff --name-only $tag1 $tag2 | grep -E "[.](css|js)$"); do
|
|
9
|
+
curl "${JSD_URL}/${i}"
|
|
10
|
+
curl "${JSD_URL}/${i%.*}.min.${i##.}"
|
|
11
|
+
done
|