/*! * Chirpy v6.2.3 | © 2019 Cotes Chung | MIT Licensed | https://github.com/cotes2020/jekyll-theme-chirpy/ */ !function(){"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n.container>.row"),v=$("#topbar-title"),g=$("search"),b=$("#search-result-wrapper"),h=$("#search-results"),y=$("#search-input"),C=$("#search-hints"),w=$("html,body"),k="loaded",S="unloaded",A="input-focus",T="d-flex",E=function(){function e(){t(this,e)}return n(e,null,[{key:"on",value:function(){e.offset=window.scrollY,w.scrollTop(0)}},{key:"off",value:function(){w.scrollTop(e.offset)}}]),e}();r(E,"offset",0),r(E,"resultVisible",!1);var j=function(){function e(){t(this,e)}return n(e,null,[{key:"on",value:function(){f.addClass(S),v.addClass(S),d.addClass(S),g.addClass(T),p.addClass(k)}},{key:"off",value:function(){p.removeClass(k),g.removeClass(T),f.removeClass(S),v.removeClass(S),d.removeClass(S)}}]),e}(),I=function(){function e(){t(this,e)}return n(e,null,[{key:"on",value:function(){E.resultVisible||(E.on(),b.removeClass(S),m.addClass(S),E.resultVisible=!0)}},{key:"off",value:function(){E.resultVisible&&(h.empty(),C.hasClass(S)&&C.removeClass(S),b.addClass(S),m.removeClass(S),E.off(),y.val(""),E.resultVisible=!1)}}]),e}();function M(){return p.hasClass(k)}$(".collapse");var x=".code-header>button",O="fas fa-check",P="timeout",R="data-title-succeed",U="data-bs-original-title",V=2e3;function q(t){if($(t)[0].hasAttribute(P)){var e=$(t).attr(P);if(Number(e)>Date.now())return!0}return!1}function N(t){$(t).attr(P,Date.now()+V)}function B(t){$(t).removeAttr(P)}var H=$(x).children().attr("class");var z,D,L="data-src",J="data-lqip",Y={SHIMMER:"shimmer",BLUR:"blur"};function F(t){$(this).parent().removeClass(t)}function G(){this.complete&&(this.hasAttribute(J)?F.call(this,Y.BLUR):F.call(this,Y.SHIMMER))}function K(){var t=$(this),e=t.attr(L);t.attr("src",encodeURI(e)),t.removeAttr(L)}z=$(window),D=$("#back-to-top"),z.on("scroll",(function(){z.scrollTop()>50?D.fadeIn():D.fadeOut()})),D.on("click",(function(){z.scrollTop(0)})),o(document.querySelectorAll('[data-bs-toggle="tooltip"]')).map((function(t){return new bootstrap.Tooltip(t)})),0!==l.length&&l.off().on("click",(function(t){var e=$(t.target),n=e.prop("tagName")==="button".toUpperCase()?e:e.parent();modeToggle.flipMode(),n.trigger("blur")})),$("#sidebar-trigger").on("click",s.toggle),$("#mask").on("click",s.toggle),d.on("click",(function(){j.on(),I.on(),y.trigger("focus")})),p.on("click",(function(){j.off(),I.off()})),y.on("focus",(function(){g.addClass(A)})),y.on("focusout",(function(){g.removeClass(A)})),y.on("input",(function(){""===y.val()?M()?C.removeClass(S):I.off():(I.on(),M()&&C.addClass(S))})),function(){var t=$("article img");t.length&&t.on("load",G),$('article img[loading="lazy"]').each((function(){this.complete&&F.call(this,Y.SHIMMER)}));var e=$("article img[".concat(J,'="true"]'));e.length&&e.each(K)}(),$(".popup")<=0||$(".popup").magnificPopup({type:"image",closeOnContentClick:!0,showCloseBtn:!1,zoom:{enabled:!0,duration:300,easing:"ease-in-out"}}),function(){if($(x).length){var t=new ClipboardJS(x,{target:function(t){return t.parentNode.nextElementSibling.querySelector("code .rouge-code")}});o(document.querySelectorAll(x)).map((function(t){return new bootstrap.Tooltip(t,{placement:"left"})})),t.on("success",(function(t){t.clearSelection();var e=t.trigger;q(e)||(!function(t){$(t).children().attr("class",O)}(e),function(t){var e=$(t).attr(R);$(t).attr(U,e).tooltip("show")}(e),N(e),setTimeout((function(){!function(t){$(t).tooltip("hide").removeAttr(U)}(e),function(t){$(t).children().attr("class",H)}(e),B(e)}),V))}))}var e=$("#copy-link");e.on("click",(function(t){var e=$(t.target);q(e)||navigator.clipboard.writeText(window.location.href).then((function(){var t=e.attr(U),n=e.attr(R);e.attr(U,n).tooltip("show"),N(e),setTimeout((function(){e.attr(U,t),B(e)}),V)}))})),e.on("mouseleave",(function(t){$(t.target).tooltip("hide")}))}()}();