PageSourceSearch

https://blog.xrsec.fun/js/main.js?v=5.5.4

js xrsec.fun collected 2026-09-25 21:47:54 UTC 16,161 bytes, 1 lines download raw bytes

1document.addEventListener("DOMContentLoaded",(()=>{let t,e,n=!1;const o=n=>{const o=t=>Array.from(t).reduce(((t,e)=>t+e.offsetWidth),0);if(n){const n=o(document.querySelector("#blog-info > a").children),i=o(document.getElementById("menus").children);t=n+i,e=document.getElementById("nav")}const i=window.innerWidth<=768||t>e.offsetWidth-120;e.classList.toggle("hide-menu",i)},i=()=>{btf.overflowPaddingR.add(),btf.animateIn(document.getElementById("menu-mask"),"to_show 0.5s"),document.getElementById("sidebar-menus").classList.add("open"),n=!0},s=()=>{btf.overflowPaddingR.remove(),btf.animateOut(document.getElementById("menu-mask"),"to_hide 0.5s"),document.getElementById("sidebar-menus").classList.remove("open"),n=!1},a=()=>{const t=GLOBAL_CONFIG.highlight;if(!t)return;const{highlightCopy:e,highlightLang:n,highlightHeightLimit:o,highlightFullpage:i,highlightMacStyle:s,plugin:a}=t,c=GLOBAL_CONFIG_SITE.isHighlightShrink,l=e||n||void 0!==c||i||s,r="highlight.js"!==a,d="prismjs"===a,u=r?Array.from(document.querySelectorAll('code[class*="language-"]')).map((t=>t.parentElement)):document.querySelectorAll("figure.highlight");if(!l&&!o||!u.length)return;const m=!0===c?"closed":"",g=void 0!==c?'<i class="fas fa-angle-down expand"></i>':"",f=e?'<i class="fas fa-paste copy-button"></i>':"",h=i?'<i class="fa-solid fa-up-right-and-down-left-from-center fullpage-button"></i>':"",p=(t,e)=>{if(void 0!==GLOBAL_CONFIG.Snackbar)btf.snackbarShow(e);else{const n=document.createElement("div");n.className="copy-notice",n.textContent=e,document.body.appendChild(n);const o=t.getBoundingClientRect(),i=window.pageYOffset||document.documentElement.scrollTop,s=window.pageXOffset||document.documentElement.scrollLeft,a=n.offsetWidth/2,c=o.left+s+o.width/2,l=Math.max(a+10,Math.min(window.innerWidth-a-10,c)),r=o.top+i-40,d=o.top<60||r<10?o.top+i+o.height+10:r;n.style.cssText=`\n      top: ${d+10}px;\n      left: ${l}px;\n      transform: translateX(-50%);\n      opacity: 0;\n      transition: opacity 0.3s ease, top 0.3s ease;\n    `,requestAnimationFrame((()=>{n.style.opacity="1",n.style.top=`${d}px`})),setTimeout((()=>{n.style.opacity="0",n.style.top=`${d+10}px`,setTimeout((()=>{n?.remove()}),300)}),800)}},b=(t,e)=>{const n=t.parentNode;n.classList.add("copy-true");const o=r?"pre code":"table .code pre",i=n.querySelector(o);i&&((async(t,e)=>{try{await navigator.clipboard.writeText(t),p(e,GLOBAL_CONFIG.copy.success)}catch(t){console.error("Failed to copy: ",t),p(e,GLOBAL_CONFIG.copy.noSupport)}})(i.innerText,e),n.classList.remove("copy-true"))},L=t=>{const e=t.target.classList,n=t.currentTarget;e.contains("expand")?n.classList.toggle("closed"):e.contains("copy-button")?b(n,t.target):e.contains("fullpage-button")&&((t,e)=>{const n=t.closest("figure.highlight").classList.toggle("code-fullpage");document.body.style.overflow=n?"hidden":"",e.classList.toggle("fa-down-left-and-up-right-to-center",n),e.classList.toggle("fa-up-right-and-down-left-from-center",!n)})(n,t.target)},y=t=>t.currentTarget.classList.toggle("expand-done"),v=(t,e)=>{const n=document.createDocumentFragment();if(l){const e=document.createElement("div");e.className=`highlight-tools ${m}`,e.innerHTML='<div class="macStyle"><div class="mac-close"></div><div class="mac-minimize"></div><div class="mac-maximize"></div></div>'+g+t+f+h,btf.addEventListenerPjax(e,"click",L),n.appendChild(e)}if(o&&(t=>{if(t.offsetHeight>0)return t.offsetHeight;const e=new Map;(()=>{let n=t;for(;n!==document.body&&null!=n;)"none"===window.getComputedStyle(n).display&&e.set(n,n.getAttribute("style")||""),n=n.parentNode;const o="visibility: hidden !important; display: block !important;";e.forEach(((t,e)=>{e.setAttribute("style",t?t+";"+o:o)}))})();const n=t.offsetHeight;return e.forEach(((t,e)=>{""===t?e.removeAttribute("style"):e.setAttribute("style",t)})),n})(e)>o+30){const t=document.createElement("div");t.className="code-expand-btn",t.innerHTML='<i class="fas fa-angle-double-down"></i>',btf.addEventListenerPjax(t,"click",y),n.appendChild(t)}r?e.parentNode.insertBefore(n,e):e.insertBefore(n,e.firstChild)};u.forEach((t=>{let e="";if(r){const e=d?"prismjs":"default";btf.wrap(t,"figure",{class:`highlight ${e}`})}n?(r?e=d?t.getAttribute("data-language")||"Code":t.querySelector("code").getAttribute("class").replace("language-",""):(e=t.getAttribute("class").split(" ")[1],"plain"!==e&&void 0!==e||(e="Code")),v(`<div class="code-lang">${e}</div>`,t)):v("",t)}))},c=async t=>{try{const e=await fetch(t);return await e.json()}catch(t){return console.error("Failed to fetch URL:",t),[]}},l=(t,e,n)=>{const{isButton:o,limit:i,firstLimit:s,tabs:a}=n,c=e.length,l=Math.ceil((c-s)/i+1),r=new InfiniteGrid.JustifiedInfiniteGrid(t,{gap:5,isConstantSize:!0,sizeRange:[150,600],useTransform:!0});let d=!1;const u=t=>t&&t.replace(/"/g,"&quot;")||"",m=t=>{const e=t.alt?`alt="${u(t.alt)}"`:"",n=t.title?`title="${u(t.title)}"`:"";return`<div class="item">\n        <img src="${t.url}" data-grid-maintained-target="true" ${e} ${n} />\n      </div>`},g=(t,n,o)=>{r.append(((t,n,o=!1)=>{const i=o?(t-1)*n:(t-2)*n+s;return e.slice(i,i+n).map(m)})(t,n,o),t)},f=e=>{if(a){const e=t.parentNode;d&&(e.style.visibility="visible"),0===t.offsetHeight&&(e.style.visibility="hidden",d=!0)}const{updated:n,isResize:s,mounted:c}=e;if(n.length&&c.length&&!s){if(btf.loadLightbox(t.querySelectorAll("img:not(.medium-zoom-image)")),r.getGroups().length===l)return btf.setLoading.remove(t),void(!a&&r.off("renderComplete",f));o&&(btf.setLoading.remove(t),(t=>{const e=document.createElement("button");e.innerHTML=`${GLOBAL_CONFIG.infinitegrid.buttonText}<i class="fa-solid fa-arrow-down"></i>`,e.addEventListener("click",(()=>{e.remove(),btf.setLoading.add(t),g(r.getGroups().length+1,i)}),{once:!0}),t.insertAdjacentElement("afterend",e)})(t))}},h=btf.debounce((t=>{const e=(+t.groupKey||0)+1;1===e?g(e,s,!0):g(e,i),e===l&&r.off("requestAppend",h)}),300);btf.setLoading.add(t),r.on("renderComplete",f),o?g(1,s,!0):(r.on("requestAppend",h),r.renderItems()),btf.addGlobalFn("pjaxSendOnce",(()=>r.destroy()))},r=async(t,e=!1)=>
1{if(!t.length)return;const n=async()=>{for(const n of t){if(btf.isHidden(n)||n.classList.contains("loaded"))continue;const t={isButton:"true"===n.getAttribute("data-button"),limit:parseInt(n.getAttribute("data-limit"),10),firstLimit:parseInt(n.getAttribute("data-first"),10),tabs:e},o=n.firstElementChild,i=o.textContent;o.textContent="",n.classList.add("loaded");try{const e="url"===n.getAttribute("data-type")?await c(i):JSON.parse(i);l(o,e,t)}catch(t){console.error("Gallery data parsing failed:",t)}}};"function"==typeof InfiniteGrid||await btf.getScript(GLOBAL_CONFIG.infinitegrid.js),await n()},d=()=>{const t=document.getElementById("rightside"),e=window.innerHeight+56;let n=0;const o=document.getElementById("page-header"),i="undefined"!=typeof chatBtn,s=GLOBAL_CONFIG.percent.rightside,a=()=>document.body.scrollHeight<=e&&(t.classList.add("rightside-show"),!0);if(a())return;let c="";const l=btf.throttle((()=>{const e=window.scrollY||document.documentElement.scrollTop,l=(t=>{const e=t>n;return n=t,e})(e);e>56?(""===c&&(o.classList.add("nav-fixed"),t.classList.add("rightside-show")),l?"down"!==c&&(o.classList.remove("nav-visible"),i&&window.chatBtn.hide(),c="down"):"up"!==c&&(o.classList.add("nav-visible"),i&&window.chatBtn.show(),c="up")):(c="",0===e&&o.classList.remove("nav-fixed","nav-visible"),t.classList.remove("rightside-show")),s&&(t=>{const e=btf.getScrollPercent(t,document.body),n=document.getElementById("go-up");e<95?(n.classList.add("show-percent"),n.querySelector(".scroll-percent").textContent=e):n.classList.remove("show-percent")})(e),a()}),300);btf.addEventListenerPjax(window,"scroll",l,{passive:!0})},u=()=>{const t=GLOBAL_CONFIG_SITE.isToc,e=GLOBAL_CONFIG.isAnchor,n=document.getElementById("article-container");if(!n||!t&&!e)return;let o,i,s,a,c;if(t){const t=document.getElementById("card-toc");i=t.querySelector(".toc-content"),o=i.querySelectorAll(".toc-link"),a=t.querySelector(".toc-percentage"),c=i.classList.contains("is-expand");const e=e=>{const n=e.target.closest(".toc-link");n&&(e.preventDefault(),btf.scrollToDest(btf.getEleTop(document.getElementById(decodeURI(n.getAttribute("href")).replace("#",""))),300),window.innerWidth<900&&t.classList.remove("open"))};btf.addEventListenerPjax(i,"click",e),s=t=>{const e=i.clientHeight,n=t.offsetTop,o=t.clientHeight,s=i.scrollTop,a=n-s,c=(e-o)/2;a!==c&&(i.scrollTop=s+(a-c))},i.style.display="block"}const l=n.querySelectorAll("h1,h2,h3,h4,h5,h6");let r="",d=[];const u=()=>{d=Array.from(l).map((t=>({ele:t,top:btf.getEleTop(t),id:t.id})))};u(),btf.addEventListenerPjax(window,"resize",btf.throttle(u,200));const m=btf.throttle((()=>{const l=window.scrollY||document.documentElement.scrollTop;t&&GLOBAL_CONFIG.percent.toc&&(a.textContent=btf.getScrollPercent(l,n)),(n=>{if(0===n)return!1;let a="",l="";for(let t=0;t<d.length;t++){const e=d[t];if(!(n>e.top-80))break;a=e.id?"#"+encodeURI(e.id):"",l=t}if(r!==l&&(e&&btf.updateAnchor(a),r=l,t&&(i.querySelectorAll(".active").forEach((t=>t.classList.remove("active"))),a))){const t=o[l];if(t.classList.add("active"),setTimeout((()=>s(t)),0),!c){let e=t.parentNode;for(;!e.matches(".toc");)e.matches("li")&&e.classList.add("active"),e=e.parentNode}}})(l)}),100);btf.addEventListenerPjax(window,"scroll",m,{passive:!0})},m=t=>{const e=(window.globalFn||{}).themeChange||{};e&&Object.keys(e).forEach((n=>{const o=e[n];["disqus","disqusjs"].includes(n)?setTimeout((()=>o(t)),300):o(t)}))},g={readmode:()=>{const t=document.body,e=document.createElement("button"),n=()=>{t.classList.remove("read-mode"),e.remove(),e.removeEventListener("click",n)};t.classList.add("read-mode"),e.type="button",e.className="exit-readmode",e.innerHTML='<i class="fas fa-sign-out-alt"></i>',e.addEventListener("click",n),t.appendChild(e)},darkmode:()=>{const t="dark"===document.documentElement.getAttribute("data-theme")?"light":"dark";"dark"===t?(btf.activateDarkMode(),void 0!==GLOBAL_CONFIG.Snackbar&&btf.snackbarShow(GLOBAL_CONFIG.Snackbar.day_to_night)):(btf.activateLightMode(),void 0!==GLOBAL_CONFIG.Snackbar&&btf.snackbarShow(GLOBAL_CONFIG.Snackbar.night_to_day)),btf.saveToLocal.set("theme",t,2),m(t)},"rightside-config":t=>{const e=t.firstElementChild;e.classList.contains("show")&&(e.classList.add("status"),setTimeout((()=>{e.classList.remove("status")}),300)),e.classList.toggle("show")},"go-up":()=>{btf.scrollToDest(0,500)},"hide-aside-btn":()=>{const t=document.documentElement.classList,e=t.contains("hide-aside")?"show":"hide";btf.saveToLocal.set("aside-status",e,2),t.toggle("hide-aside")},"mobile-toc-button":(t,e)=>{const n=document.getElementById("card-toc");n.style.transition="transform 0.3s ease-in-out";const o=n.clientHeight,i=e.getBoundingClientRect(),s=window.innerHeight-i.bottom-30;o>s&&(n.style.transformOrigin=`right ${o-s-i.height/2}px`),n.classList.toggle("open"),n.addEventListener("transitionend",(()=>{n.style.cssText=""}),{once:!0})},"chat-btn":()=>{window.chatBtnFn()},translateLink:()=>{window.translateFn.translatePage()}};document.getElementById("rightside").addEventListener("click",(t=>{const e=t.target.closest("[id]");e&&g[e.id]&&g[e.id](t.currentTarget,e)}));const f=()=>{const t=document.querySelectorAll("#article-container .tabs");if(!t.length)return;const e=(t,e)=>{t.forEach(((t,n)=>{t.classList.toggle("active",n===e)}))},n=t=>{const n=t.target.closest("button");if(!n||n.classList.contains("active"))return;const o=[...t.currentTarget.children],i=[...t.currentTarget.nextElementSibling.children],s=o.indexOf(n);e(o,s),t.currentTarget.classList.remove("no-default"),e(i,s),r(i[s].querySelectorAll(".gallery-container"),!0)};t.forEach((t=>{btf.addEventListenerPjax(t.firstElementChild,"click",n),btf.addEventListenerPjax(t.lastElementChild,"click",(t=>e=>{e.target.closest("button")&&btf.scrollToDest(btf.getEleTop(t),300)})(t))}))},h=t=>{t.forEach((t=>{t.textContent=btf.diffDate(t.getAttribute("datetime"),!0),t.style.display="inline"}))},p=()=>{a(),GLOBAL_CONFIG.isPhotoFigcaption&&document.querySelectorAll("#article-container img").forEach((t=>{const e=t.title||t.alt;if(!e)return;const n=document.createElement("div");n.className="img-alt text-center",n.textContent=e,t.insertAdjacentElement("afterend",n)}
1)),r(document.querySelectorAll("#article-container .gallery-container")),btf.loadLightbox(document.querySelectorAll("#article-container img:not(.no-lightbox)")),u(),(()=>{const t=document.querySelectorAll("#article-container table");t.length&&t.forEach((t=>{t.closest(".highlight")||btf.wrap(t,"div",{class:"table-wrap"})}))})(),(()=>{const t=document.querySelectorAll("#article-container .hide-button");t.length&&t.forEach((t=>t.addEventListener("click",(t=>{const e=t.currentTarget;e.classList.add("open"),r(e.nextElementSibling.querySelectorAll(".gallery-container"))}),{once:!0})))})(),f()},b=()=>{o(!0),e.classList.add("show"),(()=>{const t=document.getElementById("recent-posts");if(!t||!t.classList.contains("masonry"))return;const e=()=>{const t=new InfiniteGrid.MasonryInfiniteGrid(".recent-post-items",{gap:{horizontal:10,vertical:20},useTransform:!0,useResizeObserver:!0});t.renderItems(),btf.addGlobalFn("pjaxCompleteOnce",(()=>{t.destroy()}),"removeJustifiedIndexPostUI")};"function"==typeof InfiniteGrid?e():btf.getScript(`${GLOBAL_CONFIG.infinitegrid.js}`).then(e)})(),"post"===GLOBAL_CONFIG_SITE.pageType?((()=>{const t=document.getElementById("post-outdate-notice");if(!t)return;const{limitDay:e,messagePrev:n,messageNext:o,postUpdate:i}=JSON.parse(t.getAttribute("data")),s=btf.diffDate(i);s>=e&&(t.textContent=`${n} ${s} ${o}`,t.hidden=!1)})(),GLOBAL_CONFIG.relativeDate.post&&h(document.querySelectorAll("#post-meta time"))):(GLOBAL_CONFIG.relativeDate.homepage&&h(document.querySelectorAll("#recent-posts time")),GLOBAL_CONFIG.runtime&&(()=>{const t=document.getElementById("runtimeshow");if(t){const e=t.getAttribute("data-publishDate");t.textContent=`${btf.diffDate(e)} ${GLOBAL_CONFIG.runtime}`}})(),(()=>{const t=document.getElementById("last-push-date");if(t){const e=t.getAttribute("data-lastPushDate");t.textContent=btf.diffDate(e,!0)}})(),(()=>{const t=document.querySelector("#aside-cat-list.expandBtn");if(!t)return;btf.addEventListenerPjax(t,"click",(t=>{const e=t.target;"I"===e.nodeName&&(t.preventDefault(),e.parentNode.classList.toggle("expand"))}),!0)})()),"home"===GLOBAL_CONFIG_SITE.pageType&&(()=>{const t=document.getElementById("scroll-down");t&&btf.addEventListenerPjax(t,"click",(()=>{btf.scrollToDest(document.getElementById("content-inner").offsetTop,300)}))})(),d(),p(),"shuoshuo"!==GLOBAL_CONFIG_SITE.pageType&&btf.switchComments(document),(()=>{const t=document.getElementById("toggle-menu");t&&btf.addEventListenerPjax(t,"click",(()=>{i()}))})()};btf.addGlobalFn("pjaxComplete",b,"refreshFn"),b(),(()=>{window.addEventListener("resize",(()=>{o(!1),n&&btf.isHidden(document.getElementById("toggle-menu"))&&s()}));const t=document.getElementById("menu-mask");t&&t.addEventListener("click",(()=>{s()})),(()=>{const t=document.querySelector("#sidebar-menus .menus_items");t&&t.addEventListener("click",(t=>{const e=t.target.closest(".site-page.group");e&&e.classList.toggle("hide")}))})(),GLOBAL_CONFIG.islazyloadPlugin&&(window.lazyLoadInstance=new LazyLoad({elements_selector:"img",threshold:0,data_src:"lazy-src"}),btf.addGlobalFn("pjaxComplete",(()=>{window.lazyLoadInstance.update()}),"lazyload")),void 0!==GLOBAL_CONFIG.copyright&&(()=>{const{limitCount:t,languages:e}=GLOBAL_CONFIG.copyright;document.body.addEventListener("copy",(n=>{n.preventDefault();const o=window.getSelection(0).toString();let i=o;return o.length>t&&(i=`${o}\n\n\n${e.author}\n${e.link}${window.location.href}\n${e.source}\n${e.info}`),n.clipboardData?n.clipboardData.setData("text",i):window.clipboardData.setData("text",i)}))})(),GLOBAL_CONFIG.autoDarkmode&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",(t=>{void 0===btf.saveToLocal.get("theme")&&(t.matches?m("dark"):m("light"))}))})(),window.addEventListener("hexo-blog-decrypt",(t=>{p(),window.translateFn.translateInitialization(),Object.values(window.globalFn.encrypt).forEach((t=>{t()}))}))}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.