-
Notifications
You must be signed in to change notification settings - Fork 0
/
bundle.js
24 lines (24 loc) · 15.7 KB
/
bundle.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function Debouncer(e){this.callback=e,this.ticking=!1}window.requestAnimationFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame,Fluid.utils={listenScroll:function(e){return e=new Debouncer(e),window.addEventListener("scroll",e,!1),e.handleEvent(),e},unlistenScroll:function(e){window.removeEventListener("scroll",e)},scrollToElement:function(e,t){(e=jQuery(e).offset())&&jQuery("html,body").animate({scrollTop:e.top+(t||0),easing:"swing"})},elementVisible:function(e,t){t=t&&0<=t?t:0;var e=e.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight,i=e.top;return 0<=i&&i<=n*(t+1)||i<=0&&i>=-n*t-e.height},waitElementVisible:function(e,n,i){var t="undefined"!=typeof window,o=t&&!("onscroll"in window)||"undefined"!=typeof navigator&&/(gle|ing|ro|msn)bot|crawl|spider|yand|duckgo/i.test(navigator.userAgent);function r(e){var t;Fluid.utils.elementVisible(e,i)?n():"IntersectionObserver"in window?new IntersectionObserver(function(e,t){e[0].isIntersecting&&(n(),t.disconnect())},{threshold:[0],rootMargin:(window.innerHeight||document.documentElement.clientHeight)*i+"px"}).observe(e):t=Fluid.utils.listenScroll(function(){Fluid.utils.elementVisible(e,i)&&(Fluid.utils.unlistenScroll(t),n())})}t&&!o&&(i=i&&0<=i?i:0,"string"==typeof e?this.waitElementLoaded(e,function(e){r(e)}):r(e))},waitElementLoaded:function(i,o){var e="undefined"!=typeof window,t=e&&!("onscroll"in window)||"undefined"!=typeof navigator&&/(gle|ing|ro|msn)bot|crawl|spider|yand|duckgo/i.test(navigator.userAgent);e&&!t&&("MutationObserver"in window?new MutationObserver(function(e,t){var n=document.querySelector(i);n&&(o(n),t.disconnect())}).observe(document,{childList:!0,subtree:!0}):document.addEventListener("DOMContentLoaded",function(){!function e(){var t=document.querySelector(i);t?o(t):setTimeout(e,100)}()}))},createScript:function(e,t){var n=document.createElement("script");n.setAttribute("src",e),n.setAttribute("type","text/javascript"),n.setAttribute("charset","UTF-8"),n.async=!1,"function"==typeof t&&(window.attachEvent?n.onreadystatechange=function(){var e=n.readyState;"loaded"!==e&&"complete"!==e||(n.onreadystatechange=null,t())}:n.onload=t),(e=0<(e=document.getElementsByTagName("script")).length?e[e.length-1]:document.head||document.documentElement).parentNode.insertBefore(n,e.nextSibling)},createCssLink:function(e){var t=document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("type","text/css"),t.setAttribute("href",e),(e=document.getElementsByTagName("link")[0]||document.getElementsByTagName("head")[0]||document.head||document.documentElement).parentNode.insertBefore(t,e)},loadComments:function(e,t){var n=document.querySelector("#comments[lazyload]");n?Fluid.utils.waitElementVisible(e,function(){t(),n.removeAttribute("lazyload")},CONFIG.lazyload.offset_factor):t()},getBackgroundLightness(e){var t=e;return(e=((t="string"==typeof e?document.querySelector(e):t).ownerDocument.defaultView||window).getComputedStyle(t).backgroundColor.replace(/rgba*\(/,"").replace(")","").split(/,\s*/)).length<3?0:0==(t=.213*e[0]+.715*e[1]+.072*e[2])||127.5<t?1:-1},retry(e,t,n){var i;n<=0||(i=function(){0<=--n&&!e()&&setTimeout(i,t)},setTimeout(i,t))}},Debouncer.prototype={constructor:Debouncer,update:function(){this.callback&&this.callback(),this.ticking=!1},requestTick:function(){this.ticking||(requestAnimationFrame(this.rafCallback||(this.rafCallback=this.update.bind(this))),this.ticking=!0)},handleEvent:function(){this.requestTick()}};;
!function(n,s){var l=s.documentElement,u="Fluid_Color_Scheme",t="--color-mode",d="data-user-color-scheme",r="data-default-color-scheme",g="#color-toggle-icon";function h(e){try{return localStorage.getItem(e)}catch(e){return null}}function a(){var e=getComputedStyle(l).getPropertyValue(t);return"string"==typeof e?e.replace(/["'\s]/g,""):null}function m(){l.setAttribute(d,v());var e=u;try{localStorage.removeItem(e)}catch(e){}}var f={dark:!0,light:!0};function v(){var e="string"==typeof(e=l.getAttribute(r))?e.replace(/["'\s]/g,""):null;return f[e]?e:(e=a(),f[e]?e:18<=(e=(new Date).getHours())||0<=e&&e<=6?"dark":"light")}function i(e){var t,r;if((e=e||h(u)||v())===v())m();else{if(!f[e])return m();l.setAttribute(d,e)}var a=e,i=(f[a]&&(t=y("dark"),a&&(t=y(a)),(i=s.querySelector(g))?(i.setAttribute("class","iconfont "+t),i.setAttribute("data",b[a])):Fluid.utils.waitElementLoaded(g,function(){var e=s.querySelector(g);e&&(e.setAttribute("class","iconfont "+t),e.setAttribute("data",b[a]))})),e),o=s.getElementById("highlight-css"),c=s.getElementById("highlight-css-dark"),o=("dark"===i?(c&&c.removeAttribute("disabled"),o&&o.setAttribute("disabled","")):(o&&o.removeAttribute("disabled"),c&&c.setAttribute("disabled","")),setTimeout(function(){s.querySelectorAll(".markdown-body pre").forEach(e=>{var t=0<=Fluid.utils.getBackgroundLightness(e)?"code-widget-light":"code-widget-dark";(e=e.querySelector(".code-widget-light, .code-widget-dark"))&&(e.classList.remove("code-widget-light","code-widget-dark"),e.classList.add(t))})},200),e);n.REMARK42&&n.REMARK42.changeTheme(o),n.CUSDIS&&n.CUSDIS.setTheme(o),(c=s.querySelector(".utterances-frame"))&&(r={type:"set-theme",theme:"dark"===o?n.UtterancesThemeDark:n.UtterancesThemeLight},c.contentWindow.postMessage(r,"https://utteranc.es")),(c=s.querySelector("iframe.giscus-frame"))&&(r={setConfig:{theme:"dark"===o?n.GiscusThemeDark:n.GiscusThemeLight}},c.contentWindow.postMessage({giscus:r},"https://giscus.app"))}var b={dark:"light",light:"dark"};function y(e){return"icon-"+e}i(),Fluid.utils.waitElementLoaded(g,function(){i();var t,e=s.querySelector("#color-toggle-btn");e&&(e.addEventListener("click",function(){i(function(){var e=h(u);if(f[e])e=b[e];else{if(null!==e)return;(t=s.querySelector(g))&&(e=t.getAttribute("data")),t&&f[e]||(e=b[a()])}var t=u,r=e;try{localStorage.setItem(t,r)}catch(e){}return e}())}),(t=s.querySelector(g))&&(e.addEventListener("mouseenter",function(){var e=t.getAttribute("data");t.classList.replace(y(b[e]),y(e))}),e.addEventListener("mouseleave",function(){var e=t.getAttribute("data");t.classList.replace(y(e),y(b[e]))})))})}(window,document);;
HTMLElement.prototype.wrap=function(o){this.parentNode.insertBefore(o,this),this.parentNode.removeChild(this),o.appendChild(this)},Fluid.events={registerNavbarEvent:function(){var o,e=jQuery("#navbar");0!==e.length&&(o=jQuery("#navbar .dropdown-menu"),0<e.offset().top&&(e.removeClass("navbar-dark"),o.removeClass("navbar-dark")),Fluid.utils.listenScroll(function(){e[50<e.offset().top?"addClass":"removeClass"]("top-nav-collapse"),o[50<e.offset().top?"addClass":"removeClass"]("dropdown-collapse"),0<e.offset().top?e.removeClass("navbar-dark"):e.addClass("navbar-dark"),o.removeClass("navbar-dark")}),jQuery("#navbar-toggler-btn").on("click",function(){jQuery(".animated-icon").toggleClass("open"),jQuery("#navbar").toggleClass("navbar-col-show")}))},registerParallaxEvent:function(){var n,r=jQuery('#banner[parallax="true"]');0!==r.length&&0!==(n=jQuery("#board")).length&&Fluid.utils.listenScroll(function(){var o=jQuery(window).scrollTop()/5,e=96+parseInt(n.css("margin-top"),10);r.css({transform:"translate3d(0,"+(o=e<o?e:o)+"px,0)"}),(e=jQuery(".side-col"))&&e.css({"padding-top":o+"px"})})},registerScrollDownArrowEvent:function(){var o=jQuery(".scroll-down-bar");0!==o.length&&o.on("click",function(){Fluid.utils.scrollToElement("#board",-jQuery("#navbar").height())})},registerScrollTopArrowEvent:function(){var e,n,r,o,t,a=jQuery("#scroll-top-button");0!==a.length&&0!==(e=jQuery("#board")).length&&(r=n=!1,(o=function(){var o=e[0].getClientRects()[0].right,o=document.body.offsetWidth-o;n=50<=o,a.css({bottom:n&&r?"20px":"-60px",right:o-64+"px"})})(),jQuery(window).resize(o),t=e.offset().top,Fluid.utils.listenScroll(function(){var o=document.body.scrollTop+document.documentElement.scrollTop;r=t<=o,a.css({bottom:n&&r?"20px":"-60px"})}),a.on("click",function(){jQuery("body,html").animate({scrollTop:0,easing:"swing"})}))},registerImageLoadedEvent:function(){if("NProgress"in window){var o,e=document.getElementById("banner");e&&(e=e.style.backgroundImage.match(/\((.*?)\)/)[1].replace(/(['"])/g,""),(o=new Image).onload=function(){window.NProgress&&window.NProgress.inc(.2)},o.src=e,o.complete&&o.onload());var n=(e=jQuery("main img:not([lazyload])")).length;for(const o of e){const r=o.onload;o.onload=function(){r&&r(),window.NProgress&&window.NProgress.inc(.5/n)},o.complete&&o.onload()}}},billboard:function(){"console"in window&&console.log(`
------------------------------------------------
| |
| ________ __ _ __ |
| |_ __ |[ | (_) | ] |
| | |_ \\_| | | __ _ __ .--.| | |
| | _| | |[ | | | [ |/ /'\`\\' | |
| _| |_ | | | \\_/ |, | || \\__/ | |
| |_____| [___]'.__.'_/[___]'.__.;__] |
| |
| Powered by Hexo x Fluid |
| GitHub: https://git.io/JqpVD |
| |
------------------------------------------------
`)}};;
HTMLElement.prototype.wrap=function(e){this.parentNode.insertBefore(e,this),this.parentNode.removeChild(this),e.appendChild(this)},Fluid.plugins={typing:function(e){var a;"Typed"in window&&((a=new window.Typed("#subtitle",{strings:[" ",e+" "],cursorChar:CONFIG.typing.cursorChar,typeSpeed:CONFIG.typing.typeSpeed,loop:CONFIG.typing.loop})).stop(),(e=document.getElementById("subtitle"))&&(e.innerText=""),jQuery(document).ready(function(){a.start()}))},fancyBox:function(e){CONFIG.image_zoom.enable&&"fancybox"in jQuery&&(jQuery(e||".markdown-body :not(a) > img, .markdown-body > img").each(function(){var e,a,t=jQuery(this),n=t.attr("data-src")||t.attr("src")||"",i=(CONFIG.image_zoom.img_url_replace&&(a=(e=CONFIG.image_zoom.img_url_replace)[0]||"",e=e[1]||"",a&&(n=/^re:/.test(a)?(a=a.replace(/^re:/,""),i=new RegExp(a,"gi"),n.replace(i,e)):n.replace(a,e))),t.wrap(`
<a class="fancybox fancybox.image" href="${n}"
itemscope itemtype="http://schema.org/ImageObject" itemprop="url"></a>`).parent("a"));0!==i.length&&(t.is(".group-image-container img")?i.attr("data-fancybox","group").attr("rel","group"):i.attr("data-fancybox","default").attr("rel","default"),(a=t.attr("title")||t.attr("alt"))&&i.attr("title",a).attr("data-caption",a))}),jQuery.fancybox.defaults.hash=!1,jQuery(".fancybox").fancybox({loop:!0,helpers:{overlay:{locked:!1}}}))},imageCaption:function(e){CONFIG.image_caption.enable&&jQuery(e||`.markdown-body > p > img, .markdown-body > figure > img,
.markdown-body > p > a.fancybox, .markdown-body > figure > a.fancybox`).each(function(){var e=jQuery(this),a=e.next("figcaption");0!==a.length?a.addClass("image-caption"):(a=e.attr("title")||e.attr("alt"))&&e.after(`<figcaption aria-hidden="true" class="image-caption">${a}</figcaption>`)})},codeWidget(){var t,n=CONFIG.code_language.enable&&CONFIG.code_language.default,i=CONFIG.copy_btn&&"ClipboardJS"in window;(n||i)&&(t="",t+='<div class="code-widget">LANG</div>',jQuery(".markdown-body pre").each(function(){var e,a=jQuery(this);0<a.find("code.mermaid").length||0<a.find("span.line").length||(e="",n&&(e=CONFIG.code_language.default,0<a[0].children.length&&2<=a[0].children[0].classList.length&&a.children().hasClass("hljs")?e=a[0].children[0].classList[1]:a[0].getAttribute("data-language")?e=a[0].getAttribute("data-language"):a.parent().hasClass("sourceCode")&&0<a[0].children.length&&2<=a[0].children[0].classList.length?(e=a[0].children[0].classList[1],a.parent().addClass("code-wrapper")):a.parent().hasClass("markdown-body")&&0===a[0].classList.length&&a.wrap('<div class="code-wrapper"></div>'),e=e.toUpperCase().replace("NONE",CONFIG.code_language.default)),a.append(t.replace("LANG",e).replace('code-widget">',(e=a[0],(0<=Fluid.utils.getBackgroundLightness(e)?"code-widget-light":"code-widget-dark")+(i?' code-widget copy-btn" data-clipboard-snippet><i class="iconfont icon-copy"></i>':' code-widget">')))),i&&new ClipboardJS(".copy-btn",{target:function(e){for(var a=e.parentNode.childNodes,t=0;t<a.length;t++)if("CODE"===a[t].tagName)return a[t]}}).on("success",function(e){e.clearSelection(),e.trigger.innerHTML=e.trigger.innerHTML.replace("icon-copy","icon-success"),setTimeout(function(){e.trigger.innerHTML=e.trigger.innerHTML.replace("icon-success","icon-copy")},2e3)}))}))}};;
window;for(const a of document.querySelectorAll("img[lazyload]"))Fluid.utils.waitElementVisible(a,function(){a.removeAttribute("srcset"),a.removeAttribute("lazyload")},CONFIG.lazyload.offset_factor);;
!function(){var e=jQuery("#modalSearch"),t="#local-search-input",r="#local-search-result";e.on("show.bs.modal",function(){!function(e){"use strict";var r=jQuery("#local-search-input"),l=jQuery("#local-search-result");if(0===r.length)throw Error("No element selected by the searchSelector");if(0===l.length)throw Error("No element selected by the resultSelector");-1===l.attr("class").indexOf("list-group-item")&&l.html('<div class="m-auto text-center"><div class="spinner-border" role="status"><span class="sr-only">Loading...</span></div><br/>Loading...</div>'),jQuery.ajax({url:e,dataType:"xml",success:function(e){var t=jQuery("entry",e).map(function(){return{title:jQuery("title",this).text(),content:jQuery("content",this).text(),url:jQuery("url",this).text()}}).get();-1===l.html().indexOf("list-group-item")&&l.html(""),r.on("input",function(){var e=r.val(),u="",h=e.trim().toLowerCase().split(/[\s-]+/);return l.html(""),e.trim().length<=0?r.removeClass("invalid").removeClass("valid"):(t.forEach(function(e){var r,l,s=!0,t=(e.title&&""!==e.title.trim()||(e.title="Untitled"),e.title.trim()),a=t.toLowerCase(),i=e.content.trim().replace(/<[^>]+>/g,""),n=i.toLowerCase(),e=e.url,o=-1,c=-1;""!==n?h.forEach(function(e,t){r=a.indexOf(e),o=n.indexOf(e),r<0&&o<0?s=!1:(o<0&&(o=0),0===t&&(c=o))}):s=!1,s&&(u+="<a href='"+e+"' class='list-group-item list-group-item-action font-weight-bolder search-list-title'>"+t+"</a>",0<=c&&(e=c+80,(e=0===(t=(t=c-20)<0?0:t)?100:e)>i.length&&(e=i.length),l=i.substring(t,e),h.forEach(function(e){var t=new RegExp(e,"gi");l=l.replace(t,'<span class="search-word">'+e+"</span>")}),u+="<p class='search-list-content'>"+l+"...</p>"))}),-1===u.indexOf("list-group-item")?r.addClass("invalid").removeClass("valid"):(r.addClass("valid").removeClass("invalid"),void l.html(u)))})}})}(CONFIG.search_path||"/local-search.xml")}),e.on("shown.bs.modal",function(){jQuery("#local-search-input").focus()}),e.on("hidden.bs.modal",function(){!function(e,t){"use strict";if(e=jQuery(e),t=jQuery(t),0===e.length)throw Error("No element selected by the searchSelector");if(0===t.length)throw Error("No element selected by the resultSelector");e.val("").removeClass("invalid").removeClass("valid"),t.html("")}(t,r)})}();;
Fluid.boot={},Fluid.boot.registerEvents=function(){Fluid.events.billboard(),Fluid.events.registerNavbarEvent(),Fluid.events.registerParallaxEvent(),Fluid.events.registerScrollDownArrowEvent(),Fluid.events.registerScrollTopArrowEvent(),Fluid.events.registerImageLoadedEvent()},Fluid.boot.refreshPlugins=function(){if(Fluid.plugins.fancyBox(),Fluid.plugins.codeWidget(),"tocbot"in window){tocbot.refresh();var t=jQuery("#toc");if(0===t.length||!tocbot)return;0<t.find(".toc-list-item").length&&t.css("visibility","visible")}if("anchors"in window){anchors.removeAll();var e,n=[];for(e of(CONFIG.anchorjs.element||"h1,h2,h3,h4,h5,h6").split(","))n.push(".markdown-body > "+e.trim());"left"===CONFIG.anchorjs.placement&&(anchors.options.class="anchorjs-link-left"),anchors.add(n.join(", "))}"MathJax"in window&&MathJax.startup.document&&"function"==typeof MathJax.startup.document.state&&(MathJax.startup.document.state(0),MathJax.texReset(),MathJax.typeset(),MathJax.typesetPromise()),"mermaid"in window&&mermaid.init()},document.addEventListener("DOMContentLoaded",function(){Fluid.boot.registerEvents()});