sinzmise-cetastories 2.0.0-1737209403959 → 2.0.0-1737366625746
Sign up to get free protection for your applications and to get access to all the features.
- package/404/index.html +1 -1
- package/404.html +1 -1
- package/archives/2021/12/index.html +1 -1
- package/archives/2021/index.html +1 -1
- package/archives/2022/12/index.html +1 -1
- package/archives/2022/index.html +1 -1
- package/archives/2023/01/index.html +1 -1
- package/archives/2023/02/index.html +1 -1
- package/archives/2023/03/index.html +1 -1
- package/archives/2023/04/index.html +1 -1
- package/archives/2023/07/index.html +1 -1
- package/archives/2023/08/index.html +1 -1
- package/archives/2023/09/index.html +1 -1
- package/archives/2023/10/index.html +1 -1
- package/archives/2023/11/index.html +1 -1
- package/archives/2023/12/index.html +1 -1
- package/archives/2023/index.html +1 -1
- package/archives/2023/page/2/index.html +1 -1
- package/archives/2023/page/3/index.html +1 -1
- package/archives/2024/01/index.html +1 -1
- package/archives/2024/02/index.html +1 -1
- package/archives/2024/03/index.html +1 -1
- package/archives/2024/04/index.html +1 -1
- package/archives/2024/05/index.html +1 -1
- package/archives/2024/06/index.html +1 -1
- package/archives/2024/07/index.html +1 -1
- package/archives/2024/08/index.html +1 -1
- package/archives/2024/09/index.html +1 -1
- package/archives/2024/10/index.html +1 -1
- package/archives/2024/11/index.html +1 -1
- package/archives/2024/12/index.html +1 -1
- package/archives/2024/index.html +1 -1
- package/archives/2024/page/2/index.html +1 -1
- package/archives/2024/page/3/index.html +1 -1
- package/archives/2025/01/index.html +1 -0
- package/archives/2025/index.html +1 -0
- package/archives/index.html +1 -1
- package/archives/page/2/index.html +1 -1
- package/archives/page/3/index.html +1 -1
- package/archives/page/4/index.html +1 -1
- package/archives/page/5/index.html +1 -1
- package/atom.xml +177 -225
- package/baidu_verify_codeva-F0RjFTve6w.html +1 -1
- package/bbs/bbs.html +1 -1
- package/bbs/index.html +1 -1
- package/categories/index.html +1 -1
- package/categories//344/270/252/344/272/272/345/260/217/350/256/260/index.html +1 -1
- package/categories//344/270/252/344/272/272/345/260/217/350/256/260/page/2/index.html +1 -1
- package/categories//344/270/252/344/272/272/345/260/217/350/256/260/page/3/index.html +1 -1
- package/categories//346/255/214/346/233/262/346/224/266/351/233/206/index.html +1 -1
- package/categories//346/270/270/346/210/217/347/233/270/345/205/263/index.html +1 -1
- package/categories//347/253/231/347/202/271/346/212/230/350/205/276/index.html +1 -1
- package/categories//347/253/231/347/202/271/346/212/230/350/205/276/page/2/index.html +1 -1
- package/categories//351/241/271/347/233/256/346/212/230/350/205/276/index.html +1 -1
- package/charts/index.html +1 -1
- package/comments/index.html +1 -1
- package/config.json +1 -0
- package/css/index.css +1 -1
- package/css/third_party/snackbar.min.css +1 -0
- package/css/third_party/tianli_talk.css +102 -0
- package/fcircle/index.html +1 -1
- package/flink_count.json +1 -1
- package/friend.json +1 -1
- package/games/index.html +1 -1
- package/games/riddle/esc2-e.html +1 -1
- package/games/riddle/esc3-e.html +1 -1
- package/games/riddle/esc4-e.html +1 -1
- package/go.html +1 -0
- package/google8073542809160a67.html +1 -1
- package/img/404.avif +0 -0
- package/img/cover.gif +0 -0
- package/img/default.avif +0 -0
- package/img/default_avatar.avif +0 -0
- package/img/error_load.avif +0 -0
- package/img/flower.gif +0 -0
- package/img/image-error.png +0 -0
- package/img/logo.png +0 -0
- package/img/pwa/favicon.png +0 -0
- package/img/pwa/favicon_16.png +0 -0
- package/index.html +1 -1
- package/js/cenguigui.js +1 -0
- package/js/covercolor/api.js +1 -0
- package/js/covercolor/ave.js +1 -0
- package/js/covercolor/local.js +1 -0
- package/js/fomal.js +1 -1
- package/js/main.js +1 -1
- package/js/music.js +1 -0
- package/js/right_menu.js +1 -0
- package/js/search/algolia.js +1 -1
- package/js/search/local.js +1 -0
- package/js/third_party/barrage.min.js +98 -0
- package/js/third_party/envelope.min.js +5 -0
- package/js/third_party/post_ai.min.js +184 -0
- package/js/third_party/universe.min.js +5 -0
- package/js/third_party/waterfall.min.js +5 -0
- package/js/tw_cn.js +1 -1
- package/js/utils.js +1 -1
- package/js/webmention/webmention-timeline.js +1 -0
- package/js/webmention/webmention.js +1 -0
- package/link/index.html +1 -1
- package/load.html +1 -1
- package/music/index.html +1 -1
- package/package.json +1 -1
- package/page/2/index.html +1 -1
- package/page/3/index.html +1 -1
- package/page/4/index.html +1 -1
- package/page/5/index.html +1 -1
- package/posts/10021/index.html +1 -1
- package/posts/10045/index.html +1 -1
- package/posts/10733/index.html +1 -1
- package/posts/10996/index.html +1 -1
- package/posts/12779/index.html +1 -1
- package/posts/13624/index.html +1 -1
- package/posts/15688/index.html +1 -1
- package/posts/15748/index.html +1 -1
- package/posts/15799/index.html +1 -1
- package/posts/15842/index.html +1 -1
- package/posts/16107/index.html +1 -1
- package/posts/18063/index.html +1 -1
- package/posts/20412/index.html +1 -1
- package/posts/21375/index.html +1 -1
- package/posts/22945/index.html +1 -1
- package/posts/23021/index.html +1 -1
- package/posts/23226/index.html +1 -1
- package/posts/27531/index.html +1 -1
- package/posts/27762/index.html +1 -1
- package/posts/28536/index.html +1 -1
- package/posts/28733/index.html +1 -1
- package/posts/29196/index.html +1 -1
- package/posts/38917/index.html +1 -1
- package/posts/38964/index.html +1 -1
- package/posts/42487/index.html +1 -1
- package/posts/42580/index.html +1 -1
- package/posts/45875/index.html +1 -1
- package/posts/46640/index.html +1 -1
- package/posts/48762/index.html +1 -1
- package/posts/50710/index.html +1 -1
- package/posts/52677/index.html +1 -1
- package/posts/53662/index.html +1 -1
- package/posts/54386/index.html +1 -1
- package/posts/54481/index.html +1 -1
- package/posts/54787/index.html +1 -1
- package/posts/56467/index.html +1 -1
- package/posts/57692/index.html +1 -1
- package/posts/58203/index.html +1 -1
- package/posts/60486/index.html +1 -0
- package/posts/61417/index.html +1 -1
- package/posts/61712/index.html +1 -1
- package/posts/61713/index.html +1 -1
- package/posts/646/index.html +1 -1
- package/posts/64856/index.html +1 -1
- package/posts/64935/index.html +1 -1
- package/posts/65382/index.html +1 -1
- package/seas/index.html +1 -1
- package/sw.js +1 -1
- package/tags/Flash/347/233/270/345/205/263/index.html +1 -1
- package/tags/Steam/346/270/270/346/210/217/index.html +1 -1
- package/tags/Windows/350/275/257/344/273/266/index.html +1 -1
- package/tags/index.html +1 -1
- package/tags//344/270/252/344/272/272/345/260/217/350/256/260/index.html +1 -1
- package/tags//344/270/252/344/272/272/345/260/217/350/256/260/page/2/index.html +1 -1
- package/tags//344/270/252/344/272/272/345/260/217/350/256/260/page/3/index.html +1 -1
- package/tags//345/205/266/345/256/203/346/270/270/346/210/217/index.html +1 -1
- package/tags//345/212/240/350/275/275/345/212/250/347/224/273/index.html +1 -1
- package/tags//346/202/254/346/265/256/345/256/240/347/211/251-/347/234/213/346/235/277/345/250/230/index.html +1 -1
- package/tags//346/255/214/346/233/262/346/224/266/351/233/206/index.html +1 -1
- package/tags//346/270/270/346/210/217/347/233/270/345/205/263/index.html +1 -1
- package/tags//347/253/231/347/202/271/345/272/225/351/203/250/351/255/224/346/224/271/index.html +1 -1
- package/tags//347/253/231/347/202/271/346/212/230/350/205/276/index.html +1 -1
- package/tags//347/253/231/347/202/271/346/212/230/350/205/276/page/2/index.html +1 -1
- package/tags//350/207/252/345/273/272/351/203/250/347/275/262/index.html +1 -1
- package/tags//351/241/265/351/235/242/351/255/224/346/224/271/index.html +1 -1
- package/tags//351/241/271/347/233/256/346/212/230/350/205/276/index.html +1 -1
- package/update/index.html +1 -1
- package/about/index.html +0 -1
- package/album/index.html +0 -1
- package/assets/404_1.jpg +0 -0
- package/assets/QRCode.jpg +0 -0
- package/assets/c10.cur +0 -0
- package/assets/c11.cur +0 -0
- package/assets/c3.cur +0 -0
- package/assets/c4.cur +0 -0
- package/assets/c7.cur +0 -0
- package/assets/c8.cur +0 -0
- package/assets/c9.cur +0 -0
- package/assets/close.webp +0 -0
- package/assets/coffee.png +0 -0
- package/assets/gulp/404.jpg +0 -0
- package/assets/gulp/comment_bg.png +0 -0
- package/assets/gulp/friend_404.gif +0 -0
- package/assets/gulp/loading.gif +0 -0
- package/assets/loading2.gif +0 -0
- package/assets/loading3.gif +0 -0
- package/assets/open.webp +0 -0
- package/assets/pusheencode.webp +0 -0
- package/assets/r1.jpg +0 -0
- package/assets/r2.jpg +0 -0
- package/baidusitemap.xml +0 -183
- package/config.yaml +0 -26
- package/content.json +0 -1
- package/css/hbe.style.css +0 -1
- package/custom2.css +0 -15
- package/essay/index.html +0 -1
- package/essay/memos.js +0 -1
- package/img/404.jpg +0 -0
- package/img/512.png +0 -0
- package/img/icon-dark.png +0 -0
- package/img/icon-light.png +0 -0
- package/img/icons/api.svg +0 -1
- package/img/icons/diary.svg +0 -1
- package/img/icons/homepage.svg +0 -1
- package/img/icons/navi.svg +0 -1
- package/img/icons/pan.svg +0 -1
- package/img/icons/rtalk.svg +0 -1
- package/img/load-dark.png +0 -0
- package/img/load-light.png +0 -0
- package/img/siteicon/android-chrome-144x144.png +0 -0
- package/img/siteicon/android-chrome-192x192.png +0 -0
- package/img/siteicon/android-chrome-256x256.png +0 -0
- package/img/siteicon/android-chrome-36x36.png +0 -0
- package/img/siteicon/android-chrome-384x384.png +0 -0
- package/img/siteicon/android-chrome-48x48.png +0 -0
- package/img/siteicon/android-chrome-512x512.png +0 -0
- package/img/siteicon/android-chrome-72x72.png +0 -0
- package/img/siteicon/android-chrome-96x96.png +0 -0
- package/img/siteicon/apple-splash-1125-2436.jpg +0 -0
- package/img/siteicon/apple-splash-1136-640.jpg +0 -0
- package/img/siteicon/apple-splash-1170-2532.jpg +0 -0
- package/img/siteicon/apple-splash-1179-2556.jpg +0 -0
- package/img/siteicon/apple-splash-1242-2208.jpg +0 -0
- package/img/siteicon/apple-splash-1242-2688.jpg +0 -0
- package/img/siteicon/apple-splash-1284-2778.jpg +0 -0
- package/img/siteicon/apple-splash-1290-2796.jpg +0 -0
- package/img/siteicon/apple-splash-1334-750.jpg +0 -0
- package/img/siteicon/apple-splash-1536-2048.jpg +0 -0
- package/img/siteicon/apple-splash-1620-2160.jpg +0 -0
- package/img/siteicon/apple-splash-1668-2224.jpg +0 -0
- package/img/siteicon/apple-splash-1668-2388.jpg +0 -0
- package/img/siteicon/apple-splash-1792-828.jpg +0 -0
- package/img/siteicon/apple-splash-2048-1536.jpg +0 -0
- package/img/siteicon/apple-splash-2048-2732.jpg +0 -0
- package/img/siteicon/apple-splash-2160-1620.jpg +0 -0
- package/img/siteicon/apple-splash-2208-1242.jpg +0 -0
- package/img/siteicon/apple-splash-2224-1668.jpg +0 -0
- package/img/siteicon/apple-splash-2388-1668.jpg +0 -0
- package/img/siteicon/apple-splash-2436-1125.jpg +0 -0
- package/img/siteicon/apple-splash-2532-1170.jpg +0 -0
- package/img/siteicon/apple-splash-2556-1179.jpg +0 -0
- package/img/siteicon/apple-splash-2688-1242.jpg +0 -0
- package/img/siteicon/apple-splash-2732-2048.jpg +0 -0
- package/img/siteicon/apple-splash-2778-1284.jpg +0 -0
- package/img/siteicon/apple-splash-2796-1290.jpg +0 -0
- package/img/siteicon/apple-splash-640-1136.jpg +0 -0
- package/img/siteicon/apple-splash-750-1334.jpg +0 -0
- package/img/siteicon/apple-splash-828-1792.jpg +0 -0
- package/img/siteicon/apple-touch-icon.png +0 -0
- package/img/siteicon/favicon-16x16.png +0 -0
- package/img/siteicon/favicon-32x32.png +0 -0
- package/img/siteicon/favicon.ico +0 -0
- package/img/siteicon/mstile-150x150.png +0 -0
- package/img/siteicon/safari-pinned-tab.svg +0 -247
- package/js/categorybar.js +0 -1
- package/js/ceta/random.js +0 -1
- package/js/search/local-search.js +0 -1
- package/js/webmention.js +0 -3
- package/lib/hbe.js +0 -1
- package/search.xml +0 -1168
- package/sitemap.xml +0 -769
- package/sw-dom.js +0 -54
- package/swpp/tracker.json +0 -1
- package/swpp/update.json +0 -1
- package/swpp.js +0 -1
- /package/img/{favicon.png → pwa/favicon_32.png} +0 -0
package/js/main.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
document.addEventListener("DOMContentLoaded",(function(){let t,e,n,o,i=!1;const c=i=>{if(i){t=document.getElementById("site-name").offsetWidth;const i=document.querySelectorAll("#menus .menus_item");e=0,i.length&&i.forEach((t=>{e+=t.offsetWidth}));const c=document.querySelector("#search-button");n=c?c.offsetWidth:0,o=document.getElementById("nav")}let c="";window.innerWidth<=800&&(c=!0),c?o.classList.add("hide-menu"):o.classList.remove("hide-menu")},s=()=>{btf.sidebarPaddingR(),document.body.style.overflow="hidden",btf.animateIn(document.getElementById("menu-mask"),"to_show 0.5s"),document.getElementById("sidebar-menus").classList.add("open"),i=!0},a=()=>{const t=document.body;t.style.overflow="",t.style.paddingRight="",btf.animateOut(document.getElementById("menu-mask"),"to_hide 0.5s"),document.getElementById("sidebar-menus").classList.remove("open"),i=!1},l=function(){const t=GLOBAL_CONFIG.highlight;if(!t)return;const e=t.highlightCopy,n=t.highlightLang,o=GLOBAL_CONFIG_SITE.isHighlightShrink,i=t.highlightHeightLimit,c=e||n||void 0!==o,s="highlighjs"===t.plugin?document.querySelectorAll("figure.highlight"):document.querySelectorAll('pre[class*="language-"]');if(!c&&!i||!s.length)return;const a="prismjs"===t.plugin;let l="",d="";const r=!0===o?"closed":"";void 0!==o&&(l=`<i class="fas fa-angle-down expand ${r}"></i>`),e&&(d='<div class="copy-notice"></div><i class="fas fa-paste copy-button"></i>');const u=t=>{const e=t.parentNode;e.classList.add("copy-true");const n=window.getSelection(),o=document.createRange();a?o.selectNodeContents(e.querySelectorAll("pre code")[0]):o.selectNodeContents(e.querySelectorAll("table .code pre")[0]),n.removeAllRanges(),n.addRange(o);n.toString();((t,e)=>{if(document.queryCommandSupported&&document.queryCommandSupported("copy"))if(document.execCommand("copy"),void 0!==GLOBAL_CONFIG.Snackbar);else{const t=e.previousElementSibling;t.innerText=GLOBAL_CONFIG.copy.success,t.style.opacity=1,setTimeout((()=>{t.style.opacity=0}),700)}else void 0!==GLOBAL_CONFIG.Snackbar||(e.previousElementSibling.innerText=GLOBAL_CONFIG.copy.noSupport)})(0,t.lastChild),n.removeAllRanges(),e.classList.remove("copy-true")},m=function(t){const e=t.target.classList;e.contains("expand")?(t=>{const e=[...t.parentNode.children].slice(1);t.firstChild.classList.toggle("closed"),btf.isHidden(e[e.length-1])?e.forEach((t=>{t.style.display="block"})):e.forEach((t=>{t.style.display="none"}))})(this):e.contains("copy-button")&&u(this)},f=function(){this.classList.toggle("expand-done")};function g(t,e,n){const o=document.createDocumentFragment();if(c){const e=document.createElement("div");e.className=`highlight-tools ${r}`,e.innerHTML=l+t+d,e.addEventListener("click",m),o.appendChild(e)}if(i&&e.offsetHeight>i+30){const t=document.createElement("div");t.className="code-expand-btn",t.innerHTML='<i class="fas fa-angle-double-down"></i>',t.addEventListener("click",f),o.appendChild(t)}"hl"===n?e.insertBefore(o,e.firstChild):e.parentNode.insertBefore(o,e)}n?a?s.forEach((function(t){const e=`<div class="code-lang">${t.getAttribute("data-language")?t.getAttribute("data-language"):"Code"}</div>`;btf.wrap(t,"figure",{class:"highlight"}),g(e,t)})):s.forEach((function(t){let e=t.getAttribute("class").split(" ")[1];"plain"!==e&&void 0!==e||(e="Code");g(`<div class="code-lang">${e}</div>`,t,"hl")})):a?s.forEach((function(t){btf.wrap(t,"figure",{class:"highlight"}),g("",t)})):s.forEach((function(t){g("",t,"hl")}))};const d=function(){const t=document.getElementById("rightside"),e=window.innerHeight+56;if(document.body.scrollHeight<=e)return void(t.style.cssText="opacity: 1; transform: translateX(-58px)");let n=0,o=!0;const i=document.getElementById("page-header"),c="function"==typeof chatBtnHide,s="function"==typeof chatBtnShow;window.scrollCollect=()=>btf.throttle((function(a){const l=window.scrollY||document.documentElement.scrollTop,d=function(t){const e=t>n;return n=t,e}(l);l>56?(i.classList.add("is-top-bar"),d?(i.classList.contains("nav-visible")&&i.classList.remove("is-top-bar"),s&&!0===o&&(chatBtnHide(),o=!1)):(i.classList.contains("nav-visible")||i.classList.add("is-top-bar"),c&&!1===o&&(chatBtnShow(),o=!0)),i.classList.add("nav-fixed"),"0"===window.getComputedStyle(t).getPropertyValue("opacity")&&(t.style.cssText="opacity: 0.8; transform: translateX(-58px)")):(0===l&&i.classList.add("is-top-bar"),t.style.cssText="opacity: ''; transform: ''"),document.body.scrollHeight<=e&&(t.style.cssText="opacity: 0.8; transform: translateX(-58px)")}),200)(),window.addEventListener("scroll",scrollCollect)},r=function(){const t=GLOBAL_CONFIG_SITE.isToc,e=GLOBAL_CONFIG.isAnchor,n=document.getElementById("article-container");if(!n||!t&&!e)return;let o,i,c,s,a;if(t){const t=document.getElementById("card-toc");i=t.getElementsByClassName("toc-content")[0],o=i.querySelectorAll(".toc-link");const e=t.querySelector(".toc-percentage");a=i.classList.contains("is-expand"),c=t=>{const o=n.clientHeight,i=document.documentElement.clientHeight,c=(t-n.offsetTop)/(o>i?o-i:document.documentElement.scrollHeight-i),s=Math.round(100*c),a=s>100?100:s<=0?0:s;e.textContent=a},window.mobileToc={open:()=>{t.style.cssText="animation: toc-open .3s; opacity: 1; right: 55px"},close:()=>{t.style.animation="toc-close .2s",setTimeout((()=>{t.style.cssText="opacity:''; animation: ''; right: ''"}),100)}},i.addEventListener("click",(t=>{t.preventDefault();const e=t.target.classList;if(e.contains("toc-content"))return;const n=e.contains("toc-link")?t.target:t.target.parentElement;btf.scrollToDest(btf.getEleTop(document.getElementById(decodeURI(n.getAttribute("href")).replace("#",""))),300),window.innerWidth<900&&window.mobileToc.close()})),s=t=>{const e=t.getBoundingClientRect().top,n=i.scrollTop;e>document.documentElement.clientHeight-100&&(i.scrollTop=n+150),e<100&&(i.scrollTop=n-150)}}const l=n.querySelectorAll("h1,h2,h3,h4,h5,h6");let d="";window.tocScrollFn=function(){return btf.throttle((function(){const n=window.scrollY||document.documentElement.scrollTop;t&&c(n),function(n){if(0===n)return!1;let c="",r="";if(l.forEach((function(t,e){if(n>btf.getEleTop(t)-80){const n=t.id;c=n?"#"+encodeURI(n):"",r=e}})),d!==r&&(e&&btf.updateAnchor(c),d=r,t)){if(i.querySelectorAll(".active").forEach((t=>{t.classList.remove("active")})),""===c)return;const t=o[r];if(t.classList.add("active"),setTimeout((()=>{s(t)}),0),a)return;let e=t.parentNode;for(;!e.matches(".toc");e=e.parentNode)e.matches("li")&&e.classList.add("active")}}(n)}),100)()},window.addEventListener("scroll",tocScrollFn)},u=()=>{const t=document.body;t.classList.add("read-mode");const e=document.createElement("button");e.type="button",e.className="fas fa-sign-out-alt exit-readmode",t.appendChild(e),e.addEventListener("click",(function n(){t.classList.remove("read-mode"),e.remove(),e.removeEventListener("click",n)}))},m=()=>{"light"===("dark"===document.documentElement.getAttribute("data-theme")?"dark":"light")?(activateDarkMode(),saveToLocal.set("theme","dark",2)):(activateLightMode(),saveToLocal.set("theme","light",2)),"function"==typeof utterancesTheme&&utterancesTheme(),"function"==typeof changeGiscusTheme&&changeGiscusTheme(),"object"==typeof FB&&window.loadFBComment(),"function"==typeof runMermaid&&window.runMermaid()},f=t=>{const e=document.getElementById("rightside-config-hide").classList;e.toggle("show"),t.classList.contains("show")&&(e.add("status"),setTimeout((()=>{e.remove("status")}),300)),t.classList.toggle("show")},g=()=>{btf.scrollToDest(0,500)},h=()=>{const t=document.documentElement.classList;t.contains("hide-aside")?saveToLocal.set("aside-status","show",2):saveToLocal.set("aside-status","hide",2),t.toggle("hide-aside")},p=()=>{"0"===window.getComputedStyle(document.getElementById("card-toc")).getPropertyValue("opacity")?window.mobileToc.open():window.mobileToc.close()};document.getElementById("rightside").addEventListener("click",(function(t){const e=t.target.id?t.target:t.target.parentNode;switch(e.id){case"go-up":g();break;case"rightside_config":f(e);break;case"mobile-toc-button":p();break;case"readmode":u();break;case"darkmode":m();break;case"hide-aside-btn":h()}}));const y=()=>{document.querySelectorAll("#sidebar-menus .site-page.group").forEach((function(t){t.addEventListener("click",(function(){this.classList.toggle("hide")}))}))},L=function(){document.querySelectorAll("#article-container .tab > button").forEach((function(t){t.addEventListener("click",(function(t){const e=this,n=e.parentNode;if(!n.classList.contains("active")){const t=n.parentNode.nextElementSibling,o=btf.siblings(n,".active")[0];o&&o.classList.remove("active"),n.classList.add("active");const i=e.getAttribute("data-href").replace("#","");[...t.children].forEach((t=>{t.id===i?t.classList.add("active"):t.classList.remove("active")}));const c=t.querySelectorAll(`#${i} .fj-gallery`);c.length>0&&btf.initJustifiedGallery(c)}}))}))},b=()=>{document.querySelectorAll("#article-container .tabs .tab-to-top").forEach((function(t){t.addEventListener("click",(function(){btf.scrollToDest(btf.getEleTop(btf.getParents(this,".tabs")),300)}))}))},E=function(t){t.forEach((t=>{const e=t,n=e.getAttribute("datetime");e.innerText=btf.diffDate(n,!0),e.style.display="inline"}))};window.refreshFn=function(){c(!0),o.classList.add("show"),GLOBAL_CONFIG_SITE.isPost?(void 0!==GLOBAL_CONFIG.noticeOutdate&&function(){const t=GLOBAL_CONFIG.noticeOutdate,e=btf.diffDate(GLOBAL_CONFIG_SITE.postUpdate);if(e>=t.limitDay){const n=document.createElement("div");n.className="post-outdate-notice",n.textContent=t.messagePrev+" "+e+" "+t.messageNext;const o=document.getElementById("article-container");"top"===t.position?o.insertBefore(n,o.firstChild):o.appendChild(n)}}(),GLOBAL_CONFIG.relativeDate.post&&E(document.querySelectorAll("#post-meta time"))):(GLOBAL_CONFIG.relativeDate.homepage&&E(document.querySelectorAll("#recent-posts time")),GLOBAL_CONFIG.runtime&&(()=>{const t=document.getElementById("runtimeshow");if(t){const e=t.getAttribute("data-publishDate");t.innerText=btf.diffDate(e)+" "+GLOBAL_CONFIG.runtime}})(),(()=>{const t=document.getElementById("last-push-date");if(t){const e=t.getAttribute("data-lastPushDate");t.innerText=btf.diffDate(e,!0)}})(),function(){const t=document.querySelectorAll("#aside-cat-list .card-category-list-item.parent i");t.length&&t.forEach((function(t){t.addEventListener("click",(function(t){t.preventDefault(),this.classList.toggle("expand");const e=this.parentNode.nextElementSibling;btf.isHidden(e)?e.style.display="block":e.style.display="none"}))}))}(),v()),r(),GLOBAL_CONFIG_SITE.isHome&&(()=>{const t=document.getElementById("scroll-down");t&&t.addEventListener("click",(function(){btf.scrollToDest(document.getElementById("content-inner").offsetTop,300)}))})(),l(),GLOBAL_CONFIG.isPhotoFigcaption&&document.querySelectorAll("#article-container img").forEach((function(t){const e=t.parentNode,n=t.title||t.alt;if(n&&!e.parentNode.classList.contains("justified-gallery")){const o=document.createElement("div");o.className="img-alt is-center",o.textContent=n,e.insertBefore(o,t.nextSibling)}})),d();const t=document.querySelectorAll("#article-container .fj-gallery");t.length&&function(t){if(t.forEach((t=>{t.querySelectorAll("img").forEach((t=>{const e=t.getAttribute("data-lazy-src");e&&(t.src=e),btf.wrap(t,"div",{class:"fj-gallery-item"})}))})),window.fjGallery)return void setTimeout((()=>{btf.initJustifiedGallery(t)}),100);const e=document.createElement("link");e.rel="stylesheet",e.href=GLOBAL_CONFIG.source.justifiedGallery.css,document.body.appendChild(e),getScript(`${GLOBAL_CONFIG.source.justifiedGallery.js}`).then((()=>{btf.initJustifiedGallery(t)}))}(t),btf.loadLightbox(document.querySelectorAll("#article-container img:not(.no-lightbox)")),(()=>{const t=document.querySelectorAll("#article-container :not(.highlight) > table, #article-container > table");t.length&&t.forEach((t=>{btf.wrap(t,"div",{class:"table-wrap"})}))})(),function(){const t=document.querySelectorAll("#article-container .hide-button");t.length&&t.forEach((function(t){t.addEventListener("click",(function(t){this.classList.add("open");const e=this.nextElementSibling.querySelectorAll(".fj-gallery");e.length&&btf.initJustifiedGallery(e)}))}))}(),L(),b(),function(){let t=!1;const e=document.querySelector("#comment-switch > .switch-btn");e&&e.addEventListener("click",(function(){this.classList.toggle("move"),document.querySelectorAll("#post-comment > .comment-wrap > div").forEach((function(t){btf.isHidden(t)?t.style.cssText="display: block;animation: tabshow .5s":t.style.cssText="display: none;animation: ''"})),t||"function"!=typeof loadOtherComment||(t=!0,loadOtherComment())}))}(),document.getElementById("toggle-menu").addEventListener("click",(()=>{s()}))};const v=()=>{const t=document.querySelector("#category-bar"),e=decodeURIComponent(window.location.pathname),n=e===GLOBAL_CONFIG.root;if(t){t.querySelectorAll(".category-bar-item").forEach((t=>t.classList.remove("select")));const o=n?"category-bar-home":e.split("/").slice(-2,-1)[0],i=document.getElementById(o);i&&i.classList.add("select")}};refreshFn(),window.addEventListener("resize",(()=>{c(!1),btf.isHidden(document.getElementById("toggle-menu"))&&i&&a()})),document.getElementById("menu-mask").addEventListener("click",(t=>{a()})),y(),GLOBAL_CONFIG.islazyload&&(window.lazyLoadInstance=new LazyLoad({elements_selector:"img",threshold:0,data_src:"lazy-src"})),void 0!==GLOBAL_CONFIG.copyright&&(()=>{const t=GLOBAL_CONFIG.copyright;document.body.oncopy=e=>{let n;e.preventDefault();const o=window.getSelection(0).toString();return n=o.length>t.limitCount?o+"\n\n\n"+t.languages.author+"\n"+t.languages.link+window.location.href+"\n"+t.languages.source+"\n"+t.languages.info:o,e.clipboardData?e.clipboardData.setData("text",n):window.clipboardData.setData("text",n)}})()}));
|
1
|
+
const sidebarFn=()=>{const e=document.getElementById("toggle-menu"),t=document.getElementById("sidebar-menus"),o=document.getElementById("menu-mask"),n=document.body,s=e=>{utils.sidebarPaddingR(),n.style.overflow=e?"hidden":"",utils[e?"fadeIn":"fadeOut"](o,.5),t.classList.toggle("open",e)},i=()=>{t.classList.contains("open")&&s(!1)};e.addEventListener("click",(()=>s(!0))),o.addEventListener("click",i),window.addEventListener("resize",(()=>{utils.isHidden(e)&&t.classList.contains("open")&&i(),sco.refreshWaterFall()}))},scrollFn=()=>{const e=document.getElementById("rightside"),t=document.getElementById("page-header");let o=0;const n=utils.throttle((()=>{initThemeColor();const n=window.scrollY||document.documentElement.scrollTop,s=n>o;o=n,((o,n)=>{n>0?(t.classList.toggle("nav-visible",!o),t.classList.add("nav-fixed"),e&&(e.style.opacity="0.8",e.style.transform="translateX(-58px)")):(t.classList.remove("nav-fixed","nav-visible"),e&&(e.style.opacity="",e.style.transform=""))})(s,n)}),200);window.addEventListener("scroll",(o=>{n(o),0===window.scrollY&&(t.classList.remove("nav-fixed","nav-visible"),e&&(e.style.cssText="opacity: ''; transform: ''"))}))},percent=()=>{const e=document.documentElement,t=document.body,o=window.pageYOffset||e.scrollTop,n=Math.max(t.scrollHeight,e.scrollHeight,t.offsetHeight,e.offsetHeight,t.clientHeight,e.clientHeight)-e.clientHeight,s=Math.round(o/n*100),i=document.querySelector("#nav-totop"),c=document.querySelector(".rs_show .top i"),a=document.querySelector("#percent"),l=window.scrollY+e.clientHeight>=(document.getElementById("post-comment")||document.getElementById("footer")).offsetTop;i?.classList.toggle("long",l||s>90),c?.classList.toggle("show",l||s>90),a.textContent=l||s>90?i?GLOBAL_CONFIG.lang.backtop:"":s,document.querySelectorAll(".needEndHide").forEach((e=>e.classList.toggle("hide",n-o<100)))},showTodayCard=()=>{const e=document.getElementById("todayCard"),t=document.querySelector(".topGroup");t?.addEventListener("mouseleave",(()=>e?.classList.remove("hide")))},initObserver=()=>{const e=document.getElementById("post-comment"),t=document.getElementById("pagination"),o=document.querySelector(".comment-barrage");if(e&&t){new IntersectionObserver((e=>{e.forEach((e=>{t.classList.toggle("show-window",e.isIntersecting),GLOBAL_CONFIG.comment.commentBarrage&&(o.style.bottom=e.isIntersecting?"-200px":"0px")}))})).observe(e)}},addCopyright=()=>{if(!GLOBAL_CONFIG.copyright)return;const{limit:e,author:t,link:o,source:n,info:s}=GLOBAL_CONFIG.copyright;document.body.addEventListener("copy",(i=>{i.preventDefault();const c=window.getSelection().toString(),a=c.length>e?`${c}\n\n${t}\n${o}${window.location.href}\n${n}\n${s}`:c;i.clipboardData.setData("text",a)}))},asideStatus=()=>{const e=utils.saveToLocal.get("aside-status");document.documentElement.classList.toggle("hide-aside","hide"===e)};function initThemeColor(){const e=(window.scrollY||document.documentElement.scrollTop)>0?"--efu-card-bg":PAGE_CONFIG.is_post?"--efu-main":"--efu-background";applyThemeColor(getComputedStyle(document.documentElement).getPropertyValue(e))}function applyThemeColor(e){const t=document.querySelector('meta[name="theme-color"]'),o=document.querySelector('meta[name="apple-mobile-web-app-status-bar-style"]');t?.setAttribute("content",e),o?.setAttribute("content",e),window.matchMedia("(display-mode: standalone)").matches&&(document.body.style.backgroundColor=e)}const handleThemeChange=e=>{const t=window.globalFn?.themeChange||{};Object.values(t).forEach((t=>t(e)))},sco={lastWittyWord:"",wasPageHidden:!1,musicPlaying:!1,scrollTo(e){const t=document.getElementById(e);if(t){const e=t.getBoundingClientRect().top+window.pageYOffset-80;window.scroll({top:e,behavior:"smooth"})}},musicToggle(e=!0){this.isMusicBind||this.musicBind();const t=document.querySelector("#nav-music"),o=document.querySelector("meting-js"),n=document.getElementById("consoleMusic"),s=document.querySelector("#menu-music-toggle span"),i=document.querySelector("#menu-music-toggle i");this.musicPlaying=!this.musicPlaying,t.classList.toggle("playing",this.musicPlaying),t.classList.toggle("stretch",this.musicPlaying),n?.classList.toggle("on",this.musicPlaying),"undefined"!=typeof rm&&rm?.menuItems.music[0]&&(s.textContent=this.musicPlaying?GLOBAL_CONFIG.right_menu.music.stop:GLOBAL_CONFIG.right_menu.music.start,i.className=this.musicPlaying?"solitude fas fa-pause":"solitude fas fa-play"),e&&(this.musicPlaying?o.aplayer.play():o.aplayer.pause())},musicBind(){const e=document.querySelector("#nav-music"),t=document.querySelector("#nav-music .aplayer-music"),o=document.querySelector("#nav-music .aplayer-button");t?.addEventListener("click",(()=>{e.classList.toggle("stretch")})),o?.addEventListener("click",(()=>{this.musicToggle(!1)})),this.isMusicBind=!0},switchCommentBarrage(){const e=document.querySelector(".comment-barrage"),t=document.querySelector("#consoleCommentBarrage");if(!e)return;const o="flex"===window.getComputedStyle(e).display;e.style.display=o?"none":"flex",t?.classList.toggle("on",!o),utils.saveToLocal.set("commentBarrageSwitch",!o,.2),rm?.menuItems.barrage&&rm.barrage(o)},switchHideAside(){const e=document.documentElement.classList,t=document.querySelector("#consoleHideAside"),o=e.contains("hide-aside");utils.saveToLocal.set("aside-status",o?"show":"hide",1),e.toggle("hide-aside"),t.classList.toggle("on",!o)},switchKeyboard(){this.sco_keyboards=!this.sco_keyboards;const e=document.querySelector("#consoleKeyboard"),t=this.sco_keyboards?openKeyboard:closeKeyboard;e?.classList.toggle("on",this.sco_keyboards),t(),localStorage.setItem("keyboard",this.sco_keyboards),document.getElementById("keyboard-tips")?.classList.remove("show")},initConsoleState(){const e=document.querySelector("#consoleHideAside");e&&e.classList.toggle("on",document.documentElement.classList.contains("hide-aside"))},changeWittyWord(){const e=GLOBAL_CONFIG.aside.witty_words,t=document.getElementById("author-info__sayhi");let o;do{o=e[Math.floor(Math.random()*e.length)]}while(o===this.lastWittyWord);t.textContent=o,this.lastWittyWord=o},switchDarkMode(){const e="dark"===document.documentElement.getAttribute("data-theme"),t=e?"light":"dark";document.documentElement.setAttribute("data-theme",t),utils.saveToLocal.set("theme",t,.02),utils.snackbarShow(GLOBAL_CONFIG.lang.theme[t],!1,2e3),"object"==typeof rm&&rm.mode(!e)&&rm.hideRightMenu(),handleThemeChange(t)},hideTodayCard:()=>document.getElementById("todayCard").classList.add("hide"),toTop:()=>utils.scrollToDest(0),showConsole:()=>document.getElementById("console")?.classList.toggle("show",!0),hideConsole:()=>document.getElementById("console")?.classList.remove("show"),refreshWaterFall(){const e=new IntersectionObserver((e=>{e.forEach((e=>{e.isIntersecting&&setTimeout((()=>{waterfall(e.target).then((()=>{e.target.classList.add("show")}))}),300)}))}));document.querySelectorAll(".waterfall").forEach((t=>e.observe(t)))},addRuntime(){const e=document.getElementById("runtimeshow");e&&GLOBAL_CONFIG.runtime&&(e.innerText=utils.timeDiff(new Date(GLOBAL_CONFIG.runtime),new Date)+GLOBAL_CONFIG.lang.day)},toTalk(e){["#wl-edit",".el-textarea__inner","#veditor",".atk-textarea"].forEach((t=>{const o=document.querySelector(t);o&&(o.dispatchEvent(new Event("input",{bubble:!0,cancelable:!0})),o.value="> "+e.replace(/\n/g,"\n> ")+"\n\n",utils.scrollToDest(utils.getEleTop(document.getElementById("post-comment")),300),o.focus(),o.setSelectionRange(-1,-1))})),utils.snackbarShow(GLOBAL_CONFIG.lang.totalk,!1,2e3)},initbbtalk(){document.querySelector("#bber-talk")&&new Swiper(".swiper-container",{direction:"vertical",loop:!0,autoplay:{delay:3e3,pauseOnMouseEnter:!0}})},addPhotoFigcaption(){document.querySelectorAll(".article-container img:not(.gallery-item img)").forEach((e=>{const t=e.getAttribute("alt");t&&e.insertAdjacentHTML("afterend",`<div class="img-alt is-center">${utils.escapeHtml(t)}</div>`)}))},scrollToComment:()=>utils.scrollToDest(utils.getEleTop(document.getElementById("post-comment")),300),setTimeState(){const e=document.getElementById("author-info__sayhi");if(e){const t=(new Date).getHours(),o=GLOBAL_CONFIG.aside.state,n=function(e){for(let t of e){const e=localStorage.getItem(t);if(e)return JSON.parse(e)}return null}(["twikoo","WALINE_USER_META","WALINE_USER","_v_Cache_Meta","ArtalkUser"]);const s=n?n.nick||n.display_name:null,i=this.wasPageHidden?GLOBAL_CONFIG.aside.witty_comment.back+s:GLOBAL_CONFIG.aside.witty_comment.prefix+s,c=[{start:0,end:5,text:s?i:o.goodnight},{start:6,end:10,text:s?i:o.morning},{start:11,end:14,text:s?i:o.noon},{start:15,end:18,text:s?i:o.afternoon},{start:19,end:24,text:s?i:o.night}].find((e=>t>=e.start&&t<=e.end));e.innerText=c.text}},tagPageActive(){const e=decodeURIComponent(window.location.pathname);if(/\/tags\/.*?\//.test(e)){const t=e.split("/").slice(-2,-1)[0],o=document.getElementById(t);o&&(document.querySelectorAll("a.select").forEach((e=>{e.classList.remove("select")})),o.classList.add("select"))}},categoriesBarActive(){const e=document.querySelector("#category-bar"),t=decodeURIComponent(window.location.pathname),o=t===GLOBAL_CONFIG.root;if(e){e.querySelectorAll(".category-bar-item").forEach((e=>e.classList.remove("select")));const n=o?"category-bar-home":t.split("/").slice(-2,-1)[0],s=document.getElementById(n);s&&s.classList.add("select")}},scrollCategoryBarToRight(){const e=document.getElementById("category-bar-items"),t=document.getElementById("category-bar-next");if(e){const o=()=>e.scrollLeft+e.clientWidth>=e.scrollWidth-8,n=()=>{e.scroll({left:o()?0:e.clientWidth,behavior:"smooth"})};e.addEventListener("scroll",(()=>{clearTimeout(this.timeoutId),this.timeoutId=setTimeout((()=>{t.style.transform=o()?"rotate(180deg)":""}),150)})),n()}},openAllTags(){document.querySelectorAll(".card-allinfo .card-tag-cloud").forEach((e=>e.classList.add("all-tags"))),document.getElementById("more-tags-btn")?.remove()},listenToPageInputPress(){const e=document.querySelector(".toPageGroup"),t=document.getElementById("toPageText");if(!t)return;const o=document.getElementById("toPageButton"),n=document.querySelectorAll(".page-number"),s=+n[n.length-1].textContent;t&&1!==s?(t.addEventListener("keydown",(e=>{13===e.keyCode&&(sco.toPage(),pjax.loadUrl(o.href))})),t.addEventListener("input",(()=>{o.classList.toggle("haveValue",""!==t.value&&"0"!==t.value),+t.value>s&&(t.value=s)}))):e.style.display="none"},addNavBackgroundInit(){0!==document.documentElement.scrollTop&&document.getElementById("page-header").classList.add("nav-fixed","nav-visible")},toPage(){const e=document.querySelectorAll(".page-number"),t=parseInt(e[e.length-1].innerHTML),o=document.getElementById("toPageText"),n=parseInt(o.value);document.getElementById("toPageButton").href=!isNaN(n)&&n<=t&&n>1?window.location.href.replace(/\/page\/\d+\/$/,"/")+"page/"+n+"/":"/"},owoBig(e){let t=document.getElementById("owo-big");t||(t=document.createElement("div"),t.id="owo-big",document.body.appendChild(t));const o=e=>{const o=e.getBoundingClientRect();t.style.left=o.left-t.offsetWidth/4+"px",t.style.top=`${o.top}px`};document.addEventListener("mouseover",(n=>{const s=n.target,i=s.closest(e.item);if(i&&s.closest(e.body)){const e=i.querySelector("img")?.src;e&&(t.innerHTML=`<img src="${e}" style="max-width: 100%; height: auto;">`,t.style.display="block",o(i))}})),document.addEventListener("mouseout",(o=>{o.target.closest(e.item)&&o.target.closest(e.body)&&(t.style.display="none")}))},changeTimeFormat(e){e.forEach((e=>{const t=e.getAttribute("datetime");e.textContent=utils.diffDate(t,!0),e.style.display="inline"}))},switchComments(){const e=document.getElementById("switch-btn");if(!e)return;let t=!1;const o=document.getElementById("post-comment");utils.addEventListenerPjax(e,"click",(()=>{o.classList.toggle("move"),t||"function"!=typeof loadTwoComment||(t=!0,loadTwoComment())}))},homeTypeit(){if("undefined"==typeof home_subtitle)return;const e=new TypeIt(".banners-title-small",{speed:200,waitUntilVisible:!0,loop:!0,lifeLike:!0});home_subtitle.forEach((t=>{e.type(t).pause(500).delete(t)})),e.go()}},addHighlight=()=>{const e=GLOBAL_CONFIG.highlight;if(!e)return;const{copy:t,expand:o,limit:n,syntax:s}=e,i="prismjs"===s,c=e.enable||t||o||n,a=o?"":"closed",l="highlight.js"===s?document.querySelectorAll("figure.highlight"):document.querySelectorAll('pre[class*="language-"]');if(!c&&!n||!l.length)return;const r=t?'<i class="solitude fas fa-copy copy-button"></i>':"<i></i>",d=n?'<i class="solitude fas fa-angles-down"></i>':"<i></i>",m=e=>{const t=e.parentNode;t.classList.add("copy-true");const o=window.getSelection(),n=document.createRange(),s=i?"pre code":"table .code pre";var c;n.selectNodeContents(t.querySelectorAll(`${s}`)[0]),o.removeAllRanges(),o.addRange(n),document.execCommand("copy"),e.lastChild,c=GLOBAL_CONFIG.lang.copy.success,utils.snackbarShow(c,!1,2e3),o.removeAllRanges(),t.classList.remove("copy-true")},u=function(){this.classList.toggle("expand-done")},g=function(e){const t=e.target.classList;t.contains("expand")?(e=>{e.classList.toggle("closed")})(this):t.contains("copy-button")&&m(this)},h=(e,t,o)=>{const s=document.createDocumentFragment();if(c){const o=t.querySelector("figcaption");let n="";o&&(n=`<div class="caption">${o.innerHTML}</div>`,t.removeChild(o));const i=document.createElement("div");i.className=`highlight-tools ${a}`,i.innerHTML='<i class="solitude fas fa-angle-down expand"></i>'+e+n+r,utils.addEventListenerPjax(i,"click",g),s.appendChild(i)}if(n&&t.offsetHeight>n+30){const e=document.createElement("div");e.className="code-expand-btn",e.innerHTML=d,utils.addEventListenerPjax(e,"click",u),s.appendChild(e)}"hl"===o?t.insertBefore(s,t.firstChild):t.parentNode.insertBefore(s,t)};i?l.forEach((e=>{const t=e.getAttribute("data-language")||"Code",o=`<div class="code-lang">${utils.escapeHtml(t)}</div>`;utils.wrap(e,"figure",{class:"highlight"}),h(o,e)})):l.forEach((e=>{let t=e.getAttribute("class").split(" ")[1];"plain"!==t&&void 0!==t||(t="Code");const o=`<div class="code-lang">${utils.escapeHtml(t)}</div>`;h(o,e,"hl")}))};class toc{static init(){const e=document.getElementById("card-toc");if(!e||!e.querySelector(".toc a"))return void(e.style.display="none");const t=document.querySelectorAll(".toc a");t.forEach((e=>{e.addEventListener("click",(e=>{e.preventDefault(),utils.scrollToDest(utils.getEleTop(document.getElementById(decodeURI(("toc-text"===e.target.className?e.target.parentNode.hash:e.target.hash).replace("#","")))),300)}))})),this.active(t)}static active(e){const t=document.querySelector(".article-container"),o=document.getElementById("toc-content"),n=t.querySelectorAll("h1,h2,h3,h4,h5,h6");let s="";const i=t=>{if(0===t)return!1;let i="";if(n.forEach(((e,o)=>{t>utils.getEleTop(e)-80&&(i=o)})),s===i)return;s=i,document.querySelectorAll(".toc .active").forEach((e=>{e.classList.remove("active")}));const c=e[s];if(c){let t=e[s].parentNode;for(c.classList.add("active"),(e=>{const t=e.getBoundingClientRect().top,n=o.scrollTop;t>document.documentElement.clientHeight-100&&(o.scrollTop=n+150),t<100&&(o.scrollTop=n-150)})(c);!t.matches(".toc");t=t.parentNode)t.matches("li")&&t.classList.add("active")}};window.tocScrollFn=utils.throttle((()=>{const e=window.scrollY||document.documentElement.scrollTop;i(e)}),100),window.addEventListener("scroll",tocScrollFn)}}class tabs{static init(){this.clickFnOfTabs(),this.backToTop()}static clickFnOfTabs(){document.querySelectorAll(".article-container .tab > button").forEach((e=>{e.addEventListener("click",(function(){const e=this.parentNode;if(!e.classList.contains("active")){const t=e.parentNode.nextElementSibling,o=utils.siblings(e,".active")[0];o&&o.classList.remove("active"),e.classList.add("active");const n=this.getAttribute("data-href").replace("#","");[...t.children].forEach((e=>{e.classList.toggle("active",e.id===n)}))}}))}))}static backToTop(){document.querySelectorAll(".article-container .tabs .tab-to-top").forEach((e=>{e.addEventListener("click",(function(){utils.scrollToDest(utils.getEleTop(this.parentElement.parentElement.parentNode),300)}))}))}static lureAddListener(){if(!GLOBAL_CONFIG.lure)return;const e=document.title;document.addEventListener("visibilitychange",(()=>{const{lure:t}=GLOBAL_CONFIG;document.title="hidden"===document.visibilityState?t.jump:t.back,"visible"===document.visibilityState&&setTimeout((()=>{document.title=e}),2e3)}))}static expireAddListener(){const{expire:e}=GLOBAL_CONFIG;if(!e)return;const t=document.querySelectorAll(".post-meta-date time"),o=t.length?t[t.length-1]:document.querySelector(".datetime");if(!o)return;const n=Math.ceil(((new Date).getTime()-new Date(o.getAttribute("datetime")).getTime())/1e3/60/60/24);if(e.time>n)return;const s=document.createElement("div");s.className="expire",s.innerHTML=`<i class="solitude fas fa-circle-exclamation"></i>${e.text_prev}${-(e.time-n)}${e.text_next}`;document.querySelector(".article-container").insertAdjacentElement("top"===e.position?"afterbegin":"beforeend",s)}}const scrollFnToDo=()=>{const{toc:e}=PAGE_CONFIG;if(e){const e=document.getElementById("card-toc"),t=e.querySelector(".toc-content"),o=(t.querySelectorAll(".toc-link"),e.querySelector(".toc-percentage"),t.classList.contains("is-expand"),t=>{const o=t.target.closest(".toc-link");o&&(t.preventDefault(),utils.scrollToDest(utils.getEleTop(document.getElementById(decodeURI(o.getAttribute("href")).replace("#",""))),300),window.innerWidth<900&&e.classList.remove("open"))});utils.addEventListenerPjax(t,"click",o)}},forPostFn=()=>{scrollFnToDo()};function _0x435e(){const e=["20px","color","sinzmise.top","self","width","transparent","createElement","top","display","center","style","5rtfmHX","margin","overflow","transform","localhost","当前访问于嵌套窗口,可能存在侵权行为,请在独立窗口访问 ","5329205Xpvjqs","innerText","fontSize","#8d8d8d","1285119gGhpEj","wrap","location","警告:本页面非官方页面,可能存在有害信息!建议您立即跳转 ","appendChild","https://blog.storical.space","127.0.0.1","1393320EHxoUY","hidden","9FmwXcx"," 并向站长举报该冒牌镜像站!","14072224twJEcE","opacity","storical.space","flex","1455800yweGkm","height","2px 2px 5px rgba(0, 0, 0, 0.5)","0.35","3797888VinOzS","endsWith","4738938XAUCKq","alignItems","zIndex","div","fixed","open","flexWrap","nowrap","whiteSpace","textShadow","pointerEvents","_blank"];return(_0x435e=function(){return e})()}window.refreshFn=()=>{const{is_home:e,is_page:t,page:o,is_post:n}=PAGE_CONFIG,{runtime:s,lazyload:i,lightbox:c,randomlink:a,covercolor:l,post_ai:r,lure:d,expire:m}=GLOBAL_CONFIG,u=(e||n?".post-meta-date time":".datetime")+", .webinfo-item time";document.body.setAttribute("data-type",o),sco.changeTimeFormat(document.querySelectorAll(u)),s&&sco.addRuntime(),[scrollFn,sidebarFn,sco.addPhotoFigcaption,sco.setTimeState,sco.tagPageActive,sco.categoriesBarActive,sco.listenToPageInputPress,sco.addNavBackgroundInit,sco.refreshWaterFall].forEach((e=>e())),i.enable&&utils.lazyloadImg(),c&&utils.lightbox(document.querySelectorAll(".article-container img:not(.flink-avatar,.gallery-group img, .no-lightbox)")),a&&randomLinksList(),r&&n&&ai.init(),sco.switchComments(),initObserver(),e&&(showTodayCard(),sco.homeTypeit()),"function"==typeof updatePostsBasedOnComments&&updatePostsBasedOnComments(),(n||t)&&(addHighlight(),tabs.init()),n&&m&&tabs.expireAddListener(),l.enable&&coverColor(),PAGE_CONFIG.toc&&toc.init(),d&&tabs.lureAddListener(),"music"===o&&initializeMusicPlayer(),forPostFn()},document.addEventListener("DOMContentLoaded",(()=>{[addCopyright,window.refreshFn,asideStatus,()=>window.onscroll=percent,sco.initConsoleState].forEach((e=>e()))})),document.addEventListener("visibilitychange",(()=>{document.hidden&&(sco.wasPageHidden=!0)})),window.onkeydown=e=>{const{keyCode:t,ctrlKey:o,shiftKey:n}=e;(123===t||o&&n&&67===t)&&utils.snackbarShow(GLOBAL_CONFIG.lang.f12,!1,3e3),27===t&&sco.hideConsole()},document.addEventListener("copy",(()=>{utils.snackbarShow(GLOBAL_CONFIG.lang.copy.success,!1,3e3)}));const _0x178311=_0x1406;function _0x1406(e,t){const o=_0x435e();return(_0x1406=function(e,t){return o[e-=127]})(e,t)}!function(){const e=_0x1406,t=_0x435e();for(;;)try{if(806997===parseInt(e(160))/1+parseInt(e(175))/2+-parseInt(e(167))/3+-parseInt(e(179))/4+-parseInt(e(150))/5*(parseInt(e(127))/6)+-parseInt(e(156))/7+parseInt(e(171))/8*(parseInt(e(169))/9))break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const validDomain1=_0x178311(141),validDomain2=_0x178311(173),redirectUrl=_0x178311(165),hostname=document[_0x178311(162)].hostname,isLocalHost=hostname===_0x178311(154)||hostname===_0x178311(166);if(!isLocalHost&&!hostname[_0x178311(180)](validDomain)){createWatermark(validDomain);confirm(_0x178311(163)+validDomain+_0x178311(170))&&window[_0x178311(162)].replace(redirectUrl)}if(window[_0x178311(146)]!==window[_0x178311(142)]){confirm(_0x178311(155)+validDomain+"。")&&window[_0x178311(132)](redirectUrl,_0x178311(138))}function createWatermark(e){const t=_0x178311,o=document[t(145)](t(130));o[t(149)][t(137)]="none",o.style.position=t(131),o[t(149)][t(146)]="0",o[t(149)].left="0",o[t(149)][t(143)]="100%",o.style[t(176)]="100%",o.style[t(129)]="9999",o[t(149)][t(172)]=t(178),o.style.background=t(144),o.style[t(152)]=t(168),o[t(149)][t(147)]=t(174),o[t(149)].justifyContent=t(148),o[t(149)][t(128)]=t(148),o[t(149)][t(133)]=t(161);const n=document[t(145)](t(130));n[t(157)]=e,n[t(149)][t(140)]=t(159),n[t(149)][t(158)]="30px",n[t(149)][t(153)]="rotate(-30deg)",n[t(149)][t(135)]=t(134),n[t(149)][t(151)]=t(139),n[t(149)][t(136)]=t(177);for(let e=0;e<60;e++)o[t(164)](n.cloneNode(!0));document.body[t(164)](o)}
|
package/js/music.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
class MusicPlayer{constructor(){this.init()}init(){document.documentElement.style.setProperty("--vh",`${window.innerHeight}px`),this.getCustomPlayList(),this.addEventListeners()}getCustomPlayList(){this.changeMusicBg(!1)}addEventListeners(){document.addEventListener("keydown",this.handleKeydown.bind(this));const e=document.querySelector(".aplayer-list"),t=document.querySelector(".aplayer-lrc");t&&!t.dataset.clickBound&&(t.addEventListener("click",(()=>{e.classList.toggle("aplayer-list-hide")})),t.dataset.clickBound=!0)}changeMusicBg(e=!0){const t=document.getElementById("Music-bg"),n=document.getElementsByClassName("Music-loading")[0];e?this.updateBackgroundImage(t):this.setLoadingScreen(n,t)}updateBackgroundImage(e){const t=document.querySelector("#Music-page .aplayer-pic"),n=new Image;n.src=this.extractValue(t.style.backgroundImage),n.onload=()=>{e.style.backgroundImage=t.style.backgroundImage,e.className="show"}}setLoadingScreen(e,t){const n=setInterval((()=>{this.addEventListeners();document.querySelector("#Music-page .aplayer-pic")&&(e.style.display="none",clearInterval(n),this.addEventListenerChangeMusicBg(),t.style.display="block")}),100)}extractValue(e){const t=/url\("([^"]+)"\)/.exec(e);return t?t[1]:""}addEventListenerChangeMusicBg(){const e=document.querySelector("#Music-page meting-js").aplayer;e.on("loadeddata",(()=>this.changeMusicBg(!0))),e.on("timeupdate",this.lrcUpdate.bind(this))}lrcUpdate(){const e=document.querySelector(".aplayer-lrc-contents"),t=e.querySelector("p.aplayer-lrc-current");if(t){const n=Array.from(e.children).indexOf(t);e.style.transform=`translateY(${80*-n}px)`}}handleKeydown(e){const t=document.querySelector("meting-js").aplayer,n={Space:()=>t.toggle(),ArrowRight:()=>t.skipForward(),ArrowLeft:()=>t.skipBack(),ArrowUp:()=>{t.volume<1&&t.volume(t.volume+.1)},ArrowDown:()=>{t.volume>0&&t.volume(t.volume-.1)}};n[e.code]&&(e.preventDefault(),n[e.code]())}destroy(){document.removeEventListener("keydown",this.handleKeydown)}}function initializeMusicPlayer(){const e=window.scoMusic;e&&e.destroy(),window.scoMusic=new MusicPlayer}
|
package/js/right_menu.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
let selectTextNow="",firstShowRightMenu=!0;const selectText=()=>{selectTextNow=document.selection?document.selection.createRange().text:window.getSelection().toString()||""};document.onmouseup=document.ondbclick=selectText;const rm={mask:document.getElementById("rightmenu-mask"),menu:document.getElementById("rightMenu"),width:0,height:0,domhref:"",domsrc:"",globalEvent:null,menuItems:{other:document.getElementsByClassName("rightMenuOther"),plugin:document.getElementsByClassName("rightMenuPlugin"),back:document.getElementById("menu-backward"),forward:document.getElementById("menu-forward"),refresh:document.getElementById("menu-refresh"),top:document.getElementById("menu-top"),copy:document.getElementById("menu-copytext"),paste:document.getElementById("menu-pastetext"),comment:document.getElementById("menu-commenttext"),new:document.getElementById("menu-newwindow"),copyLink:document.getElementById("menu-copylink"),copyImg:document.getElementById("menu-copyimg"),downloadImg:document.getElementById("menu-downloadimg"),search:document.getElementById("menu-search"),barrage:document.getElementById("menu-commentBarrage"),mode:document.getElementById("menu-darkmode"),translate:document.getElementById("menu-translate"),music:[document.getElementById("menu-music-toggle"),document.getElementById("menu-music-back"),document.getElementById("menu-music-forward"),document.getElementById("menu-music-copyMusicName")]},showRightMenu(e,t=0,m=0){this.menu.style.top=`${m}px`,this.menu.style.left=`${t}px`,this.menu.style.display=e?"block":"none",this.mask.style.display=e?"flex":"none",e&&stopMaskScroll()},hideRightMenu(){this.showRightMenu(!1)},reLoadSize(){this.menu.style.display="block",this.width=this.menu.offsetWidth,this.height=this.menu.offsetHeight,this.menu.style.display="none"},copyText(e){navigator.clipboard&&(navigator.clipboard.writeText(e),utils.snackbarShow(GLOBAL_CONFIG.lang.copy.success,!1,2e3)),this.hideRightMenu()},async downloadImage(e=this.domsrc,t="photo"){try{const m=await fetch(e),n=await m.blob(),o=URL.createObjectURL(n),r=document.createElement("a");r.href=o,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(o)}catch(e){utils.snackbarShow(GLOBAL_CONFIG.right_menu.img_error,!1,2e3)}},copyImage(e=this.domsrc){window.open(e)},mode(e){document.querySelector(".menu-darkmode-text").textContent=e?GLOBAL_CONFIG.right_menu.mode.light:GLOBAL_CONFIG.right_menu.mode.dark,this.hideRightMenu()},barrage(e){document.querySelector(".menu-commentBarrage-text").textContent=e?GLOBAL_CONFIG.right_menu.barrage.open:GLOBAL_CONFIG.right_menu.barrage.close,this.hideRightMenu()}};function stopMaskScroll(){const e=rm.hideRightMenu.bind(rm);utils.addEventListenerPjax(rm.menu,"mousewheel",e,{passive:!0}),utils.addEventListenerPjax(rm.mask,"mousewheel",e,{passive:!0}),utils.addEventListenerPjax(rm.mask,"click",e,{passive:!0})}window.oncontextmenu=e=>{if(document.body.clientWidth<=768)return;if(GLOBAL_CONFIG.right_menu.ctrlOriginalMenu&&(firstShowRightMenu&&(firstShowRightMenu=!1,utils.snackbarShow(GLOBAL_CONFIG.right_menu.ctrlOriginalMenu,!1,2e3)),e.ctrlKey))return!0;let t=e.clientX+10,m=e.clientY;Array.from(rm.menuItems.other).forEach((e=>e.style.display="flex")),rm.globalEvent=e;const n=e.target.href,o=e.target.currentSrc,r=e.target.tagName.toLowerCase(),i=e.target.className.toLowerCase(),c=!(!selectTextNow||!window.getSelection())||!!n||!!o||"input"===r||"textarea"===r||i.match(/aplayer/);return rm.menuItems.copy.style.display=selectTextNow&&window.getSelection()?"flex":"none",GLOBAL_CONFIG.comment&&(rm.menuItems.comment.style.display=selectTextNow&&window.getSelection()?"flex":"none"),rm.menuItems.search&&(rm.menuItems.search.style.display=selectTextNow&&window.getSelection()?"flex":"none"),rm.menuItems.new.style.display=n?"flex":"none",rm.menuItems.copyLink.style.display=n?"flex":"none",rm.domhref=n||"",rm.menuItems.copyImg.style.display=o?"flex":"none",rm.menuItems.downloadImg.style.display=o?"flex":"none",rm.domsrc=o||"",rm.menuItems.paste.style.display="input"===r||"textarea"===r?"flex":"none",GLOBAL_CONFIG.right_menu.music&&(i.match(/aplayer/)?rm.menuItems.music.forEach((e=>e.style.display="flex")):rm.menuItems.music.forEach((e=>e.style.display="none"))),Array.from(c?rm.menuItems.other:rm.menuItems.plugin).forEach((e=>e.style.display="none")),Array.from(c?rm.menuItems.plugin:rm.menuItems.other).forEach((e=>e.style.display="block")),rm.reLoadSize(),t=t+rm.width>window.innerWidth?t-(rm.width+10):t,m=m+rm.height>window.innerHeight?m-(m+rm.height-window.innerHeight):m,rm.showRightMenu(!0,t,m),!1},function(){const e=(e,t,m)=>e.addEventListener(t,m);e(rm.menuItems.back,"click",(()=>window.history.back()||rm.hideRightMenu())),e(rm.menuItems.forward,"click",(()=>window.history.forward()||rm.hideRightMenu())),e(rm.menuItems.refresh,"click",(()=>window.location.reload())),e(rm.menuItems.top,"click",(()=>sco.toTop()||rm.hideRightMenu())),GLOBAL_CONFIG.right_menu.music&&(e(rm.menuItems.music[0],"click",(()=>{sco.musicToggle(),rm.hideRightMenu()})),e(rm.menuItems.music[1],"click",(()=>{document.querySelector("meting-js").aplayer.skipBack(),rm.hideRightMenu()})),e(rm.menuItems.music[2],"click",(()=>{document.querySelector("meting-js").aplayer.skipForward(),rm.hideRightMenu()})),e(rm.menuItems.music[3],"click",(()=>{const e=Array.from(document.querySelectorAll(".aplayer-title")).map((e=>e.innerText))[0];rm.copyText(e)}))),e(rm.menuItems.copy,"click",(()=>{GLOBAL_CONFIG.copyright&&selectTextNow.length>GLOBAL_CONFIG.right_menu.limit&&(selectTextNow+=`\n\n${GLOBAL_CONFIG.right_menu.author}\n${GLOBAL_CONFIG.right_menu.link}${window.location.href}\n${GLOBAL_CONFIG.right_menu.source}\n${GLOBAL_CONFIG.right_menu.info}`),rm.copyText(selectTextNow)})),null!==utils.saveToLocal.get("commentBarrageSwitch")&&rm.menuItems.barrage&&rm.barrage(!utils.saveToLocal.get("commentBarrageSwitch")),e(rm.menuItems.paste,"click",(()=>rm.pasteText()&&rm.hideRightMenu())),GLOBAL_CONFIG.comment&&e(rm.menuItems.comment,"click",(()=>rm.hideRightMenu()||sco.toTalk(selectTextNow))),e(rm.menuItems.new,"click",(()=>window.open(rm.domhref)&&rm.hideRightMenu())),e(rm.menuItems.downloadImg,"click",(()=>rm.downloadImage()&&rm.hideRightMenu())),e(rm.menuItems.copyImg,"click",(()=>rm.copyImage()&&rm.hideRightMenu())),e(rm.menuItems.copyLink,"click",(()=>rm.copyText(rm.domhref)&&rm.hideRightMenu()))}();
|
package/js/search/algolia.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
document.addEventListener("DOMContentLoaded",(function(){const e=document.getElementById("search-mask"),t=document.querySelector("#algolia-search .search-dialog");window.openSearch=()=>{utils.animateIn(e,"to_show 0.5s"),t.style.display="flex",setTimeout((()=>{document.querySelector("#algolia-search .ais-SearchBox-input").focus()}),100),document.addEventListener("keydown",(function e(t){"Escape"===t.code&&(a(),document.removeEventListener("keydown",e))})),i(),window.addEventListener("resize",i)};const a=()=>{utils.animateOut(t,"search_close .5s"),utils.animateOut(e,"to_hide 0.5s"),window.removeEventListener("resize",i)},i=()=>{window.innerWidth<768&&t.style.setProperty("--search-height",window.innerHeight+"px")};document.addEventListener("keydown",(function(e){e.ctrlKey&&"k"===e.key&&(e.preventDefault(),openSearch())}));const n=()=>{utils.addEventListenerPjax(document.querySelector("#search-button > .search"),"click",openSearch),GLOBAL_CONFIG.right_menu&&document.getElementById("menu-search").addEventListener("click",(function(){rm.hideRightMenu(),openSearch();let e=document.getElementsByClassName("ais-SearchBox-input")[0],t=document.createEvent("HTMLEvents");t.initEvent("input",!0,!0),e.value=selectTextNow,e.dispatchEvent(t)}))},s=GLOBAL_CONFIG.algolia;if(!(s.appId&&s.apiKey&&s.indexName))return console.error("Algolia setting is invalid!");const o=instantsearch({indexName:s.indexName,searchClient:algoliasearch.algoliasearch(s.appId,s.apiKey),searchFunction(e){if(e.state.query){let t=`<div class="loading">${GLOBAL_CONFIG.lang.search.loading}</div>`;document.getElementById("algolia-hits").innerHTML=t,e.search()}else document.getElementById("algolia-hits").innerHTML=""}}),l=instantsearch.widgets.configure({hitsPerPage:s.hits.per_page||5}),r=instantsearch.widgets.searchBox({container:"#algolia-search-input",showReset:!1,showSubmit:!1,placeholder:GLOBAL_CONFIG.lang.search.placeholder,showLoadingIndicator:!1,searchAsYouType:!0}),c=instantsearch.widgets.hits({container:"#algolia-hits",templates:{item(e){const t=e.permalink?e.permalink:GLOBAL_CONFIG.root+e.path,a=e._highlightResult,i=document.querySelector("#algolia-hits .loading");return i&&(i.style.display="none"),setTimeout((()=>{document.querySelector("#algolia-search .ais-SearchBox-input").focus()}),200),`\n <a href="${t}" class="algolia-hit-item-link">\n <span class="algolia-hits-item-title">${a.title.value||"no-title"}</span>\n </a>`},empty:function(e){const t=document.querySelector("#algolia-hits .loading");return t&&(t.style.display="none"),setTimeout((()=>{document.querySelector("#algolia-search .ais-SearchBox-input").focus()}),200),'<div id="algolia-hits-empty">'+GLOBAL_CONFIG.lang.search.empty.replace(/\$\{query}/,e.query)+"</div>"}},cssClasses:{item:"algolia-hit-item"}}),d=instantsearch.widgets.pagination({container:"#algolia-pagination",totalPages:s.hits.per_page??5,scrollTo:!1,showFirstLast:!1,templates:{first:'<i class="solitude fas fa-angles-left"></i>',last:'<i class="solitude fas fa-angles-right"></i>',previous:'<i class="solitude fas fa-angle-left"></i>',next:'<i class="solitude fas fa-angle-right"></i>'},cssClasses:{root:"pagination",item:"pagination-item",link:"page-number",active:"current",disabled:"disabled-item"}}),h=instantsearch.widgets.stats({container:"#algolia-tips > #algolia-stats",templates:{text:function(e){return`<hr>${GLOBAL_CONFIG.lang.search.hit.replace(/\$\{hits}/,e.nbHits).replace(/\$\{time}/,e.processingTimeMS)}`}}});o.addWidgets([l,r,h,c,d]),o.start(),n(),e.addEventListener("click",a),document.querySelector("#algolia-search .search-close-button").addEventListener("click",a),window.addEventListener("pjax:complete",(()=>{!utils.isHidden(e)&&a(),n()})),window.pjax&&o.on("render",(()=>{window.pjax.refresh(document.getElementById("algolia-hits"))}))}));
|
@@ -0,0 +1 @@
|
|
1
|
+
window.addEventListener("load",(()=>{let e=[];const t=document.getElementById("search-mask"),n=document.querySelector("#local-search .search-dialog");window.openSearch=()=>{utils.animateIn(t,"to_show 0.5s"),n.style.display="flex",setTimeout((()=>{document.querySelector("#local-search .search-box-input").focus()}),100),document.addEventListener("keydown",(function e(t){"Escape"===t.code&&(s(),document.removeEventListener("keydown",e))})),c(),window.addEventListener("resize",c)};const c=()=>{window.innerWidth<768&&n.style.setProperty("--search-height",window.innerHeight+"px")},s=()=>{utils.animateOut(n,"search_close .5s"),utils.animateOut(t,"to_hide 0.5s"),window.removeEventListener("resize",c)};(()=>{const e=document.querySelectorAll("#local-search .tag-list");e.length>0&&e.forEach((e=>e.addEventListener("click",(e=>s()))))})();document.addEventListener("keydown",(function(e){e.ctrlKey&&"k"===e.key&&(e.preventDefault(),openSearch())}));t.addEventListener("click",s),utils.addEventListenerPjax(document.querySelector("#local-search .search-close-button"),"click",s);const a=()=>{utils.addEventListenerPjax(document.querySelector("#search-button > .search"),"click",openSearch),GLOBAL_CONFIG.right_menu&&document.getElementById("menu-search").addEventListener("click",(function(){rm.hideRightMenu(),openSearch();let e=document.getElementsByClassName("search-box-input")[0],t=document.createEvent("HTMLEvents");t.initEvent("input",!0,!0),e.value=selectTextNow,e.dispatchEvent(t)}))};a();let o="",i=0;let l=[];function r(){const t=document.getElementById("search-results");document.getElementById("search-input").addEventListener("input",(function(n){t.innerHTML="",o=this.value.trim(),""!==o?(l=function(t){const n=new RegExp(t.split("").join(".*"),"i");return e.filter((e=>n.test(e.title)||n.test(e.content)))}(o),d(l,i),function(e){const t=Math.ceil(e/10),n=document.getElementById("search-pagination");n.innerHTML="";const c=document.createElement("ul");c.className="pagination-list";for(let e=0;e<t;e++){const t=document.createElement("li");t.className="pagination-item",t.textContent=e+1,e===i&&t.classList.add("select"),t.addEventListener("click",(function(){i=e,d(l,e),document.querySelectorAll(".pagination-item").forEach((function(e){e.classList.remove("select")})),t.classList.add("select")})),c.appendChild(t)}n.appendChild(c)}(l.length)):function(){const e=document.getElementById("search-results"),t=document.getElementById("search-pagination"),n=document.getElementById("search-tips");e.innerHTML="",t.innerHTML="",n.innerHTML=""}()}))}function d(e,t){const n=document.getElementById("search-results");n.innerHTML="";const c=document.getElementById("search-tips");c.innerHTML="";const s=10*t,a=s+10;if(!e.length){const e=document.createElement("span");return e.className="search-result-empty",e.textContent=GLOBAL_CONFIG.lang.search.empty.replace(/\$\{query}/,o),void n.appendChild(e)}e.slice(s,a).forEach((function(e){const t=document.createElement("li");t.className="search-result-item";const c=document.createElement("a");c.className="search-result-title",c.href=e.link,c.innerHTML=function(e,t){const n=new RegExp(`(${t.split(" ").join("|")})`,"gi");return e.replace(n,"<em>$1</em>")}(e.title,o),t.appendChild(c),n.appendChild(t)}));const i=document.createElement("span");i.className="search-result-count",i.innerHTML=GLOBAL_CONFIG.lang.search.count.replace(/\$\{count}/,e.length),c.appendChild(i)}fetch(GLOBAL_CONFIG.localsearch.path).then((e=>e.text())).then((t=>{let n=(new DOMParser).parseFromString(t,"text/xml").getElementsByTagName("entry");for(let t=0;t<n.length;t++){let c=n[t],s=c.getElementsByTagName("title")[0].textContent,a=c.getElementsByTagName("url")[0].textContent,o=c.getElementsByTagName("content")[0].textContent;e.push({title:s,link:a,content:o})}})).catch((e=>console.error("Error loading search data:",e))),r(),window.addEventListener("DOMContentLoaded",(e=>{r()})),window.addEventListener("pjax:complete",(()=>{a()}))}));
|
@@ -0,0 +1,98 @@
|
|
1
|
+
/**
|
2
|
+
* Barrage Comment
|
3
|
+
* author: @everfu
|
4
|
+
* date: 2024-04-28
|
5
|
+
*/
|
6
|
+
class Barrage {
|
7
|
+
constructor(comments) {
|
8
|
+
this.comments = comments;
|
9
|
+
this.dom = document.querySelector('.comment-barrage');
|
10
|
+
this.barrageList = [];
|
11
|
+
this.barrageIndex = 0;
|
12
|
+
this.barrageTimer = [];
|
13
|
+
this.hoverOnCommentBarrage = false;
|
14
|
+
this.init();
|
15
|
+
}
|
16
|
+
|
17
|
+
filterAndFlatten(comments) {
|
18
|
+
return comments.flatMap(comment => comment.replies ? [comment, ...this.filterAndFlatten(comment.replies)] : [comment]);
|
19
|
+
}
|
20
|
+
|
21
|
+
sanitizeContent(content) {
|
22
|
+
return content.replace(/(<([^>]+)>)/ig, '').trim();
|
23
|
+
}
|
24
|
+
|
25
|
+
createBarrageItem(comment) {
|
26
|
+
const sanitizedContent = this.sanitizeContent(comment.content);
|
27
|
+
if (!sanitizedContent) return false;
|
28
|
+
|
29
|
+
const barrageItem = document.createElement('div');
|
30
|
+
barrageItem.className = 'comment-barrage-item';
|
31
|
+
barrageItem.innerHTML = `
|
32
|
+
<div class="barrageHead">
|
33
|
+
<a class="barrageTitle" href="javascript:sco.scrollTo('post-comment')">
|
34
|
+
${GLOBAL_CONFIG.lang.barrage.title}
|
35
|
+
</a>
|
36
|
+
<div class="barrageNick">${comment.nick}</div>
|
37
|
+
<img class="barrageAvatar" src="${GLOBAL_CONFIG.comment.avatar}/avatar/${comment.mailMd5}" />
|
38
|
+
<a class="comment-barrage-close" href="javascript:sco.switchCommentBarrage();">
|
39
|
+
<i class="solitude st-close-fill"></i>
|
40
|
+
</a>
|
41
|
+
</div>
|
42
|
+
<a class="barrageContent" href="${comment.id ? `javascript:sco.scrollTo('${comment.id}')` : 'javascript:sco.scrollTo(\'post-comment\')'}">
|
43
|
+
${sanitizedContent}
|
44
|
+
</a>
|
45
|
+
|
46
|
+
`;
|
47
|
+
this.dom.appendChild(barrageItem);
|
48
|
+
this.barrageTimer.push(barrageItem);
|
49
|
+
return true;
|
50
|
+
}
|
51
|
+
|
52
|
+
removeBarrageItem(barrageItem) {
|
53
|
+
barrageItem.classList.add('out');
|
54
|
+
setTimeout(() => this.dom.removeChild(barrageItem), 1000);
|
55
|
+
}
|
56
|
+
|
57
|
+
manageBarrage() {
|
58
|
+
if (this.barrageList.length && !this.hoverOnCommentBarrage) {
|
59
|
+
if (!this.createBarrageItem(this.barrageList[this.barrageIndex])) {
|
60
|
+
this.barrageIndex = (this.barrageIndex + 1) % this.barrageList.length;
|
61
|
+
this.manageBarrage();
|
62
|
+
}
|
63
|
+
this.barrageIndex = (this.barrageIndex + 1) % this.barrageList.length;
|
64
|
+
}
|
65
|
+
if (this.barrageTimer.length > Math.min(1, this.barrageList.length) && !this.hoverOnCommentBarrage) {
|
66
|
+
this.removeBarrageItem(this.barrageTimer.shift());
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
initBarrage() {
|
71
|
+
const isBarrageEnabled = utils.saveToLocal.get('commentBarrageSwitch');
|
72
|
+
this.dom.style.display = isBarrageEnabled ? 'flex' : 'none';
|
73
|
+
this.barrageList = this.filterAndFlatten(this.comments);
|
74
|
+
this.dom.innerHTML = '';
|
75
|
+
clearInterval(this.commentInterval);
|
76
|
+
this.commentInterval = setInterval(() => this.manageBarrage(), 5000);
|
77
|
+
}
|
78
|
+
|
79
|
+
init() {
|
80
|
+
this.initBarrage();
|
81
|
+
this.dom.addEventListener('mouseover', () => this.hoverOnCommentBarrage = true);
|
82
|
+
this.dom.addEventListener('mouseout', () => this.hoverOnCommentBarrage = false);
|
83
|
+
}
|
84
|
+
|
85
|
+
destroy() {
|
86
|
+
clearInterval(this.commentInterval);
|
87
|
+
this.dom.removeEventListener('mouseover', () => this.hoverOnCommentBarrage = true);
|
88
|
+
this.dom.removeEventListener('mouseout', () => this.hoverOnCommentBarrage = false);
|
89
|
+
this.dom.innerHTML = '';
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
function initializeCommentBarrage(comments) {
|
94
|
+
if (comments.length === 0) return;
|
95
|
+
let existingBarrage = window.currentBarrage;
|
96
|
+
if (existingBarrage) existingBarrage.destroy();
|
97
|
+
window.currentBarrage = new Barrage(comments);
|
98
|
+
}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/**
|
2
|
+
* EasyDanmaku v1.0.0
|
3
|
+
* author: @Lea321
|
4
|
+
*/
|
5
|
+
class EasyDanmaku{constructor(t){this.container=this.checkParams(t),this.pathname=t.page||null,this.wrapperStyle=t.wrapperStyle||null,this.line=t.line||10,this.speed=t.speed||5,this.runtime=t.runtime||10,this.colourful=t.colourful||!1,this.loop=t.loop||!1,this.hover=t.hover||!1,this.coefficient=t.coefficient||1.38,this.originIndex=0,this.originList=null,this.offsetValue=this.container.offsetHeight/this.line,this.vipIndex=0,this.overflowArr=[],this.clearIng=!1,this.cleartimer=null,this.init(),this.handleEvents(t)}handleEvents(t){this.onComplete=t.onComplete||null,this.onHover=t.onHover||null}init(){this.runstatus=1,this.aisle=[],this.container.style.overflow="hidden",this.hover&&this.handleMouseHover(),"relative"!==Utils.getStyle(this.container,"position")&&"fixed"!==Utils.getStyle(this.container,"position")&&(this.container.style.position="relative");for(let t=0;t<this.line;t++)this.aisle.push({normalRow:!0,vipRow:!0})}checkParams(t){if(!document.querySelector(t.el))throw`Could not find the ${t.el} element`;if(t.wrapperStyle&&"string"!=typeof t.wrapperStyle)throw"The type accepted by the wrapperStyle parameter is string";if(t.line&&"number"!=typeof t.line)throw"The type accepted by the line parameter is number";if(t.speed&&"number"!=typeof t.speed)throw"The type accepted by the speed parameter is number";if(t.colourful&&"boolean"!=typeof t.colourful)throw"The type accepted by the colourful parameter is boolean";if(t.runtime&&"number"!=typeof t.runtime)throw"The type accepted by the runtime parameter is number";if(t.loop&&"boolean"!=typeof t.loop)throw"The type accepted by the loop parameter is boolean";if(t.coefficient&&"number"!=typeof t.coefficient)throw"The type accepted by the coefficient parameter is number";if(t.hover&&"boolean"!=typeof t.hover)throw"The type accepted by the hover parameter is boolean";if(t.onComplete&&"function"!=typeof t.onComplete)throw"The type accepted by the onComplete parameter is function";if(t.onHover&&"function"!=typeof t.onHover)throw"The type accepted by the onHover parameter is function";return document.querySelector(t.el)}send(t,e=null,i=null){if(0==this.runstatus)return void this.overflowArr.push({content:t,normalClass:e});if(t.length<1)return;this.offsetValue=this.container.offsetHeight/this.line;let n=document.createElement("div"),r=0,s=this.speed,o=null,l=0;n.innerHTML=t,n.style.display="inline-block",n.classList.add("default-style"),(e||this.wrapperStyle)&&n.classList.add(e||this.wrapperStyle),function a(){if(r=Math.round(Math.random()*(this.line-1)),this.aisle[r].normalRow){this.aisle[r].normalRow=!1,this.container.appendChild(n),s+=n.offsetWidth/n.parentNode.offsetWidth*2,n.style.cssText=`\n text-align:center;\n min-width:130px;\n will-change: transform;\n position:absolute;\n right: -${n.offsetWidth+130}px;\n transition: transform ${s}s linear;\n transform: translateX(-${n.parentNode.offsetWidth+n.offsetWidth+130}px);\n top: ${r*this.offsetValue}px;\n line-height:${this.offsetValue}px;\n color:${this.colourful?"#"+("00000"+(16777216*Math.random()|0).toString(16)).substr(-6):void 0}\n `;let t=(n.parentNode.offsetWidth+n.offsetWidth)/s/60;o=setInterval((()=>{l+=t,l>n.offsetWidth*this.coefficient&&(this.aisle[r].normalRow=!0,clearInterval(o))}),16.66),setTimeout((()=>{1!=n.getAttribute("relieveDel")&&(i&&i({runtime:s,target:n,width:n.offsetWidth}),n.remove())}),1e3*s)}else{this.aisle.some((t=>!0===t.normalRow))?a.call(this):(()=>{this.overflowArr.push({content:t,normalClass:e}),this.clearIng||this.clearOverflowDanmakuArray()})()}}.call(this)}batchSend(t,e=!1,i=null){let n=this.runtime||1.23*t.length;this.originList=t,this.hasAvatar=e,this.normalClass=i;let r=setInterval((()=>{location.pathname!=this.pathname&&clearInterval(r),this.originIndex>t.length-1?(clearInterval(r),this.originIndex=0,this.onComplete&&this.onComplete(),this.loop&&this.batchSend(this.originList,e,i)):(e?this.send(`${t[this.originIndex].url?'<a href="'+t[this.originIndex].url+'">':""}<img src=${t[this.originIndex].avatar}>\n <p>${t[this.originIndex].content}</p>${t[this.originIndex].url?"</a>":""}\n `,i||this.wrapperStyle):this.send(t[this.originIndex],i||this.wrapperStyle),this.originIndex++)}),n/t.length*1e3)}centeredSend(t,e,i=3e3,n=null){let r=document.createElement("div"),s=0;r.innerHTML=t,(e||this.wrapperStyle)&&r.classList.add(e||this.wrapperStyle),function t(){if(this.aisle[s].vipRow)this.container.appendChild(r),r.style.cssText=`\n position:absolute;\n left:50%;\n transform:translateX(-50%);\n top: ${s*this.offsetValue}px;\n `,this.aisle[s].vipRow=!1,setTimeout((()=>{n&&n({duration:i,target:r,width:r.offsetWidth}),r.remove(),this.aisle[s].vipRow=!0}),i);else{if(s++,s>this.line-1)return;t.call(this)}}.call(this)}play(){const t=this.container.children;for(let e=0;e<t.length;e++)this.controlDanmakurunStatus(t[e],1);this.runstatus=1,0!==this.overflowArr.length&&this.clearOverflowDanmakuArray()}pause(){const t=this.container.children;for(let e=0;e<t.length;e++)this.controlDanmakurunStatus(t[e],0);this.runstatus=0}controlDanmakurunStatus(t,e){const i=0,n=/-(\S*),/;if(e===1){clearTimeout(t.timer);const e=Utils.getStyle(t,"transform").match(n)[1];t.style.transition=`transform ${this.speed}s linear`,t.style.transform=`translateX(-${t.parentNode.offsetWidth+parseInt(e)+t.offsetWidth+130}px)`,t.timer=setTimeout((()=>{t.remove()}),1e3*this.speed)}else if(e===i){clearTimeout(t.timer);const e=Utils.getStyle(t,"transform").match(n)[1];t.style.transition="transform 0s linear",t.style.transform=`translateX(-${e}px)`,t.setAttribute("relieveDel",1)}}handleMouseHover(){Utils.eventDelegation(this.container,"default-style","mouseover",(t=>{t.style["z-index"]=1e3,this.controlDanmakurunStatus(t,0),this.onHover&&this.onHover(t)})),Utils.eventDelegation(this.container,"default-style","mouseout",(t=>{t.style.zIndex=1,1==this.runstatus&&this.controlDanmakurunStatus(t,1)}))}clearOverflowDanmakuArray(){clearInterval(this.cleartimer),this.clearIng=!0;let t=0;this.cleartimer=setInterval((()=>{0===this.overflowArr.length?(t++,t>20&&(clearInterval(this.cleartimer),this.clearIng=!1)):(this.send(this.overflowArr[0].content,this.overflowArr[0].normalClass||this.wrapperStyle),this.overflowArr.shift())}),500)}}class Utils{static getStyle(t,e){return window.getComputedStyle(t,null)[e]}static eventDelegation(t,e,i,n){t.addEventListener(i,(t=>{try{t.target.className.includes(e)?n(t.target):t.target.parentNode.className.includes(e)&&n(t.target.parentNode)}catch(t){}}))}}
|
@@ -0,0 +1,184 @@
|
|
1
|
+
class POST_AI {
|
2
|
+
constructor() {
|
3
|
+
this.root = "https://summary.tianli0.top";
|
4
|
+
this.aiTalkMode = false;
|
5
|
+
this.aiPostExplanation = '';
|
6
|
+
this.config = GLOBAL_CONFIG.post_ai;
|
7
|
+
this.scoGPTIsRunning = false;
|
8
|
+
console.log('%c TianliGPT %c 文章摘要 %c https://postchat.zhheo.com',
|
9
|
+
'background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff',
|
10
|
+
'background:#ff9a9a ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff',
|
11
|
+
'background:unset ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff');
|
12
|
+
}
|
13
|
+
|
14
|
+
init() {
|
15
|
+
const explanationElement = document.querySelector(".ai-explanation");
|
16
|
+
if (!explanationElement) return;
|
17
|
+
|
18
|
+
this.scoGPTIsRunning = false;
|
19
|
+
this.aiPostExplanation = PAGE_CONFIG.ai_text || '';
|
20
|
+
|
21
|
+
if (!this.aiPostExplanation) {
|
22
|
+
this.generate();
|
23
|
+
} else {
|
24
|
+
this.aiShowAnimation(Promise.resolve(this.aiPostExplanation));
|
25
|
+
}
|
26
|
+
this.AIEngine();
|
27
|
+
}
|
28
|
+
|
29
|
+
getTitleAndContent() {
|
30
|
+
const articleContainer = document.querySelector(".article-container");
|
31
|
+
const title = document.title;
|
32
|
+
const paragraphs = articleContainer.getElementsByTagName("p");
|
33
|
+
const headers = articleContainer.querySelectorAll("h1, h2, h3, h4, h5");
|
34
|
+
|
35
|
+
return (title + " " + [...headers, ...paragraphs]
|
36
|
+
.map(element => element.innerText.replace(/https?:\/\/[^\s]+/g, ""))
|
37
|
+
.join(" ")).slice(0, 1000);
|
38
|
+
}
|
39
|
+
|
40
|
+
async generate() {
|
41
|
+
const title = document.title;
|
42
|
+
const content = this.getTitleAndContent();
|
43
|
+
const key = this.config.key;
|
44
|
+
this.aiShowAnimation(this.fetch(title, content, key));
|
45
|
+
}
|
46
|
+
|
47
|
+
async fetch(title, content, key) {
|
48
|
+
const url = `${this.root}/?content=${encodeURIComponent(content)}&title=${title}&key=${encodeURIComponent(key)}&url=${encodeURIComponent(window.location.href)}`;
|
49
|
+
try {
|
50
|
+
const response = await fetch(url);
|
51
|
+
const data = await response.json();
|
52
|
+
if (response.ok) {
|
53
|
+
this.aiPostExplanation = data.summary;
|
54
|
+
return data.summary;
|
55
|
+
} else {
|
56
|
+
console.error("Request failed:", data.err_msg);
|
57
|
+
return data.err_msg;
|
58
|
+
}
|
59
|
+
} catch (error) {
|
60
|
+
console.error("Fetch error:", error);
|
61
|
+
return "Error fetching data";
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
aiShowAnimation(promise, onComplete = false, delay = 0) {
|
66
|
+
const explanationElement = document.querySelector(".ai-explanation");
|
67
|
+
const tagElement = document.querySelector(".ai-tag");
|
68
|
+
if (!explanationElement || this.scoGPTIsRunning) return;
|
69
|
+
|
70
|
+
this.scoGPTIsRunning = true;
|
71
|
+
this.cleanSuggestions();
|
72
|
+
tagElement.classList.add("loadingAI");
|
73
|
+
explanationElement.style.display = "block";
|
74
|
+
explanationElement.innerHTML = '生成中...<span class="blinking-cursor"></span>';
|
75
|
+
|
76
|
+
setTimeout(() => {
|
77
|
+
let startTime, update, currentIndex = 0, isIntersecting = true, isInitial = true;
|
78
|
+
const observer = new IntersectionObserver(entries => {
|
79
|
+
isIntersecting = entries[0].isIntersecting;
|
80
|
+
if (isIntersecting) requestAnimationFrame(update);
|
81
|
+
}, { threshold: 0 });
|
82
|
+
|
83
|
+
promise.then(result => {
|
84
|
+
startTime = performance.now();
|
85
|
+
update = () => {
|
86
|
+
if (currentIndex < result.length && isIntersecting) {
|
87
|
+
const now = performance.now();
|
88
|
+
const timeElapsed = now - startTime;
|
89
|
+
const char = result.slice(currentIndex, currentIndex + 1);
|
90
|
+
const isPunctuation = /[,。!、?,.!?]/.test(char);
|
91
|
+
const isAlphaNumeric = /[a-zA-Z0-9]/.test(char);
|
92
|
+
const delay = isPunctuation ? 100 * Math.random() + 100 : (isAlphaNumeric ? 10 : 25);
|
93
|
+
|
94
|
+
if (timeElapsed >= delay) {
|
95
|
+
explanationElement.innerText = result.slice(0, currentIndex + 1);
|
96
|
+
startTime = now;
|
97
|
+
currentIndex++;
|
98
|
+
if (currentIndex < result.length) {
|
99
|
+
explanationElement.innerHTML = result.slice(0, currentIndex) + '<span class="blinking-cursor"></span>';
|
100
|
+
} else {
|
101
|
+
explanationElement.innerHTML = result;
|
102
|
+
explanationElement.style.display = "block";
|
103
|
+
this.scoGPTIsRunning = false;
|
104
|
+
tagElement.classList.remove("loadingAI");
|
105
|
+
observer.disconnect();
|
106
|
+
if (onComplete) this.createSuggestions();
|
107
|
+
}
|
108
|
+
}
|
109
|
+
if (isIntersecting) requestAnimationFrame(update);
|
110
|
+
}
|
111
|
+
};
|
112
|
+
if (isIntersecting && isInitial) {
|
113
|
+
requestAnimationFrame(update);
|
114
|
+
isInitial = false;
|
115
|
+
}
|
116
|
+
observer.observe(explanationElement);
|
117
|
+
}).catch(error => {
|
118
|
+
console.error("检索信息失败:", error);
|
119
|
+
explanationElement.innerHTML = "检索信息失败";
|
120
|
+
explanationElement.style.display = "block";
|
121
|
+
this.scoGPTIsRunning = false;
|
122
|
+
tagElement.classList.remove("loadingAI");
|
123
|
+
observer.disconnect();
|
124
|
+
});
|
125
|
+
}, delay);
|
126
|
+
}
|
127
|
+
|
128
|
+
AIEngine() {
|
129
|
+
const tagElement = document.querySelector(".ai-tag");
|
130
|
+
if (tagElement) {
|
131
|
+
tagElement.addEventListener("click", () => {
|
132
|
+
if (!this.scoGPTIsRunning) {
|
133
|
+
this.aiTalkMode = true;
|
134
|
+
this.aiShowAnimation(Promise.resolve(this.config.talk), true);
|
135
|
+
}
|
136
|
+
});
|
137
|
+
}
|
138
|
+
}
|
139
|
+
|
140
|
+
cleanSuggestions() {
|
141
|
+
const suggestionsElement = document.querySelector(".ai-suggestions");
|
142
|
+
if (suggestionsElement) {
|
143
|
+
suggestionsElement.innerHTML = "";
|
144
|
+
} else {
|
145
|
+
console.error("没有这个元素:'ai-suggestions'");
|
146
|
+
}
|
147
|
+
}
|
148
|
+
|
149
|
+
createSuggestions() {
|
150
|
+
if (this.aiTalkMode) {
|
151
|
+
this.cleanSuggestions();
|
152
|
+
this.createSuggestionItemWithAction("这篇文章讲了什么?", () => {
|
153
|
+
if (this.aiPostExplanation === "") {
|
154
|
+
setTimeout(() => {
|
155
|
+
this.generate();
|
156
|
+
}, 3000);
|
157
|
+
} else {
|
158
|
+
setTimeout(() => {
|
159
|
+
this.aiShowAnimation(Promise.resolve(this.aiPostExplanation), true);
|
160
|
+
}, 3000);
|
161
|
+
}
|
162
|
+
});
|
163
|
+
if (this.config.randomPost) {
|
164
|
+
this.createSuggestionItemWithAction("带我去看看其他文章", () => toRandomPost());
|
165
|
+
}
|
166
|
+
this.aiTalkMode = true;
|
167
|
+
}
|
168
|
+
}
|
169
|
+
|
170
|
+
createSuggestionItemWithAction(text, action) {
|
171
|
+
const suggestions = document.querySelector(".ai-suggestions");
|
172
|
+
if (!suggestions) {
|
173
|
+
console.error("无法找到具有class为ai-suggestions的元素");
|
174
|
+
return;
|
175
|
+
}
|
176
|
+
const item = document.createElement("div");
|
177
|
+
item.classList.add("ai-suggestions-item");
|
178
|
+
item.textContent = text;
|
179
|
+
item.addEventListener("click", action);
|
180
|
+
suggestions.appendChild(item);
|
181
|
+
}
|
182
|
+
}
|
183
|
+
|
184
|
+
const ai = new POST_AI();
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/**
|
2
|
+
* @name: Universe
|
3
|
+
* author: Leonus
|
4
|
+
*/
|
5
|
+
function dark(){window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;var t,i,e,s,n=.05,h=document.getElementById("universe"),a=!0,o="226,225,224",r=[];function d(){t=window.innerWidth,i=window.innerHeight,e=.216*t,h.setAttribute("width",t),h.setAttribute("height",i)}function c(){s.clearRect(0,0,t,i);for(var e=r.length,n=0;n<e;n++){var h=r[n];h.move(),h.fadeIn(),h.fadeOut(),h.draw()}}function f(){this.reset=function(){this.giant=u(3),this.comet=!this.giant&&!a&&u(10),this.x=m(0,t-10),this.y=m(0,i),this.r=m(1.1,2.6),this.dx=m(n,6*n)+(this.comet+1-1)*n*m(50,120)+.1,this.dy=-m(n,6*n)-(this.comet+1-1)*n*m(50,120),this.fadingOut=null,this.fadingIn=!0,this.opacity=0,this.opacityTresh=m(.2,1-.4*(this.comet+1-1)),this.do=m(5e-4,.002)+.001*(this.comet+1-1)},this.fadeIn=function(){this.fadingIn&&(this.fadingIn=!(this.opacity>this.opacityTresh),this.opacity+=this.do)},this.fadeOut=function(){this.fadingOut&&(this.fadingOut=!(this.opacity<0),this.opacity-=this.do/2,(this.x>t||this.y<0)&&(this.fadingOut=!1,this.reset()))},this.draw=function(){if(s.beginPath(),this.giant)s.fillStyle="rgba(180,184,240,"+this.opacity+")",s.arc(this.x,this.y,2,0,2*Math.PI,!1);else if(this.comet){s.fillStyle="rgba("+o+","+this.opacity+")",s.arc(this.x,this.y,1.5,0,2*Math.PI,!1);for(var t=0;t<30;t++)s.fillStyle="rgba("+o+","+(this.opacity-this.opacity/20*t)+")",s.rect(this.x-this.dx/4*t,this.y-this.dy/4*t-2,2,2),s.fill()}else s.fillStyle="rgba(226,225,142,"+this.opacity+")",s.rect(this.x,this.y,this.r,this.r);s.closePath(),s.fill()},this.move=function(){this.x+=this.dx,this.y+=this.dy,!1===this.fadingOut&&this.reset(),(this.x>t-t/4||this.y<0)&&(this.fadingOut=!0)},setTimeout((function(){a=!1}),50)}function u(t){return Math.floor(1e3*Math.random())+1<10*t}function m(t,i){return Math.random()*(i-t)+t}d(),window.addEventListener("resize",d,!1),function(){s=h.getContext("2d");for(var t=0;t<e;t++)r[t]=new f,r[t].reset();c()}(),function t(){"dark"==document.getElementsByTagName("html")[0].getAttribute("data-theme")&&c(),window.requestAnimationFrame(t)}()}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright 2024 Ever Funnel. All rights reserved.
|
3
|
+
* Licensed under the MIT License.
|
4
|
+
*/
|
5
|
+
function waterfall(t){function e(t,e){var n=window.getComputedStyle(t);return parseFloat(n["margin"+e])||0}function n(t){return t+"px"}function r(t){return parseFloat(t.style.top)||0}function o(t){return parseFloat(t.style.left)||0}function i(t){return t.clientWidth}function l(t){return t.clientHeight}function u(t){return r(t)+l(t)+e(t,"Bottom")}function a(t){return o(t)+i(t)+e(t,"Right")}function s(t){t.sort(function(t,e){var n=u(t),r=u(e);return n===r?o(e)-o(t):r-n})}function f(e){var containerWidth = i(t);i(t)!==containerWidth&&(window.removeEventListener(e.type,f),waterfall(t))}"string"==typeof t&&(t=document.querySelector(t));var c=Array.from(t.children).map(function(t){return(t.style.position="absolute"),t});t.style.position="relative";var p=Array.from(t.querySelectorAll("img")),y=p.map(function(t){return new Promise(function(e){t.complete?e():(t.addEventListener("load",e),t.addEventListener("error",e))})});return Promise.all(y).then(function(){var r=[];c.length&&(c[0].style.top="0px",c[0].style.left=n(e(c[0],"Left")),r.push(c[0]));for(var l=1;l<c.length;l++){var p=c[l-1],y=c[l];if(!(a(p)+i(y)<=i(t)))break;y.style.top=p.style.top;y.style.left=n(a(p));r.push(y)}for(var v=r.length;v<c.length;v++){s(r);var d=c[v],h=r.pop();d.style.top=n(u(h)+e(d,"Top"));d.style.left=n(o(h));r.push(d)}s(r);var m=r[0];t.style.height=n(u(m)+e(m,"Bottom"));i(t);window.addEventListener("resize",f)})}
|