Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@xiee/utils

Package Overview
Dependencies
Maintainers
0
Versions
173
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xiee/utils - npm Package Compare versions

Comparing version 1.13.4 to 1.13.5

2

js/pages.js

@@ -93,2 +93,3 @@ // move elements into page boxes such that each box contains as many elements as

cls.add('pagesjs-filling');
// iteratively add elements to pages

@@ -105,2 +106,3 @@ $$('.frontmatter, #TOC, .abstract').forEach(el => {

});
cls.remove('pagesjs-filling');
// clean up an empty div for books

@@ -107,0 +109,0 @@ book && removeBlank(box.nextElementSibling);

2

js/pages.min.js

@@ -1,1 +0,1 @@

(e=>{function t(t,n=e){return n?.querySelector(t)}function n(t,n=e){return n?n.querySelectorAll(t):[]}const r=e.createElement("div"),a=n("h1").length>1;let s,i,o;function c(e){return s=e||r.cloneNode(!0),i=s.children[1],s}function l(e){if(!e)return!1;const t=""===e.innerText.trim();return t&&e.remove(),t}function d(e){if(e.classList.contains("pagesjs-page"))return s.after(e),!t(".pagesjs-body",e)&&e.insertAdjacentHTML("afterbegin",r.innerHTML),e.childElementCount>3?(e.children[1].append(...[...e.children].slice(3)),e.after(c())):c(e),e;if(s.scrollHeight>o){const e=r.cloneNode(!0),t=e.children[1];s.after(e),i.childElementCount>1&&t.append(i.lastElementChild),[s,i]=[e,t]}return i.append(e),s}function p(e){return e&&(e.dataset.shortTitle||e.innerText)}r.className="pagesjs-page",r.innerHTML='<div class="pagesjs-header"></div>\n<div class="pagesjs-body"></div>\n<div class="pagesjs-footer"></div>';const f=p(t("h1.title, .frontmatter h1, .title, h1")),h=(a?"h1":"h2")+":not(.frontmatter *)",g=["top","bottom"].map((t=>+getComputedStyle(e.documentElement).getPropertyValue(`--paper-margin-${t}`).replace("px","")||0));function u(){const r=e.body.classList;if(r.contains("pagesjs"))return;r.add("pagesjs"),a&&r.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")})),n(".frontmatter, #TOC, .abstract").forEach((e=>{a?(i.append(e),s.after(c())):d(e)})),n(".body").forEach((e=>{const t=["chapter","appendix"].filter((t=>e.classList.contains(t)));a&&""!==s.innerText&&s.after(c()),[...e.children].map((e=>d(e).classList.add(...t))),0===e.childElementCount&&e.remove()})),a&&l(s.nextElementSibling);const u=t("#TOC");n('a[href^="#"]',u).forEach((t=>{const n=e.createElement("span"),r=t.firstElementChild;for(r?.classList.contains("section-number")?r.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 m,b=0;n(".pagesjs-page").forEach((e=>{if(l(e))return;a&&t(h,e)&&(m="");const r=function(e){let t=+e.dataset.pagesOffset;if(t)return t;const r=e.scrollHeight;if(t=Math.ceil(r/o),t<=1)return t;const a=g.concat([...n("thead",e)].map((e=>+e.offsetHeight))).reduce(((e,t)=>e+t));if(!a)return t;function s(){return Math.ceil((r+(t-1)*a)/o)}let i=s();for(;i>t;)t=i,i=s();return t}(e);r>1&&e.classList.add("page-multiple"),b+=r;const s={pageNumber:b,mainTitle:f,pageTitle:m};let i;[e.children[0],e.children[2]].forEach((e=>{for(const t in s)s[t]&&(e.dataset[t]=s[t])})),m=p([...n(h,e)].pop())||m,n(".footnotes",e).forEach(((t,n)=>{0===n?(i=t,e.children[1].after(t)):(i.append(...t.children),t.remove())}))})),n('a[href^="#"]',u).forEach((e=>{const n=t(`.pagesjs-page:has(${e.getAttribute("href")}) .pagesjs-header`);e.dataset.pageNumber=n?n.dataset.pageNumber:""}))}addEventListener("beforeprint",u);let m=sessionStorage.getItem("pagesjs");m&&u(),addEventListener("keypress",(e=>"p"===e.key&&(u(),m=m?"":"1",sessionStorage.setItem("pagesjs",m),m||location.reload())))})(document);
(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 l(e){if(!e)return!1;const t=""===e.innerText.trim();return t&&e.remove(),t}function d(e){if(e.classList.contains("pagesjs-page"))return s.after(e),!t(".pagesjs-body",e)&&e.insertAdjacentHTML("afterbegin",a.innerHTML),e.childElementCount>3?(e.children[1].append(...[...e.children].slice(3)),e.after(c())):c(e),e;if(s.scrollHeight>o){const e=a.cloneNode(!0),t=e.children[1];s.after(e),i.childElementCount>1&&t.append(i.lastElementChild),[s,i]=[e,t]}return i.append(e),s}function p(e){return e&&(e.dataset.shortTitle||e.innerText)}a.className="pagesjs-page",a.innerHTML='<div class="pagesjs-header"></div>\n<div class="pagesjs-body"></div>\n<div class="pagesjs-footer"></div>';const f=p(t("h1.title, .frontmatter h1, .title, h1")),g=(r?"h1":"h2")+":not(.frontmatter *)",h=["top","bottom"].map((t=>+getComputedStyle(e.documentElement).getPropertyValue(`--paper-margin-${t}`).replace("px","")||0));function u(){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=>{r?(i.append(e),s.after(c())):d(e)})),n(".body").forEach((e=>{const t=["chapter","appendix"].filter((t=>e.classList.contains(t)));r&&""!==s.innerText&&s.after(c()),[...e.children].map((e=>d(e).classList.add(...t))),0===e.childElementCount&&e.remove()})),a.remove("pagesjs-filling"),r&&l(s.nextElementSibling);const u=t("#TOC");n('a[href^="#"]',u).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 m,b=0;n(".pagesjs-page").forEach((e=>{if(l(e))return;r&&t(g,e)&&(m="");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=h.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"),b+=a;const s={pageNumber:b,mainTitle:f,pageTitle:m};let i;[e.children[0],e.children[2]].forEach((e=>{for(const t in s)s[t]&&(e.dataset[t]=s[t])})),m=p([...n(g,e)].pop())||m,n(".footnotes",e).forEach(((t,n)=>{0===n?(i=t,e.children[1].after(t)):(i.append(...t.children),t.remove())}))})),n('a[href^="#"]',u).forEach((e=>{const n=t(`.pagesjs-page:has(${e.getAttribute("href")}) .pagesjs-header`);e.dataset.pageNumber=n?n.dataset.pageNumber:""}))}addEventListener("beforeprint",u);let m=sessionStorage.getItem("pagesjs");m&&u(),addEventListener("keypress",(e=>"p"===e.key&&(u(),m=m?"":"1",sessionStorage.setItem("pagesjs",m),m||location.reload())))})(document);
{
"name": "@xiee/utils",
"version": "1.13.4",
"version": "1.13.5",
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc