blog-hexo/public/js/7255d631.js

1 line
6.2 KiB
JavaScript
Raw Normal View History

2023-11-15 10:21:41 +08:00
(()=>{"use strict";var e={837:()=>{document.addEventListener("DOMContentLoaded",(function(){!function(e,t){const n=document.querySelector(e);n&&document.addEventListener("selectionchange",(()=>{const e=window.getSelection();if(e&&e.rangeCount>0&&!e.isCollapsed){const o=e.getRangeAt(0);if(n.contains(o.startContainer)&&n.contains(o.endContainer)){const r=e.toString(),s=[],c=document.createNodeIterator(o.commonAncestorContainer,NodeFilter.SHOW_ELEMENT);let i;for(;i=c.nextNode();)o.intersectsNode(i)&&s.push(i);const l=s.filter((e=>n!==e));t({selectedElements:l,selectedText:r})}}}))}(".article-container article",(e=>{}))}))}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var s=t[o]={exports:{}};return e[o](s,s.exports,n),s.exports}(()=>{const e="__theme__",t=()=>{const t=localStorage.getItem(e);return null!=t?t:"light"};new class{constructor(){this.listeners={}}on(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)}off(e,t){const n=this.listeners[e];n&&(this.listeners[e]=n.filter((e=>e!==t)))}emit(e,...t){const n=this.listeners[e];n&&n.length&&n.forEach((e=>{e(...t)}))}};const o=e=>Promise.all(e.map((e=>new Promise(((t,n)=>{if("css"===e.type){const o=document.createElement("link");o.href=e.url,o.rel="stylesheet",o.onload=()=>t(),o.onerror=()=>n(new Error(`Failed to load CSS from ${e.url}`)),document.head.appendChild(o)}else if("js"===e.type){const o=document.createElement("script");o.src=e.url,e.id&&(o.id=e.id),o.onload=()=>t(),o.onerror=()=>n(new Error(`Failed to load JS from ${e.url}`)),document.body.appendChild(o)}else n(new Error("Invalid resource type specified."))}))))),r=e=>{const{enable:t,jsCdn:n,cssCdn:r}=e;t&&o([{type:"css",url:r},{type:"js",url:n}]).then((e=>{e&&(e=>{const t=/\$\$(.+?)\$\$/g,n=/\\\[(.+?)\\\]/g;function o(e,t,n){let o;const r=[];for(;null!==(o=t.exec(e.nodeValue));){const t=document.createRange();t.setStart(e,o.index),t.setEnd(e,o.index+o[0].length),r.push(t)}for(const e of r){const t=e.toString().replace(/^\$\$|\$\$$|\\\[|\\\]$/g,""),o=document.createElement("span");o.innerHTML=window.katex.renderToString(t,{throwOnError:!1,displayMode:n}),e.deleteContents(),e.insertNode(o)}}document.querySelectorAll(e).forEach((e=>{const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null);let s;for(;s=r.nextNode();)o(s,t,!1),o(s,n,!0)}))})(".article-container")}))};var s=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n};const c=e=>{const{enable:t,cdn:n}=e,r=s(e,["enable","cdn"]);t&&o([{type:"js",url:n}]).then((e=>{e&&(((e="vcomments",t=".article-container")=>{const n=document.querySelector(t);if(!n)return;const o=document.createElement("div");o.id=e,n.appendChild(o)})(),new window.Valine(Object.assign({el:"#vcomments"},r)))}))};n(837);const i='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 5H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2"></path><rect x="9" y="3" width="6" height="4" rx="2"></rect></g></svg>',l=e=>{document.querySelectorAll(".toc a").forEach((e=>e.classList.remove("active")));const t=document.querySelector('.toc a[href="'+e+'"]');t&&t.classList.add("active")};document.addEventListener("click",(function(e){const t=e.target.closest(".toc-link");if(t){const e=t.getAttribute("href");e&&l(e)}})),document.addEventListener("DOMContentLoaded",(function(){(e=>{const t=document.querySelector(e);if(t){const e=localStorage.getItem("scrolledHeight");e&&(t.scrollTop=Number(e))}})("main.scrollbar-obtrusive"),window.location.hash&&l(window.location.hash);const{mermaid:e,katex:n,valine:s}=window;r(Object.assign(Object.assign({},n),{enable:window.page.use.indexOf("katex")>-1})),(e=>{var t;const{enable:n,cdn:r,th