assets/js/dist/misc.min.js in jekyll-theme-chirpy-5.6.1 vs assets/js/dist/misc.min.js in jekyll-theme-chirpy-6.0.0

- old
+ new

@@ -1,6 +1,6 @@ /*! - * Chirpy v5.6.1 (https://github.com/cotes2020/jekyll-theme-chirpy/) + * Chirpy v6.0.0 (https://github.com/cotes2020/jekyll-theme-chirpy/) * © 2019 Cotes Chung * MIT Licensed */ -!function(){"use strict";var t=$(".mode-toggle");function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var o=0;o<e.length;o++){var n=e[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,a(n.key),n)}}function n(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function r(t,e,o){return(e=a(e))in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function a(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var o=t[Symbol.toPrimitive];if(void 0!==o){var n=o.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}var i=$("body"),l="sidebar-display",s=function(){function t(){e(this,t)}return n(t,null,[{key:"toggle",value:function(){!1===t.isExpanded?i.attr(l,""):i.removeAttr(l),t.isExpanded=!t.isExpanded}}]),t}();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"),g=$("#search-cancel"),b=$("#main"),h=$("#topbar-title"),m=$("#search-wrapper"),k=$("#search-result-wrapper"),y=$("#search-results"),w=$("#search-input"),T=$("#search-hints"),C=$("html,body"),x="loaded",L="unloaded",I="input-focus",j="d-flex",O=function(){function t(){e(this,t)}return n(t,null,[{key:"on",value:function(){t.offset=window.scrollY,C.scrollTop(0)}},{key:"off",value:function(){C.scrollTop(t.offset)}}]),t}();r(O,"offset",0),r(O,"resultVisible",!1);var U=function(){function t(){e(this,t)}return n(t,null,[{key:"on",value:function(){p.addClass(L),h.addClass(L),v.addClass(L),m.addClass(j),g.addClass(x)}},{key:"off",value:function(){g.removeClass(x),m.removeClass(j),p.removeClass(L),h.removeClass(L),v.removeClass(L)}}]),t}(),S=function(){function t(){e(this,t)}return n(t,null,[{key:"on",value:function(){O.resultVisible||(O.on(),k.removeClass(L),b.addClass(L),O.resultVisible=!0)}},{key:"off",value:function(){O.resultVisible&&(y.empty(),T.hasClass(L)&&T.removeClass(L),k.addClass(L),b.removeClass(L),O.off(),w.val(""),O.resultVisible=!1)}}]),t}();function E(){return g.hasClass(x)}var F="data-topbar-visible",D=$("body"),P=$("#topbar-wrapper"),V=function(){function t(){e(this,t)}return n(t,null,[{key:"hideTopbar",value:function(){D.attr(F,"false")}},{key:"showTopbar",value:function(){D.attr(F,"true")}},{key:"addScrollUpTask",value:function(){t.scrollUpCount+=1,t.topbarIsLocked||(t.topbarIsLocked=!0)}},{key:"popScrollUpTask",value:function(){t.scrollUpCount-=1}},{key:"hasScrollUpTask",value:function(){return t.scrollUpCount>0}},{key:"topbarLocked",value:function(){return!0===t.topbarIsLocked}},{key:"unlockTopbar",value:function(){t.topbarIsLocked=!1}},{key:"getTopbarHeight",value:function(){return P.outerHeight()}},{key:"orientationLocked",value:function(){return!0===t.orientationIsLocked}},{key:"lockOrientation",value:function(){t.orientationIsLocked=!0}},{key:"unLockOrientation",value:function(){t.orientationIsLocked=!1}}]),t}();r(V,"scrollUpCount",0),r(V,"topbarIsLocked",!1),r(V,"orientationIsLocked",!1);var A,H=$("#search-input"),M=V.getTopbarHeight(),N=0;function R(){0!==$(window).scrollTop()&&(V.lockOrientation(),V.hideTopbar())}function _(){var t=screen.orientation;t?t.onchange=function(){var e=t.type;"landscape-primary"!==e&&"landscape-secondary"!==e||R()}:$(window).on("orientationchange",(function(){$(window).width()<$(window).height()&&R()})),$(window).on("scroll",(function(){A||(A=!0)})),setInterval((function(){A&&(!function(){var t=$(window).scrollTop();if(!(Math.abs(N-t)<=M)){if(t>N)V.hideTopbar(),H.is(":focus")&&H.trigger("blur");else if(t+$(window).height()<$(document).height()){if(V.hasScrollUpTask())return;V.topbarLocked()?V.unlockTopbar():V.orientationLocked()?V.unLockOrientation():V.showTopbar()}N=t}}(),A=!1)}),250)}$(".collapse");$(".code-header>button").children().attr("class");var q=function(){function t(){e(this,t)}return n(t,null,[{key:"attrTimestamp",get:function(){return"data-ts"}},{key:"attrDateFormat",get:function(){return"data-df"}},{key:"locale",get:function(){return $("html").attr("lang").substring(0,2)}},{key:"getTimestamp",value:function(e){return Number(e.attr(t.attrTimestamp))}},{key:"getDateFormat",value:function(e){return e.attr(t.attrDateFormat)}}]),t}();$(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!==t.length&&t.off().on("click",(function(t){var e=$(t.target),o=e.prop("tagName")==="button".toUpperCase()?e:e.parent();modeToggle.flipMode(),o.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 t=u.text().trim(),e=!1,o=0;($("#page-category").length||$("#page-tag").length)&&/\s/.test(t)&&(t=t.replace(/[0-9]/g,"").trim()),u.offset().top<$(window).scrollTop()&&f.text(t),new IntersectionObserver((function(n){if(e){var r=$(window).scrollTop(),a=o<r;o=r;var i=n[0];a?0===i.intersectionRatio&&f.text(t):1===i.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(){U.on(),S.on(),w.trigger("focus")})),g.on("click",(function(){U.off(),S.off()})),w.on("focus",(function(){m.addClass(I)})),w.on("focusout",(function(){m.removeClass(I)})),w.on("input",(function(){""===w.val()?E()?T.removeClass(L):S.off():(S.on(),E()&&T.addClass(L))})),_(),dayjs.locale(q.locale),dayjs.extend(window.dayjs_plugin_localizedFormat),$("[".concat(q.attrTimestamp,"]")).each((function(){var t=dayjs.unix(q.getTimestamp($(this))),e=t.format(q.getDateFormat($(this)));$(this).text(e),$(this).removeAttr(q.attrTimestamp),$(this).removeAttr(q.attrDateFormat);var o=$(this).attr("data-toggle");if(void 0!==o&&"tooltip"===o){var n=t.format("llll");$(this).attr("data-original-title",n)}}))}(); +!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 r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,i(n.key),n)}}function r(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function n(t,e,r){return(e=i(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return a(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return a(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function i(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}var l=$(".mode-toggle");var s=$("body"),u="sidebar-display",c=function(){function e(){t(this,e)}return r(e,null,[{key:"toggle",value:function(){!1===e.isExpanded?s.attr(u,""):s.removeAttr(u),e.isExpanded=!e.isExpanded}}]),e}();n(c,"isExpanded",!1);var f=$("#sidebar-trigger"),d=$("#search-trigger"),m=$("#search-cancel"),p=$("#main>.row"),v=$("#topbar-title"),b=$("#search-wrapper"),g=$("#search-result-wrapper"),y=$("#search-results"),h=$("#search-input"),w=$("#search-hints"),C=$("html,body"),k="loaded",T="unloaded",j="input-focus",A="d-flex",S=function(){function e(){t(this,e)}return r(e,null,[{key:"on",value:function(){e.offset=window.scrollY,C.scrollTop(0)}},{key:"off",value:function(){C.scrollTop(e.offset)}}]),e}();n(S,"offset",0),n(S,"resultVisible",!1);var x=function(){function e(){t(this,e)}return r(e,null,[{key:"on",value:function(){f.addClass(T),v.addClass(T),d.addClass(T),b.addClass(A),m.addClass(k)}},{key:"off",value:function(){m.removeClass(k),b.removeClass(A),f.removeClass(T),v.removeClass(T),d.removeClass(T)}}]),e}(),E=function(){function e(){t(this,e)}return r(e,null,[{key:"on",value:function(){S.resultVisible||(S.on(),g.removeClass(T),p.addClass(T),S.resultVisible=!0)}},{key:"off",value:function(){S.resultVisible&&(y.empty(),w.hasClass(T)&&w.removeClass(T),g.addClass(T),p.removeClass(T),S.off(),h.val(""),S.resultVisible=!1)}}]),e}();function F(){return m.hasClass(k)}$(".collapse");$(".code-header>button").children().attr("class");var O=function(){function e(){t(this,e)}return r(e,null,[{key:"attrTimestamp",get:function(){return"data-ts"}},{key:"attrDateFormat",get:function(){return"data-df"}},{key:"locale",get:function(){return $("html").attr("lang").substring(0,2)}},{key:"getTimestamp",value:function(t){return Number(t.attr(e.attrTimestamp))}},{key:"getDateFormat",value:function(t){return t.attr(e.attrDateFormat)}}]),e}();$(window).on("scroll",(function(){$(window).scrollTop()>50?$("#back-to-top").fadeIn():$("#back-to-top").fadeOut()})),$("#back-to-top").on("click",(function(){window.scrollTo(0,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),r=e.prop("tagName")==="button".toUpperCase()?e:e.parent();modeToggle.flipMode(),r.trigger("blur")})),$("#sidebar-trigger").on("click",c.toggle),$("#mask").on("click",c.toggle),d.on("click",(function(){x.on(),E.on(),h.trigger("focus")})),m.on("click",(function(){x.off(),E.off()})),h.on("focus",(function(){b.addClass(j)})),h.on("focusout",(function(){b.removeClass(j)})),h.on("input",(function(){""===h.val()?F()?w.removeClass(T):E.off():(E.on(),F()&&w.addClass(T))})),dayjs.locale(O.locale),dayjs.extend(window.dayjs_plugin_localizedFormat),$("[".concat(O.attrTimestamp,"]")).each((function(){var t=dayjs.unix(O.getTimestamp($(this))),e=t.format(O.getDateFormat($(this)));$(this).text(e),$(this).removeAttr(O.attrTimestamp),$(this).removeAttr(O.attrDateFormat);var r=$(this).attr("data-bs-toggle");if(void 0!==r&&"tooltip"===r){var n=t.format("llll");$(this).attr("data-bs-title",n),new bootstrap.Tooltip($(this))}}))}();