hugo-theme-even/static/dist/even.9c524851.min.js

2 lines
No EOL
5.6 KiB
JavaScript

!function(e){var n={};function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:o})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(t.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var r in e)t.d(o,r,function(n){return e[n]}.bind(null,r));return o},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=3)}([,function(e,n,t){},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o={backToTop:function(){var e=$("#back-to-top");$(window).scroll(function(){$(window).scrollTop()>100?e.fadeIn(1e3):e.fadeOut(1e3)}),e.click(function(){$("body,html").animate({scrollTop:0})})},mobileNavbar:function(){var e=$("#mobile-navbar"),n=$(".mobile-navbar-icon"),t=new Slideout({panel:document.getElementById("mobile-panel"),menu:document.getElementById("mobile-menu"),padding:180,tolerance:70});t.disableTouch(),n.click(function(){t.toggle()}),t.on("beforeopen",function(){e.addClass("fixed-open"),n.addClass("icon-click").removeClass("icon-out")}),t.on("beforeclose",function(){e.removeClass("fixed-open"),n.addClass("icon-out").removeClass("icon-click")}),$("#mobile-panel").on("touchend",function(){t.isOpen()&&n.click()})},_initToc:function(){var e=$(".post-toc"),n=$(".post-footer");if(e.length){var t=e.offset().top-20,o=n.offset().top-e.height()-20,r={start:{position:"absolute",top:t},process:{position:"fixed",top:20},end:{position:"absolute",top:o}};$(window).scroll(function(){var n=$(window).scrollTop();n<t?e.css(r.start):n>o?e.css(r.end):e.css(r.process)})}var a=$(".toc-link"),l=$(".headerlink"),i=$(".post-toc-content li"),c=$.map(l,function(e){return $(e).offset().top}),s=$.map(c,function(e){return e-30});$(window).scroll(function(){var e=$(window).scrollTop(),n=function(e,n){for(var t=0;t<e.length-1;t++)if(n>e[t]&&n<=e[t+1])return t;return n>e[e.length-1]?e.length-1:-1}(s,e);if($(a).removeClass("active"),$(i).removeClass("has-active"),-1!==n){$(a[n]).addClass("active");for(var t=a[n].parentNode;"NAV"!==t.tagName;)$(t).addClass("has-active"),t=t.parentNode.parentNode}})},fancybox:function(){$.fancybox&&($(".post-content").each(function(){$(this).find("img").each(function(){$(this).wrap('<a class="fancybox" href="'+this.src+'" data-fancybox="gallery" data-caption="'+this.title+'"></a>')})}),$(".fancybox").fancybox({selector:".fancybox",protect:!0}))},highlight:function(){for(var e=document.querySelectorAll("pre code"),n=0;n<e.length;n++){var t=e[n],o=t.parentElement,r=t.innerHTML.split(/\n/);""===r[r.length-1]&&r.pop();for(var a=r.length,l="",i=0;i<a;i++)l+='<div class="line">'+(i+1)+"</div>";for(var c="",s=0;s<a;s++)c+='<div class="line">'+r[s]+"</div>";t.className+=" highlight";var d=document.createElement("figure");d.className=t.className,d.innerHTML='<table><tbody><tr><td class="gutter"><pre>'+l+'</pre></td><td class="code"><pre>'+c+"</pre></td></tr></tbody></table>",o.parentElement.replaceChild(d,o)}},chroma:function(){for(var e=document.querySelectorAll(".highlight > .chroma"),n=0;n<e.length;n++){var t=e[n],o=t.querySelector("pre.chroma > code"),r=o?o.className:"";t.className+=" "+r}},toc:function(){var e=document.getElementById("post-toc");if(null!==e){var n=document.getElementById("TableOfContents");null===n?e.parentNode.removeChild(e):(this._refactorToc(n),this._linkToc(),this._initToc())}},_refactorToc:function(e){for(var n=e.children[0],t=n,o=void 0;1===t.children.length&&"UL"===(o=t.children[0].children[0]).tagName;)t=o;t!==n&&e.replaceChild(t,n)},_linkToc:function(){for(var e=document.querySelectorAll("#TableOfContents a:first-child"),n=0;n<e.length;n++)e[n].className+=" toc-link";for(var t=1;t<=6;t++)for(var o=document.querySelectorAll(".post-content>h"+t),r=0;r<o.length;r++){var a=o[r];a.innerHTML='<a href="#'+a.id+'" class="headerlink"></a>'+a.innerHTML}},flowchart:function(){if(window.flowchart)for(var e=document.querySelectorAll("pre code.language-flowchart"),n=0;n<e.length;n++)if(window.hljs||n%2!=0){var t=e[n],o=window.hljs?t.parentElement:t.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement,r=document.createElement("div"),a="js-flowchart-diagrams-"+n;r.id=a,r.className="align-center",o.parentElement.replaceChild(r,o),flowchart.parse(t.childNodes[0].nodeValue).drawSVG(a,window.flowchartDiagramsOptions?window.flowchartDiagramsOptions:{})}},sequence:function(){if(window.Diagram)for(var e=document.querySelectorAll("pre code.language-sequence"),n=0;n<e.length;n++)if(window.hljs||n%2!=0){var t=e[n],o=window.hljs?t.parentElement:t.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement,r=document.createElement("div"),a="js-sequence-diagrams-"+n;r.id=a,r.className="align-center",o.parentElement.replaceChild(r,o),Diagram.parse(t.childNodes[0].nodeValue).drawSVG(a,window.sequenceDiagramsOptions?window.sequenceDiagramsOptions:{theme:"simple"})}}};n.Even=o},function(e,n,t){"use strict";var o=t(2);t(1),$(document).ready(function(){o.Even.backToTop(),o.Even.mobileNavbar(),o.Even.toc(),o.Even.fancybox()}),o.Even.flowchart(),o.Even.sequence(),window.hljs?(hljs.initHighlighting(),o.Even.highlight()):o.Even.chroma()}]);
//# sourceMappingURL=even.9c524851.min.js.map