assets/js/dist/commons.min.js in jekyll-theme-chirpy-5.6.0 vs assets/js/dist/commons.min.js in jekyll-theme-chirpy-5.6.1

- old
+ new

@@ -1,6 +1,6 @@ /*! - * Chirpy v5.6.0 (https://github.com/cotes2020/jekyll-theme-chirpy/) + * Chirpy v5.6.1 (https://github.com/cotes2020/jekyll-theme-chirpy/) * © 2019 Cotes Chung * MIT Licensed */ !function(){"use strict";var o=$(".mode-toggle");function e(o,e){if(!(o instanceof e))throw new TypeError("Cannot call a class as a function")}function t(o,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(o,i(n.key),n)}}function n(o,e,n){return e&&t(o.prototype,e),n&&t(o,n),Object.defineProperty(o,"prototype",{writable:!1}),o}function r(o,e,t){return(e=i(e))in o?Object.defineProperty(o,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):o[e]=t,o}function i(o){var e=function(o,e){if("object"!=typeof o||null===o)return o;var t=o[Symbol.toPrimitive];if(void 0!==t){var n=t.call(o,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(o)}(o,"string");return"symbol"==typeof e?e:String(e)}var a=$("body"),l="sidebar-display",s=function(){function o(){e(this,o)}return n(o,null,[{key:"toggle",value:function(){!1===o.isExpanded?a.attr(l,""):a.removeAttr(l),o.isExpanded=!o.isExpanded}}]),o}();r(s,"isExpanded",!1);var c="div.post>h1:first-of-type",u=$(c),f=$("#topbar-title"),d=f.text().trim();var p=$("#sidebar-trigger"),v=$("#search-trigger"),b=$("#search-cancel"),g=$("#main"),k=$("#topbar-title"),h=$("#search-wrapper"),y=$("#search-result-wrapper"),m=$("#search-results"),w=$("#search-input"),C=$("#search-hints"),T=$("html,body"),L="loaded",x="unloaded",I="input-focus",O="d-flex",U=function(){function o(){e(this,o)}return n(o,null,[{key:"on",value:function(){o.offset=window.scrollY,T.scrollTop(0)}},{key:"off",value:function(){T.scrollTop(o.offset)}}]),o}();r(U,"offset",0),r(U,"resultVisible",!1);var S=function(){function o(){e(this,o)}return n(o,null,[{key:"on",value:function(){p.addClass(x),k.addClass(x),v.addClass(x),h.addClass(O),b.addClass(L)}},{key:"off",value:function(){b.removeClass(L),h.removeClass(O),p.removeClass(x),k.removeClass(x),v.removeClass(x)}}]),o}(),E=function(){function o(){e(this,o)}return n(o,null,[{key:"on",value:function(){U.resultVisible||(U.on(),y.removeClass(x),g.addClass(x),U.resultVisible=!0)}},{key:"off",value:function(){U.resultVisible&&(m.empty(),C.hasClass(x)&&C.removeClass(x),y.addClass(x),g.removeClass(x),U.off(),w.val(""),U.resultVisible=!1)}}]),o}();function j(){return b.hasClass(L)}var P="data-topbar-visible",V=$("body"),H=$("#topbar-wrapper"),M=function(){function o(){e(this,o)}return n(o,null,[{key:"hideTopbar",value:function(){V.attr(P,"false")}},{key:"showTopbar",value:function(){V.attr(P,"true")}},{key:"addScrollUpTask",value:function(){o.scrollUpCount+=1,o.topbarIsLocked||(o.topbarIsLocked=!0)}},{key:"popScrollUpTask",value:function(){o.scrollUpCount-=1}},{key:"hasScrollUpTask",value:function(){return o.scrollUpCount>0}},{key:"topbarLocked",value:function(){return!0===o.topbarIsLocked}},{key:"unlockTopbar",value:function(){o.topbarIsLocked=!1}},{key:"getTopbarHeight",value:function(){return H.outerHeight()}},{key:"orientationLocked",value:function(){return!0===o.orientationIsLocked}},{key:"lockOrientation",value:function(){o.orientationIsLocked=!0}},{key:"unLockOrientation",value:function(){o.orientationIsLocked=!1}}]),o}();r(M,"scrollUpCount",0),r(M,"topbarIsLocked",!1),r(M,"orientationIsLocked",!1);var N,R=$("#search-input"),q=M.getTopbarHeight(),A=0;function Y(){0!==$(window).scrollTop()&&(M.lockOrientation(),M.hideTopbar())}function z(){var o=screen.orientation;o?o.onchange=function(){var e=o.type;"landscape-primary"!==e&&"landscape-secondary"!==e||Y()}:$(window).on("orientationchange",(function(){$(window).width()<$(window).height()&&Y()})),$(window).on("scroll",(function(){N||(N=!0)})),setInterval((function(){N&&(!function(){var o=$(window).scrollTop();if(!(Math.abs(A-o)<=q)){if(o>A)M.hideTopbar(),R.is(":focus")&&R.trigger("blur");else if(o+$(window).height()<$(document).height()){if(M.hasScrollUpTask())return;M.topbarLocked()?M.unlockTopbar():M.orientationLocked()?M.unLockOrientation():M.showTopbar()}A=o}}(),N=!1)}),250)}$(window).on("scroll",(function(){$(window).scrollTop()>50&&"none"===$("#sidebar-trigger").css("display")?$("#back-to-top").fadeIn():$("#back-to-top").fadeOut()})),$("#back-to-top").on("click",(function(){return $("body,html").animate({scrollTop:0},800),!1})),$('[data-toggle="tooltip"]').tooltip(),0!==o.length&&o.off().on("click",(function(o){var e=$(o.target),t=e.prop("tagName")==="button".toUpperCase()?e:e.parent();modeToggle.flipMode(),t.trigger("blur")})),$("#sidebar-trigger").on("click",s.toggle),$("#mask").on("click",s.toggle),function(){if(0!==u.length&&!u.hasClass("dynamic-title")&&!f.is(":hidden")){var o=u.text().trim(),e=!1,t=0;($("#page-category").length||$("#page-tag").length)&&/\s/.test(o)&&(o=o.replace(/[0-9]/g,"").trim()),u.offset().top<$(window).scrollTop()&&f.text(o),new IntersectionObserver((function(n){if(e){var r=$(window).scrollTop(),i=t<r;t=r;var a=n[0];i?0===a.intersectionRatio&&f.text(o):1===a.intersectionRatio&&f.text(d)}else e=!0}),{rootMargin:"-48px 0px 0px 0px",threshold:[0,1]}).observe(document.querySelector(c)),f.on("click",(function(){$("body,html").animate({scrollTop:0},800)}))}}(),v.on("click",(function(){S.on(),E.on(),w.trigger("focus")})),b.on("click",(function(){S.off(),E.off()})),w.on("focus",(function(){h.addClass(I)})),w.on("focusout",(function(){h.removeClass(I)})),w.on("input",(function(){""===w.val()?j()?C.removeClass(x):E.off():(E.on(),j()&&C.addClass(x))})),z()}();