mirror of
https://github.com/davegallant/davegallant.github.io.git
synced 2025-08-06 00:33:39 +00:00
2 lines
6.7 KiB
JavaScript
2 lines
6.7 KiB
JavaScript
!function(e){var t={};function n(o){if(t[o])return t[o].exports;var a=t[o]={i:o,l:!1,exports:{}};return e[o].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";var o=n(1);n(2),$(document).ready(function(){o.Ehlxr.backToTop(),o.Ehlxr.mobileNavbar(),o.Ehlxr.toc(),o.Ehlxr.fancybox(),o.Ehlxr.search()}),o.Ehlxr.flowchart(),o.Ehlxr.sequence(),hljs.initHighlighting(),o.Ehlxr.highlight()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o={};function a(){$("#search-results").empty();var e=$("#search-query").val();e?($("#search-query").css({border:"1px solid #D5D5D5",color:"black"}),function(e){$.getJSON("/index.json",function(t){var n=t,o=new Fuse(n,c),a=o.search(e);a.length>0?($("#search-results").append("<ul></ul>"),function(e,t){$.each(e,function(e,n){var o=n.item.contents,a="",i=[];c.tokenize?i.push(t):$.each(n.matches,function(e,t){"tags"==t.key||"categories"==t.key?i.push(t.value):"contents"==t.key&&(start=t.indices[0][0]-r>0?t.indices[0][0]-r:0,end=t.indices[0][1]+r<o.length?t.indices[0][1]+r:o.length,a+=o.substring(start,end),i.push(t.value.substring(t.indices[0][0],t.indices[0][1]-t.indices[0][0]+1)))}),a.length<1&&(a+=o.substring(0,2*r));var l=$("#search-result-template").html(),s=function(e,t){var n,o;for(n in t)o=new RegExp("\\$\\{\\s*"+n+"\\s*\\}","g"),e=e.replace(o,t[n]);return e}(l,{key:e,title:n.item.title,link:n.item.permalink,tags:n.item.tags,categories:n.item.categories,snippet:a});$("#search-results ul").append(s),$.each(i,function(t,n){$("#summary-"+e).mark(n)})})}(a,e)):$("#search-results").append("<p>No matches found</p>")})}(e)):($("#search-query").css({border:"1px solid #ff0000",color:"#ff0000"}),$("#search-results").append("Please enter a word or phrase above"))}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})})},o.mobileNavbar=function(){var e=$("#mobile-navbar"),t=$(".mobile-navbar-icon"),n=new Slideout({panel:document.getElementById("mobile-panel"),menu:document.getElementById("mobile-menu"),padding:180,tolerance:70});n.disableTouch(),t.click(function(){n.toggle()}),n.on("beforeopen",function(){e.addClass("fixed-open"),t.addClass("icon-click").removeClass("icon-out")}),n.on("beforeclose",function(){e.removeClass("fixed-open"),t.addClass("icon-out").removeClass("icon-click")}),$("#mobile-panel").on("touchend",function(){n.isOpen()&&t.click()})},o._initToc=function(){var e=$(".post-toc"),t=$(".post-toc-title").height()+$(".post-toc-content").height(),n=$(".post-footer");if(e.length){var o=e.offset().top-20-$(".post-header").height()-5,a=n.offset().top-t-20-$(".toc-taxonomy").height(),r={start:{position:"absolute",top:o},process:{position:"fixed",top:20},end:{position:"absolute",top:a}};$(window).scroll(function(){var t=$(window).scrollTop();t<o?e.css(r.start):t>a?e.css(r.end):e.css(r.process)})}var c=$(".toc-link"),i=$(".headerlink"),l=$(".post-toc-content li"),s=$.map(i,function(e){return $(e).offset().top}),d=$.map(s,function(e){return e-30});$(window).scroll(function(){var e=$(window).scrollTop(),t=function(e,t){for(var n=0;n<e.length-1;n++)if(t>e[n]&&t<=e[n+1])return n;return t>e[e.length-1]?e.length-1:-1}(d,e);if($(c).removeClass("active"),$(l).removeClass("has-active"),-1!==t){$(c[t]).addClass("active");for(var n=c[t].parentNode;"NAV"!==n.tagName;)$(n).addClass("has-active"),n=n.parentNode.parentNode}})},o.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}))},o.highlight=function(){for(var e=document.querySelectorAll("pre code"),t=0;t<e.length;t++){var n=e[t],o=n.parentElement,a=n.innerHTML.split(/\n/);""===a[a.length-1]&&a.pop();for(var r=a.length,c="",i=0;i<r;i++)c+='<div class="line">'+(i+1)+"</div>";for(var l="",s=0;s<r;s++)l+='<div class="line">'+a[s]+"</div>";n.className+=" highlight";var d=document.createElement("figure");d.className=n.className,d.innerHTML='<table><tbody><tr><td class="gutter"><pre>'+c+'</pre></td><td class="code"><pre>'+l+"</pre></td></tr></tbody></table>",o.parentElement.replaceChild(d,o)}},o.toc=function(){var e=document.getElementById("post-toc");if(null!==e){var t=document.getElementById("TableOfContents");null===t?(e.removeChild(document.getElementsByClassName("post-toc-title")[0]),e.removeChild(document.getElementsByClassName("post-toc-content")[0])):(this._refactorToc(t),this._linkToc(),this._initToc())}},o._refactorToc=function(e){for(var t=e.children[0],n=t,o=void 0;1===n.children.length&&"UL"===(o=n.children[0].children[0]).tagName;)n=o;n!==t&&e.replaceChild(n,t)},o._linkToc=function(){for(var e=document.querySelectorAll("#TableOfContents a:first-child"),t=0;t<e.length;t++)e[t].className+=" toc-link";for(var n=1;n<=6;n++)for(var o=document.querySelectorAll(".post-content>h"+n),a=0;a<o.length;a++){var r=o[a];r.innerHTML='<a href="#'+r.id+'" class="headerlink"></a>'+r.innerHTML}},o.flowchart=function(){if(window.flowchart)for(var e=document.querySelectorAll("pre code.language-flowchart"),t=0;t<e.length;t++){var n=e[t],o=n.parentElement,a=document.createElement("div"),r="js-flowchart-diagrams-"+t;a.id=r,a.className="align-center",o.parentElement.replaceChild(a,o),flowchart.parse(n.childNodes[0].nodeValue).drawSVG(r,window.flowchartDiagramsOptions?window.flowchartDiagramsOptions:{})}},o.sequence=function(){if(window.Diagram)for(var e=document.querySelectorAll("pre code.language-sequence"),t=0;t<e.length;t++){var n=e[t],o=n.parentElement,a=document.createElement("div"),r="js-sequence-diagrams-"+t;a.id=r,a.className="align-center",o.parentElement.replaceChild(a,o),Diagram.parse(n.childNodes[0].nodeValue).drawSVG(r,window.sequenceDiagramsOptions?window.sequenceDiagramsOptions:{theme:"simple"})}},o.search=function(){$("#search-query").bind("keypress",function(e){"13"==e.keyCode&&a()}).on("click",function(){$("#search-query").css({border:"1px solid #D5D5D5",color:"black"})}).on("keyup",function(){a()}),$("#query-icon").on("click",function(){a()})};var r=60,c={shouldSort:!0,includeMatches:!0,threshold:0,tokenize:!0,location:0,distance:100,maxPatternLength:32,minMatchCharLength:1,keys:[{name:"title",weight:.8},{name:"contents",weight:.9},{name:"tags",weight:.3},{name:"categories",weight:.3}]};t.Ehlxr=o},function(e,t){}]);
|
|
//# sourceMappingURL=ehlxr.min.js.map
|