@xiee/utils 1.3.20 → 1.4.0

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/README.md CHANGED
@@ -56,6 +56,13 @@ Add `[ ]` to footnote numbers and move the return symbols in footnotes.
56
56
 
57
57
  Fix the table of contents generated by lower versions of Hugo.
58
58
 
59
+ ## fold-details.js
60
+
61
+ Move elements into `<details>` so that they can be folded. By default, code
62
+ blocks (`<pre>`) are folded. Other elements can also be folded via custom
63
+ options. See [this post](https://yihui.org/en/2023/09/code-folding/) for more
64
+ information.
65
+
59
66
  ## fullwidth.js
60
67
 
61
68
  Find `<pre>`, `<table>`, and TOC (with ID `TableOfContents`) elements and add
package/js/center-img.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(d) {
1
+ (d => {
2
2
  function one_child(el) {
3
3
  if (el.childElementCount !== 1) return false;
4
4
  const nodes = el.childNodes;
@@ -1 +1 @@
1
- !function(e){function t(e){if(1!==e.childElementCount)return!1;const t=e.childNodes;if(1===t.length)return!0;for(let e in t){let n=t[e];if("#text"===n.nodeName&&!/^\s$/.test(n.textContent))return!1}return!0}["img","embed","object"].forEach((function(n){e.querySelectorAll(n).forEach((e=>{let r=e.parentElement;if(t(r)){const o="A"===r.nodeName;if(o){if(r=r.parentElement,!t(r))return;r.firstElementChild.style.border="none"}"P"===r.nodeName&&(r.style.textAlign="center",o||"img"!==n||(r.innerHTML=`<a href="${e.src}" style="border: none;">${e.outerHTML}</a>`))}}))})),e.querySelectorAll("p").forEach((e=>{"* * *"===e.innerText&&(e.style.textAlign="center")}))}(document);
1
+ (e=>{function t(e){if(1!==e.childElementCount)return!1;const t=e.childNodes;if(1===t.length)return!0;for(let e in t){let n=t[e];if("#text"===n.nodeName&&!/^\s$/.test(n.textContent))return!1}return!0}["img","embed","object"].forEach((function(n){e.querySelectorAll(n).forEach((e=>{let r=e.parentElement;if(t(r)){const l="A"===r.nodeName;if(l){if(r=r.parentElement,!t(r))return;r.firstElementChild.style.border="none"}"P"===r.nodeName&&(r.style.textAlign="center",l||"img"!==n||(r.innerHTML=`<a href="${e.src}" style="border: none;">${e.outerHTML}</a>`))}}))})),e.querySelectorAll("p").forEach((e=>{"* * *"===e.innerText&&(e.style.textAlign="center")}))})(document);
@@ -1,4 +1,4 @@
1
- (function(d) {
1
+ (d => {
2
2
  const r = /^(https?:)?\/\//;
3
3
  d.querySelectorAll('a').forEach(a => {
4
4
  if (!r.test(a.getAttribute('href'))) return;
@@ -1 +1 @@
1
- !function(e){const t=/^(https?:)?\/\//;e.querySelectorAll("a").forEach((e=>{t.test(e.getAttribute("href"))&&(e.target="_blank",0===e.childElementCount&&t.test(e.innerText)&&(e.innerText=e.innerText.replace(t,"").replace(/(.+)#.*$/,"$1")))}))}(document);
1
+ (e=>{const t=/^(https?:)?\/\//;e.querySelectorAll("a").forEach((e=>{t.test(e.getAttribute("href"))&&(e.target="_blank",0===e.childElementCount&&t.test(e.innerText)&&(e.innerText=e.innerText.replace(t,"").replace(/(.+)#.*$/,"$1")))}))})(document);
package/js/faq.js CHANGED
@@ -1,4 +1,4 @@
1
- ((d) => {
1
+ (d => {
2
2
  const cls_list = 'faq-list', cls_clicked = 'faq-clicked';
3
3
  function faq(el, id) {
4
4
  // each child of the list must have at least 2 child elements (one question
@@ -1,4 +1,4 @@
1
- (function(d) {
1
+ (d => {
2
2
  // add [] to footnote numbers
3
3
  d.querySelectorAll('sup[id^="fnref:"] > a.footnote-ref, a.footnote-ref > sup').forEach(el => {
4
4
  if (/^[0-9]+$/.test(el.innerText)) el.innerText = ' [' + el.innerText + ']';
@@ -1 +1 @@
1
- !function(e){e.querySelectorAll('sup[id^="fnref:"] > a.footnote-ref, a.footnote-ref > sup').forEach((e=>{/^[0-9]+$/.test(e.innerText)&&(e.innerText=" ["+e.innerText+"]")})),e.querySelectorAll(".footnotes > ol > li > p ~ .footnote-return").forEach((e=>{e.previousElementSibling.lastChild.after(e)}))}(document);
1
+ (e=>{e.querySelectorAll('sup[id^="fnref:"] > a.footnote-ref, a.footnote-ref > sup').forEach((e=>{/^[0-9]+$/.test(e.innerText)&&(e.innerText=" ["+e.innerText+"]")})),e.querySelectorAll(".footnotes > ol > li > p ~ .footnote-return").forEach((e=>{e.previousElementSibling.lastChild.after(e)}))})(document);
@@ -0,0 +1,31 @@
1
+ // fold elements with <details>: https://yihui.org/en/2023/09/code-folding/
2
+ (d => {
3
+ const cfg = d.currentScript?.dataset, cls = 'folder';
4
+ d.querySelectorAll(cfg?.selector || 'pre>code[class]').forEach(el => {
5
+ const s1 = d.createElement('details'), s2 = d.createElement('summary');
6
+ s1.className = cls; s1.open = cfg?.open;
7
+ s2.innerText = (cfg?.label || 'Details') + (cfg?.tagName ? ` <${el.tagName}>` : '');
8
+ // special case: for <code>, put its parent <pre> inside <details>
9
+ if (el.tagName === 'CODE' && el.parentNode.tagName === 'PRE') el = el.parentNode;
10
+ s1.append(s2);
11
+ el.before(s1);
12
+ s1.append(el);
13
+ });
14
+
15
+ // add a button to the page to toggle all <details> elements
16
+ if (!cfg?.hasOwnProperty('button')) return;
17
+ const p = d.querySelector(cfg.parent);
18
+ let btn = d.querySelector(cfg.button);
19
+ if (!btn && !p) return; // must provide either a button or a container
20
+ if (!btn) {
21
+ btn = d.createElement('button');
22
+ btn.id = 'toggle-all';
23
+ btn.innerText = cfg.label || 'Toggle Details';
24
+ p.insertAdjacentElement(cfg.position || 'afterbegin', btn);
25
+ }
26
+ btn.onclick = (e) => {
27
+ d.querySelectorAll(`details.${cls}`).forEach(el => {
28
+ el.toggleAttribute('open');
29
+ });
30
+ };
31
+ })(document);
@@ -0,0 +1 @@
1
+ (e=>{const t=e.currentScript?.dataset,a="folder";if(e.querySelectorAll(t?.selector||"pre>code[class]").forEach((r=>{const l=e.createElement("details"),n=e.createElement("summary");l.className=a,l.open=t?.open,n.innerText=(t?.label||"Details")+(t?.tagName?` <${r.tagName}>`:""),"CODE"===r.tagName&&"PRE"===r.parentNode.tagName&&(r=r.parentNode),l.append(n),r.before(l),l.append(r)})),!t?.hasOwnProperty("button"))return;const r=e.querySelector(t.parent);let l=e.querySelector(t.button);(l||r)&&(l||(l=e.createElement("button"),l.id="toggle-all",l.innerText=t.label||"Toggle Details",r.insertAdjacentElement(t.position||"afterbegin",l)),l.onclick=t=>{e.querySelectorAll(`details.${a}`).forEach((e=>{e.toggleAttribute("open")}))})})(document);
package/js/fuse-search.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // perform searching via Fuse.js with data from /index.json
2
- (function(d) {
2
+ (d => {
3
3
  const input = d.querySelector('#search-input'),
4
4
  output = d.querySelector('.search-results');
5
5
  if (!input || !output) return;
@@ -1 +1 @@
1
- !function(e){const t=e.querySelector("#search-input"),n=e.querySelector(".search-results");if(!t||!n)return;const i=t.dataset;let o;function r(e,t,n){let i;for(let n of e.matches)n.key===t&&(i=n.indices);const o=e.item[t];if(!i)return o.substr(0,n);let r,s,c=0,l=Math.ceil(n/2);for(;s=i.shift();)s[1]-s[0]>=c&&(r=s,c=r[1]-r[0]);return(r[0]-l>0?"[...] ":"")+o.substring(r[0]-l,r[0])+"<b>"+o.substring(r[0],r[1]+1)+"</b>"+o.substring(r[1]+1,r[1]+1+l)+(r[1]+1+l<o.length?" [...] ":"")}t.addEventListener("focus",(e=>{if(o)return;t.placeholder=i.infoInit||"Loading search index... Please hold on.";const n=new XMLHttpRequest;n.responseType="json",n.addEventListener("load",(e=>{const r=n.response;r&&0!==r.length?(t.placeholder=i.infoOk||"Type to search:",t.focus(),o=new Fuse(r,{keys:[{name:"title",weight:5},"content"],useExtendedSearch:!0,includeMatches:!0,ignoreLocation:!0,threshold:.1})):t.placeholder=i.infoFail||"Failed to load search index!"}),!1),n.open("GET",i.indexUrl||"/index.json"),n.send(null)}));const s=i.textLength||300,c=i.limit||50,l=i.delay||500,a=n.firstElementChild.cloneNode(!0);function u(){if(o){n.innerHTML="";for(let e of o.search(t.value,{limit:c})){const t=a.cloneNode(!0),i=t.querySelector("a");i.href=e.item.uri,i.innerHTML=r(e,"title",s),t.querySelector(".search-preview").innerHTML=r(e,"content",s),n.appendChild(t)}}}n.innerHTML="";const d=/Mobi/i.test(navigator.userAgent);t.addEventListener(d?"change":"input",d?u:function(e,t){let n;return function(...i){clearTimeout(n),n=setTimeout((()=>e(...i)),t)}}(u,l))}(document);
1
+ (e=>{const t=e.querySelector("#search-input"),n=e.querySelector(".search-results");if(!t||!n)return;const i=t.dataset;let o;function r(e,t,n){let i;for(let n of e.matches)n.key===t&&(i=n.indices);const o=e.item[t];if(!i)return o.substr(0,n);let r,s,l=0,c=Math.ceil(n/2);for(;s=i.shift();)s[1]-s[0]>=l&&(r=s,l=r[1]-r[0]);return(r[0]-c>0?"[...] ":"")+o.substring(r[0]-c,r[0])+"<b>"+o.substring(r[0],r[1]+1)+"</b>"+o.substring(r[1]+1,r[1]+1+c)+(r[1]+1+c<o.length?" [...] ":"")}t.addEventListener("focus",(e=>{if(o)return;t.placeholder=i.infoInit||"Loading search index... Please hold on.";const n=new XMLHttpRequest;n.responseType="json",n.addEventListener("load",(e=>{const r=n.response;r&&0!==r.length?(t.placeholder=i.infoOk||"Type to search:",t.focus(),o=new Fuse(r,{keys:[{name:"title",weight:5},"content"],useExtendedSearch:!0,includeMatches:!0,ignoreLocation:!0,threshold:.1})):t.placeholder=i.infoFail||"Failed to load search index!"}),!1),n.open("GET",i.indexUrl||"/index.json"),n.send(null)}));const s=i.textLength||300,l=i.limit||50,c=i.delay||500,a=n.firstElementChild.cloneNode(!0);function u(){if(o){n.innerHTML="";for(let e of o.search(t.value,{limit:l})){const t=a.cloneNode(!0),i=t.querySelector("a");i.href=e.item.uri,i.innerHTML=r(e,"title",s),t.querySelector(".search-preview").innerHTML=r(e,"content",s),n.appendChild(t)}}}n.innerHTML="";const d=/Mobi/i.test(navigator.userAgent);t.addEventListener(d?"change":"input",d?u:function(e,t){let n;return function(...i){clearTimeout(n),n=setTimeout((()=>e(...i)),t)}}(u,c))})(document);
package/js/hash-notes.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // convert <!--# comments --> to <span class="hash-notes">comments</span>
2
- (function(d) {
2
+ (d => {
3
3
  function toSpan(el) {
4
4
  const t = el.textContent, r = /^#[\s\n]+([\s\S]+)[\s\n]+$/;
5
5
  if (!r.test(t)) return;
@@ -1 +1 @@
1
- !function(e){!function n(t){t.childNodes.forEach((t=>{t.nodeType===Node.COMMENT_NODE?function(n){const t=n.textContent,a=/^#[\s\n]+([\s\S]+)[\s\n]+$/;if(!a.test(t))return;e.body.classList.add("has-notes","hide-notes");const o=e.createElement("P"===n.parentNode.nodeName?"span":"p");o.className="hash-note",o.innerText=t.replace(a,"$1"),o.innerHTML=o.innerHTML.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2">$1</a>').replace(/(^|[^"])(https?:\/\/)([-a-zA-Z0-9%._=/\+]+)(#)?([-a-zA-Z0-9%._=\+]+)?/g,'$1<a href="$2$3$4$5">$3$4</a>'),n.before(o),n.remove()}(t):n(t)}))}(e.body)}(document);
1
+ (e=>{!function n(t){t.childNodes.forEach((t=>{t.nodeType===Node.COMMENT_NODE?function(n){const t=n.textContent,a=/^#[\s\n]+([\s\S]+)[\s\n]+$/;if(!a.test(t))return;e.body.classList.add("has-notes","hide-notes");const o=e.createElement("P"===n.parentNode.nodeName?"span":"p");o.className="hash-note",o.innerText=t.replace(a,"$1"),o.innerHTML=o.innerHTML.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2">$1</a>').replace(/(^|[^"])(https?:\/\/)([-a-zA-Z0-9%._=/\+]+)(#)?([-a-zA-Z0-9%._=\+]+)?/g,'$1<a href="$2$3$4$5">$3$4</a>'),n.before(o),n.remove()}(t):n(t)}))}(e.body)})(document);
@@ -1,16 +1,14 @@
1
- (function(d) {
1
+ (d => {
2
2
  // https://www.kirupa.com/html5/detect_whether_font_is_installed.htm
3
- var canvas = d.createElement("canvas");
4
- var context = canvas.getContext("2d");
5
- var text = "abcdefghijklmnopqrstuvwxyz0123456789";
3
+ const canvas = d.createElement("canvas"), context = canvas.getContext("2d"),
4
+ text = "abcdefghijklmnopqrstuvwxyz0123456789";
6
5
  context.font = "72px monospace";
7
- var size = context.measureText(text).width;
8
- var fonts = [' SC', ' CN', ' TC', ' TW', ''];
9
- for (var i = 0; i < fonts.length; i++) {
10
- context.font = "72px '" + 'Source Han Serif' + fonts[i] + "', monospace";
6
+ const size = context.measureText(text).width;
7
+ for (let font of [' SC', ' CN', ' TC', ' TW', '']) {
8
+ context.font = `72px 'Source Han Serif ${font}', monospace`;
11
9
  // no need to load TypeKit if Source Hans Serif has been installed
12
10
  if (context.measureText(text).width != size) return;
13
11
  }
14
- var config = {kitId: 'kwz5xar', scriptTimeout: 3000, async: true},
12
+ let config = {kitId: 'kwz5xar', scriptTimeout: 3000, async: true},
15
13
  h=d.documentElement,t=setTimeout(function(){h.className=h.className.replace(/\bwf-loading\b/g,"")+" wf-inactive";},config.scriptTimeout),tk=d.createElement("script"),f=false,s=d.getElementsByTagName("script")[0],a;h.className+=" wf-loading";tk.src='https://use.typekit.net/'+config.kitId+'.js';tk.async=true;tk.onload=tk.onreadystatechange=function(){a=this.readyState;if(f||a&&a!="complete"&&a!="loaded")return;f=true;clearTimeout(t);try{Typekit.load(config)}catch(e){}};s.parentNode.insertBefore(tk,s)
16
14
  })(document);
@@ -1 +1 @@
1
- !function(e){var t=e.createElement("canvas").getContext("2d"),a="abcdefghijklmnopqrstuvwxyz0123456789";t.font="72px monospace";for(var n=t.measureText(a).width,c=[" SC"," CN"," TC"," TW",""],o=0;o<c.length;o++)if(t.font="72px 'Source Han Serif"+c[o]+"', monospace",t.measureText(a).width!=n)return;var i,r={kitId:"kwz5xar",scriptTimeout:3e3,async:!0},s=e.documentElement,m=setTimeout((function(){s.className=s.className.replace(/\bwf-loading\b/g,"")+" wf-inactive"}),r.scriptTimeout),d=e.createElement("script"),l=!1,p=e.getElementsByTagName("script")[0];s.className+=" wf-loading",d.src="https://use.typekit.net/"+r.kitId+".js",d.async=!0,d.onload=d.onreadystatechange=function(){if(i=this.readyState,!(l||i&&"complete"!=i&&"loaded"!=i)){l=!0,clearTimeout(m);try{Typekit.load(r)}catch(e){}}},p.parentNode.insertBefore(d,p)}(document);
1
+ (e=>{const t=e.createElement("canvas").getContext("2d"),a="abcdefghijklmnopqrstuvwxyz0123456789";t.font="72px monospace";const n=t.measureText(a).width;for(let e of[" SC"," CN"," TC"," TW",""])if(t.font=`72px 'Source Han Serif ${e}', monospace`,t.measureText(a).width!=n)return;let o,c={kitId:"kwz5xar",scriptTimeout:3e3,async:!0},s=e.documentElement,i=setTimeout((function(){s.className=s.className.replace(/\bwf-loading\b/g,"")+" wf-inactive"}),c.scriptTimeout),r=e.createElement("script"),m=!1,l=e.getElementsByTagName("script")[0];s.className+=" wf-loading",r.src="https://use.typekit.net/"+c.kitId+".js",r.async=!0,r.onload=r.onreadystatechange=function(){if(o=this.readyState,!(m||o&&"complete"!=o&&"loaded"!=o)){m=!0,clearTimeout(i);try{Typekit.load(c)}catch(e){}}},l.parentNode.insertBefore(r,l)})(document);
@@ -1,15 +1,8 @@
1
- (function() {
2
- var i, cls, code, codes = document.getElementsByTagName('pre');
3
- for (i = 0; i < codes.length; i++) {
4
- code = codes[i];
5
- if (code.children.length !== 1) continue;
6
- code = code.children[0];
7
- if (code.tagName !== 'CODE') continue;
8
- cls = code.className;
9
- if (cls === '' || cls === 'hljs') {
10
- code.className = 'nohighlight';
11
- } else if (/^language-/.test(cls) && !/hljs/.test(cls)) {
12
- code.className += ' hljs';
13
- }
1
+ document.querySelectorAll('pre > code:only-child').forEach(code => {
2
+ const cls = code.className;
3
+ if (cls === '' || cls === 'hljs') {
4
+ code.className = 'nohighlight';
5
+ } else if (/^language-/.test(cls) && !/hljs/.test(cls)) {
6
+ code.className += ' hljs';
14
7
  }
15
- })();
8
+ })
@@ -1 +1 @@
1
- !function(){var e,a,l,s=document.getElementsByTagName("pre");for(e=0;e<s.length;e++)1===(l=s[e]).children.length&&"CODE"===(l=l.children[0]).tagName&&(""===(a=l.className)||"hljs"===a?l.className="nohighlight":/^language-/.test(a)&&!/hljs/.test(a)&&(l.className+=" hljs"))}();
1
+ document.querySelectorAll("pre > code:only-child").forEach((l=>{const e=l.className;""===e||"hljs"===e?l.className="nohighlight":/^language-/.test(e)&&!/hljs/.test(e)&&(l.className+=" hljs")}));
package/js/post-nav.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // navigate to previous/next posts by Left/Right arrows, and Alt + <-/-> for back/forward
2
- (function(d) {
2
+ (d => {
3
3
  const a1 = d.querySelector('.nav-prev > a'), a2 = d.querySelector('.nav-next > a');
4
4
  d.addEventListener('keyup', function(e) {
5
5
  if (e.target.nodeName.toUpperCase() != 'BODY') return;
@@ -1 +1 @@
1
- !function(e){const r=e.querySelector(".nav-prev > a"),t=e.querySelector(".nav-next > a");e.addEventListener("keyup",(function(e){if("BODY"!=e.target.nodeName.toUpperCase())return;let n;"ArrowLeft"===e.key?e.altKey?history.back():r&&(n=r.href):"ArrowRight"==e.key&&(e.altKey?history.forward():t&&(n=t.href)),n&&(window.location=n)}));const n=e.querySelectorAll(".unlist");if(0===n.length)return;if(null!==sessionStorage.getItem("hide-notes"))return n.forEach((e=>e.classList.remove("unlist")));r&&t&&(window.location=e.referrer===t.href?r.href:t.href)}(document);
1
+ (e=>{const r=e.querySelector(".nav-prev > a"),t=e.querySelector(".nav-next > a");e.addEventListener("keyup",(function(e){if("BODY"!=e.target.nodeName.toUpperCase())return;let o;"ArrowLeft"===e.key?e.altKey?history.back():r&&(o=r.href):"ArrowRight"==e.key&&(e.altKey?history.forward():t&&(o=t.href)),o&&(window.location=o)}));const o=e.querySelectorAll(".unlist");if(0===o.length)return;if(null!==sessionStorage.getItem("hide-notes"))return o.forEach((e=>e.classList.remove("unlist")));r&&t&&(window.location=e.referrer===t.href?r.href:t.href)})(document);
package/js/right-quote.js CHANGED
@@ -1,5 +1,5 @@
1
- // right-align a quote footer if it starts with ---
2
- [...document.getElementsByTagName('blockquote')].forEach(quote => {
3
- const el = quote.lastElementChild;
4
- if (el?.tagName === 'P' && /^(—|―|---)/.test(el.textContent)) el.style.textAlign = 'right';
1
+ // originally to right-align a quote footer if it starts with ---; now it just
2
+ // right-align all paragraphs that start with em-dashes
3
+ [...document.getElementsByTagName('p')].forEach(p => {
4
+ if (/^(—|―|---)/.test(p.textContent)) p.style.textAlign = 'right';
5
5
  });
@@ -1 +1 @@
1
- [...document.getElementsByTagName("blockquote")].forEach((t=>{const e=t.lastElementChild;"P"===e?.tagName&&/^(—|―|---)/.test(e.textContent)&&(e.style.textAlign="right")}));
1
+ [...document.getElementsByTagName("p")].forEach((t=>{/^(—|―|---)/.test(t.textContent)&&(t.style.textAlign="right")}));
@@ -1,5 +1,5 @@
1
1
  // highlight a TOC item when scrolling to a corresponding section heading
2
- (function(d) {
2
+ (d => {
3
3
  // assume TOC has these possible IDs (we can also consider other selectors)
4
4
  const toc = d.querySelector('#TableOfContents, #TOC');
5
5
  if (!toc) return;
@@ -1 +1 @@
1
- !function(e){const t=e.querySelector("#TableOfContents, #TOC");if(!t)return;const r=t.querySelectorAll("a");if(!r.length)return;const n=new IntersectionObserver((e=>e.forEach((e=>{const t=e.target.id;t&&e.isIntersecting&&r.forEach((e=>{e.classList[e.getAttribute("href")==="#"+t?"add":"remove"]("active")}))}))));e.querySelectorAll("h1,h2,h3,h4,h5,h6").forEach((e=>{1===e.nodeType&&n.observe(e)}))}(document);
1
+ (e=>{const t=e.querySelector("#TableOfContents, #TOC");if(!t)return;const r=t.querySelectorAll("a");if(!r.length)return;const n=new IntersectionObserver((e=>e.forEach((e=>{const t=e.target.id;t&&e.isIntersecting&&r.forEach((e=>{e.classList[e.getAttribute("href")==="#"+t?"add":"remove"]("active")}))}))));e.querySelectorAll("h1,h2,h3,h4,h5,h6").forEach((e=>{1===e.nodeType&&n.observe(e)}))})(document);
@@ -1,4 +1,4 @@
1
- (function(d) {
1
+ (d => {
2
2
  if (!d.body.classList.contains('has-notes')) return;
3
3
  const h = d.querySelector('.author');
4
4
  if (!h) return;
@@ -1 +1 @@
1
- !function(t){if(!t.body.classList.contains("has-notes"))return;const e=t.querySelector(".author");if(!e)return;let s=sessionStorage.getItem("hide-notes");e.classList.add("toggle-notes"),e.onclick=function(e){null===s&&!/^(localhost|[0-9.]+)$/.test(location.hostname)&&alert("你好像点了个神秘开关……请勿公开,自行阅读即可(再次点击可关闭),谢谢!"),s=t.body.classList.toggle("hide-notes");try{sessionStorage.setItem("hide-notes",s)}catch(e){}},null!==s&&t.body.classList.toggle("hide-notes","true"===s)}(document);
1
+ (t=>{if(!t.body.classList.contains("has-notes"))return;const e=t.querySelector(".author");if(!e)return;let s=sessionStorage.getItem("hide-notes");e.classList.add("toggle-notes"),e.onclick=function(e){null===s&&!/^(localhost|[0-9.]+)$/.test(location.hostname)&&alert("你好像点了个神秘开关……请勿公开,自行阅读即可(再次点击可关闭),谢谢!"),s=t.body.classList.toggle("hide-notes");try{sessionStorage.setItem("hide-notes",s)}catch(e){}},null!==s&&t.body.classList.toggle("hide-notes","true"===s)})(document);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xiee/utils",
3
- "version": "1.3.20",
3
+ "version": "1.4.0",
4
4
  "description": "Miscellaneous tools and utilities to manipulate HTML pages",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"