aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--layouts/partials/head.html2
-rw-r--r--layouts/partials/scripts.html2
-rw-r--r--src/js/even.js5
-rw-r--r--src/package.json2
-rw-r--r--static/dist/even.min.js2
-rw-r--r--static/dist/even.min.js.map2
6 files changed, 8 insertions, 7 deletions
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index d721a57..ed233bf 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -62,7 +62,7 @@
{{- end }}
<!-- Styles -->
-<link href="{{ "dist/even.min.css?v=2.7.1" | relURL }}" rel="stylesheet">
+<link href="{{ "dist/even.min.css?v=2.7.2" | relURL }}" rel="stylesheet">
{{ if .Site.Params.bootcdn -}}
{{ if .Site.Params.fancybox }}<link href="https://cdn.bootcss.com/fancybox/3.1.20/jquery.fancybox.min.css" rel="stylesheet" crossorigin="anonymous">{{ end }}
{{- else if .Site.Params.publicCDN.enable -}}
diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html
index 83ad1ac..1a284ee 100644
--- a/layouts/partials/scripts.html
+++ b/layouts/partials/scripts.html
@@ -13,7 +13,7 @@
<script type="text/javascript" src="{{ "lib/slideout/slideout-1.0.1.min.js" | relURL }}"></script>
{{ if .Site.Params.fancybox }}<script type="text/javascript" src="{{ "lib/fancybox/jquery.fancybox-3.1.20.min.js" | relURL }}"></script>{{ end }}
{{- end }}
-<script type="text/javascript" src="{{ "dist/even.min.js?v=2.7.1" | relURL }}"></script>
+<script type="text/javascript" src="{{ "dist/even.min.js?v=2.7.2" | relURL }}"></script>
{{- if and (or .Params.mathjax (and .Site.Params.mathjax (ne .Params.mathjax false))) (or .IsPage .IsHome) }}
<script type="text/javascript">
diff --git a/src/js/even.js b/src/js/even.js
index 33ca2f3..0d5813a 100644
--- a/src/js/even.js
+++ b/src/js/even.js
@@ -183,6 +183,7 @@ Even.toc = function () {
}
Even._refactorToc = function (toc) {
+ // when headings do not start with `h1`
const oldTocList = toc.children[0]
let newTocList = oldTocList
let temp
@@ -192,14 +193,14 @@ Even._refactorToc = function (toc) {
}
Even._linkToc = function () {
- const links = document.querySelectorAll('#TableOfContents a')
+ const links = document.querySelectorAll('#TableOfContents a:first-child')
for (let i = 0; i < links.length; i++) links[i].className += ' toc-link'
for (let num = 1; num <= 6; num++) {
const headers = document.querySelectorAll('.post-content>h' + num)
for (let i = 0; i < headers.length; i++) {
const header = headers[i]
- header.innerHTML = `<a href="#${header.id}" class="headerlink" title="${header.innerHTML}"></a>${header.innerHTML}`
+ header.innerHTML = `<a href="#${header.id}" class="headerlink"></a>${header.innerHTML}`
}
}
}
diff --git a/src/package.json b/src/package.json
index dcae54f..ffc23a8 100644
--- a/src/package.json
+++ b/src/package.json
@@ -1,6 +1,6 @@
{
"name": "even-src",
- "version": "2.7.1",
+ "version": "2.7.2",
"description": "even source file",
"main": "index.js",
"scripts": {
diff --git a/static/dist/even.min.js b/static/dist/even.min.js
index b6f5daf..a3795bf 100644
--- a/static/dist/even.min.js
+++ b/static/dist/even.min.js
@@ -1,2 +1,2 @@
-!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,{configurable:!1,enumerable:!0,get: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=0)}([function(e,n,t){"use strict";var o=t(1);t(2),$(document).ready(function(){o.Even.backToTop(),o.Even.mobileNavbar(),o.Even.toc(),o.Even.fancybox()}),hljs.initHighlighting(),o.Even.highlight()},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o={};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"),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()})},o._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 c=$(".toc-link"),i=$(".headerlink"),a=$(".post-toc-content li"),l=$.map(i,function(e){return $(e).offset().top}),s=$.map(l,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($(c).removeClass("active"),$(a).removeClass("has-active"),-1!==n){$(c[n]).addClass("active");for(var t=c[n].parentNode;"NAV"!==t.tagName;)$(t).addClass("has-active"),t=t.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"),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 c=r.length,i="",a=0;a<c;a++)i+='<div class="line">'+(a+1)+"</div>";for(var l="",s=0;s<c;s++)l+='<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>'+i+'</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 n=document.getElementById("TableOfContents");null===n?e.parentNode.removeChild(e):(this._refactorToc(n),this._linkToc(),this._initToc())}},o._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)},o._linkToc=function(){for(var e=document.querySelectorAll("#TableOfContents a"),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 c=o[r];c.innerHTML='<a href="#'+c.id+'" class="headerlink" title="'+c.innerHTML+'"></a>'+c.innerHTML}},n.Even=o},function(e,n){}]);
+!function(e){var n={};function t(o){if(n[o])return n[o].exports;var c=n[o]={i:o,l:!1,exports:{}};return e[o].call(c.exports,c,c.exports,t),c.l=!0,c.exports}t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get: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=0)}([function(e,n,t){"use strict";var o=t(1);t(2),$(document).ready(function(){o.Even.backToTop(),o.Even.mobileNavbar(),o.Even.toc(),o.Even.fancybox()}),hljs.initHighlighting(),o.Even.highlight()},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o={};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"),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()})},o._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,c={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(c.start):n>o?e.css(c.end):e.css(c.process)})}var r=$(".toc-link"),i=$(".headerlink"),a=$(".post-toc-content li"),l=$.map(i,function(e){return $(e).offset().top}),s=$.map(l,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($(r).removeClass("active"),$(a).removeClass("has-active"),-1!==n){$(r[n]).addClass("active");for(var t=r[n].parentNode;"NAV"!==t.tagName;)$(t).addClass("has-active"),t=t.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"),n=0;n<e.length;n++){var t=e[n],o=t.parentElement,c=t.innerHTML.split(/\n/);""===c[c.length-1]&&c.pop();for(var r=c.length,i="",a=0;a<r;a++)i+='<div class="line">'+(a+1)+"</div>";for(var l="",s=0;s<r;s++)l+='<div class="line">'+c[s]+"</div>";t.className+=" highlight";var d=document.createElement("figure");d.className=t.className,d.innerHTML='<table><tbody><tr><td class="gutter"><pre>'+i+'</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 n=document.getElementById("TableOfContents");null===n?e.parentNode.removeChild(e):(this._refactorToc(n),this._linkToc(),this._initToc())}},o._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)},o._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),c=0;c<o.length;c++){var r=o[c];r.innerHTML='<a href="#'+r.id+'" class="headerlink"></a>'+r.innerHTML}},n.Even=o},function(e,n){}]);
//# sourceMappingURL=even.min.js.map \ No newline at end of file
diff --git a/static/dist/even.min.js.map b/static/dist/even.min.js.map
index be3f9cd..2d49471 100644
--- a/static/dist/even.min.js.map
+++ b/static/dist/even.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["webpack:///webpack/bootstrap 6fc1b99261c05d3439a5","webpack:///./js/main.js","webpack:///./js/even.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","_even","$","document","ready","Even","backToTop","mobileNavbar","toc","fancybox","hljs","initHighlighting","highlight","$backToTop","window","scroll","scrollTop","fadeIn","fadeOut","click","animate","$mobileNav","$mobileNavIcon","slideout","Slideout","panel","getElementById","menu","padding","tolerance","disableTouch","toggle","on","addClass","removeClass","isOpen","_initToc","$toc","$footer","length","minScrollTop","offset","top","maxScrollTop","height","tocState","start","position","process","end","css","$toclink","$headerlink","$tocLinkLis","headerlinkTop","map","link","headerLinksOffsetForSearch","activeTocIndex","array","target","searchActiveTocIndex","ancestor","parentNode","tagName","each","this","find","wrap","src","title","selector","protect","blocks","querySelectorAll","block","rootElement","parentElement","lineCodes","innerHTML","split","pop","lineLength","codeLineHtml","codeHtml","className","figure","createElement","replaceChild","tocContainer","removeChild","_refactorToc","_linkToc","oldTocList","children","newTocList","temp","links","num","headers","header","id"],"mappings":"aACA,IAAAA,KAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,IACAG,EAAAH,EACAI,GAAA,EACAH,YAUA,OANAI,EAAAL,GAAAM,KAAAJ,EAAAD,QAAAC,IAAAD,QAAAF,GAGAG,EAAAE,GAAA,EAGAF,EAAAD,QAKAF,EAAAQ,EAAAF,EAGAN,EAAAS,EAAAV,EAGAC,EAAAU,EAAA,SAAAR,EAAAS,EAAAC,GACAZ,EAAAa,EAAAX,EAAAS,IACAG,OAAAC,eAAAb,EAAAS,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAhB,GACA,IAAAS,EAAAT,KAAAiB,WACA,WAA2B,OAAAjB,EAAA,SAC3B,WAAiC,OAAAA,GAEjC,OADAH,EAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,OAAAR,OAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDtB,EAAAyB,EAAA,GAGAzB,IAAA0B,EAAA,kCC7DA,IAAAC,EAAA3B,EAAA,GAEAA,EAAA,GAEA4B,EAAEC,UAAUC,MAAM,WAChBH,EAAAI,KAAKC,YACLL,EAAAI,KAAKE,eACLN,EAAAI,KAAKG,MACLP,EAAAI,KAAKI,aAGPC,KAAKC,mBACLV,EAAAI,KAAKO,2FCVL,IAAMP,KAENA,EAAKC,UAAY,WACf,IAAMO,EAAaX,EAAE,gBAErBA,EAAEY,QAAQC,OAAO,WACXb,EAAEY,QAAQE,YAAc,IAC1BH,EAAWI,OAAO,KAElBJ,EAAWK,QAAQ,O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pG,GAA3C,SAGFiG,EAAMU,WAAa,aACnB,IAAMC,EAASnF,SAASoF,cAAc,UACtCD,EAAOD,UAAYV,EAAMU,UACzBC,EAAOP,UAAP,6CAAgEI,EAAhE,oCAAgHC,EAAhH,mCAEAR,EAAYC,cAAcW,aAAaF,EAAQV,KAInDvE,EAAKG,IAAM,WACT,IAAMiF,EAAetF,SAASuB,eAAe,YAC7C,GAAqB,OAAjB+D,EAAuB,CACzB,IAAMjF,EAAML,SAASuB,eAAe,mBACxB,OAARlB,EAEFiF,EAAa1B,WAAW2B,YAAYD,IAEpCvB,KAAKyB,aAAanF,GAClB0D,KAAK0B,WACL1B,KAAK9B,cAKX/B,EAAKsF,aAAe,SAAUnF,GAI5B,IAHA,IAAMqF,EAAarF,EAAIsF,SAAS,GAC5BC,EAAaF,EACbG,SACkC,IAA/BD,EAAWD,SAASvD,QAAwE,QAAvDyD,EAAOD,EAAWD,SAAS,GAAGA,SAAS,IAAI9B,SAAkB+B,EAAaC,EAElHD,IAAeF,GAAYrF,EAAIgF,aAAaO,EAAYF,IAG9DxF,EAAKuF,SAAW,WAEd,IADA,IAAMK,EAAQ9F,SAASuE,iBAAiB,sBAC/BhG,EAAI,EAAGA,EAAIuH,EAAM1D,OAAQ7D,IAAKuH,EAAMvH,GAAG2G,WAAa,YAE7D,IAAK,IAAIa,EAAM,EAAGA,GAAO,EAAGA,IAE1B,IADA,IAAMC,EAAUhG,SAASuE,iBAAiB,kBAAoBwB,GACrDxH,EAAI,EAAGA,EAAIyH,EAAQ5D,OAAQ7D,IAAK,CACvC,IAAM0H,EAASD,EAAQzH,GACvB0H,EAAOrB,UAAP,aAAgCqB,EAAOC,GAAvC,+BAAwED,EAAOrB,UAA/E,SAAiGqB,EAAOrB,cAKtG1E","file":"even.min.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 6fc1b99261c05d3439a5","import {Even} from './even.js'\r\n\r\nimport '../css/style.scss'\r\n\r\n$(document).ready(function () {\r\n Even.backToTop()\r\n Even.mobileNavbar()\r\n Even.toc()\r\n Even.fancybox()\r\n})\r\n\r\nhljs.initHighlighting()\r\nEven.highlight()\r\n\n\n\n// WEBPACK FOOTER //\n// ./js/main.js","'use strict'\r\n\r\nconst Even = {}\r\n\r\nEven.backToTop = function () {\r\n const $backToTop = $('#back-to-top')\r\n\r\n $(window).scroll(function () {\r\n if ($(window).scrollTop() > 100) {\r\n $backToTop.fadeIn(1000)\r\n } else {\r\n $backToTop.fadeOut(1000)\r\n }\r\n })\r\n\r\n $backToTop.click(function () {\r\n $('body,html').animate({ scrollTop: 0 })\r\n })\r\n}\r\n\r\nEven.mobileNavbar = function () {\r\n const $mobileNav = $('#mobile-navbar')\r\n const $mobileNavIcon = $('.mobile-navbar-icon')\r\n const slideout = new Slideout({\r\n 'panel': document.getElementById('mobile-panel'),\r\n 'menu': document.getElementById('mobile-menu'),\r\n 'padding': 180,\r\n 'tolerance': 70\r\n })\r\n slideout.disableTouch()\r\n\r\n $mobileNavIcon.click(function () {\r\n slideout.toggle()\r\n })\r\n\r\n slideout.on('beforeopen', function () {\r\n $mobileNav.addClass('fixed-open')\r\n $mobileNavIcon.addClass('icon-click').removeClass('icon-out')\r\n })\r\n\r\n slideout.on('beforeclose', function () {\r\n $mobileNav.removeClass('fixed-open')\r\n $mobileNavIcon.addClass('icon-out').removeClass('icon-click')\r\n })\r\n\r\n $('#mobile-panel').on('touchend', function () {\r\n slideout.isOpen() && $mobileNavIcon.click()\r\n })\r\n}\r\n\r\nEven._initToc = function () {\r\n const SPACING = 20\r\n const $toc = $('.post-toc')\r\n const $footer = $('.post-footer')\r\n\r\n if ($toc.length) {\r\n const minScrollTop = $toc.offset().top - SPACING\r\n const maxScrollTop = $footer.offset().top - $toc.height() - SPACING\r\n\r\n const tocState = {\r\n start: {\r\n 'position': 'absolute',\r\n 'top': minScrollTop\r\n },\r\n process: {\r\n 'position': 'fixed',\r\n 'top': SPACING\r\n },\r\n end: {\r\n 'position': 'absolute',\r\n 'top': maxScrollTop\r\n }\r\n }\r\n\r\n $(window).scroll(function () {\r\n const scrollTop = $(window).scrollTop()\r\n\r\n if (scrollTop < minScrollTop) {\r\n $toc.css(tocState.start)\r\n } else if (scrollTop > maxScrollTop) {\r\n $toc.css(tocState.end)\r\n } else {\r\n $toc.css(tocState.process)\r\n }\r\n })\r\n }\r\n\r\n const HEADERFIX = 30\r\n const $toclink = $('.toc-link')\r\n const $headerlink = $('.headerlink')\r\n const $tocLinkLis = $('.post-toc-content li')\r\n\r\n const headerlinkTop = $.map($headerlink, function (link) {\r\n return $(link).offset().top\r\n })\r\n\r\n const headerLinksOffsetForSearch = $.map(headerlinkTop, function (offset) {\r\n return offset - HEADERFIX\r\n })\r\n\r\n const searchActiveTocIndex = function (array, target) {\r\n for (let i = 0; i < array.length - 1; i++) {\r\n if (target > array[i] && target <= array[i + 1]) return i\r\n }\r\n if (target > array[array.length - 1]) return array.length - 1\r\n return -1\r\n }\r\n\r\n $(window).scroll(function () {\r\n const scrollTop = $(window).scrollTop()\r\n const activeTocIndex = searchActiveTocIndex(headerLinksOffsetForSearch, scrollTop)\r\n\r\n $($toclink).removeClass('active')\r\n $($tocLinkLis).removeClass('has-active')\r\n\r\n if (activeTocIndex !== -1) {\r\n $($toclink[activeTocIndex]).addClass('active')\r\n let ancestor = $toclink[activeTocIndex].parentNode\r\n while (ancestor.tagName !== 'NAV') {\r\n $(ancestor).addClass('has-active')\r\n ancestor = ancestor.parentNode.parentNode\r\n }\r\n }\r\n })\r\n}\r\n\r\nEven.fancybox = function () {\r\n if ($.fancybox) {\r\n $('.post-content').each(function () {\r\n $(this).find('img').each(function () {\r\n $(this).wrap(`<a class=\"fancybox\" href=\"${this.src}\" data-fancybox=\"gallery\" data-caption=\"${this.title}\"></a>`)\r\n })\r\n })\r\n\r\n $('.fancybox').fancybox({\r\n selector: '.fancybox',\r\n protect: true\r\n })\r\n }\r\n}\r\n\r\nEven.highlight = function () {\r\n const blocks = document.querySelectorAll('pre code')\r\n for (let i = 0; i < blocks.length; i++) {\r\n const block = blocks[i]\r\n const rootElement = block.parentElement\r\n const lineCodes = block.innerHTML.split(/\\n/)\r\n if (lineCodes[lineCodes.length - 1] === '') lineCodes.pop()\r\n const lineLength = lineCodes.length\r\n\r\n let codeLineHtml = ''\r\n for (let i = 0; i < lineLength; i++) {\r\n codeLineHtml += `<div class=\"line\">${i + 1}</div>`\r\n }\r\n\r\n let codeHtml = ''\r\n for (let i = 0; i < lineLength; i++) {\r\n codeHtml += `<div class=\"line\">${lineCodes[i]}</div>`\r\n }\r\n\r\n block.className += ' highlight'\r\n const figure = document.createElement('figure')\r\n figure.className = block.className\r\n figure.innerHTML = `<table><tbody><tr><td class=\"gutter\"><pre>${codeLineHtml}</pre></td><td class=\"code\"><pre>${codeHtml}</pre></td></tr></tbody></table>`\r\n\r\n rootElement.parentElement.replaceChild(figure, rootElement)\r\n }\r\n}\r\n\r\nEven.toc = function () {\r\n const tocContainer = document.getElementById('post-toc')\r\n if (tocContainer !== null) {\r\n const toc = document.getElementById('TableOfContents')\r\n if (toc === null) {\r\n // toc = true, but there are no headings\r\n tocContainer.parentNode.removeChild(tocContainer)\r\n } else {\r\n this._refactorToc(toc)\r\n this._linkToc()\r\n this._initToc()\r\n }\r\n }\r\n}\r\n\r\nEven._refactorToc = function (toc) {\r\n const oldTocList = toc.children[0]\r\n let newTocList = oldTocList\r\n let temp\r\n while (newTocList.children.length === 1 && (temp = newTocList.children[0].children[0]).tagName === 'UL') newTocList = temp\r\n\r\n if (newTocList !== oldTocList) toc.replaceChild(newTocList, oldTocList)\r\n}\r\n\r\nEven._linkToc = function () {\r\n const links = document.querySelectorAll('#TableOfContents a')\r\n for (let i = 0; i < links.length; i++) links[i].className += ' toc-link'\r\n\r\n for (let num = 1; num <= 6; num++) {\r\n const headers = document.querySelectorAll('.post-content>h' + num)\r\n for (let i = 0; i < headers.length; i++) {\r\n const header = headers[i]\r\n header.innerHTML = `<a href=\"#${header.id}\" class=\"headerlink\" title=\"${header.innerHTML}\"></a>${header.innerHTML}`\r\n }\r\n }\r\n}\r\n\r\nexport {Even}\r\n\n\n\n// WEBPACK FOOTER //\n// ./js/even.js"],"sourceRoot":""} \ No newline at end of file
+{"version":3,"sources":["webpack:///webpack/bootstrap 40610dccf0446872bd93","webpack:///./js/main.js","webpack:///./js/even.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","_even","$","document","ready","Even","backToTop","mobileNavbar","toc","fancybox","hljs","initHighlighting","highlight","$backToTop","window","scroll","scrollTop","fadeIn","fadeOut","click","animate","$mobileNav","$mobileNavIcon","slideout","Slideout","panel","getElementById","menu","padding","tolerance","disableTouch","toggle","on","addClass","removeClass","isOpen","_initToc","$toc","$footer","length","minScrollTop","offset","top","maxScrollTop","height","tocState","start","position","process","end","css","$toclink","$headerlink","$tocLinkLis","headerlinkTop","map","link","headerLinksOffsetForSearch","activeTocIndex","array","target","searchActiveTocIndex","ancestor","parentNode","tagName","each","this","find","wrap","src","title","selector","protect","blocks","querySelectorAll","block","rootElement","parentElement","lineCodes","innerHTML","split","pop","lineLength","codeLineHtml","codeHtml","className","figure","createElement","replaceChild","tocContainer","removeChild","_refactorToc","_linkToc","oldTocList","children","newTocList","temp","links","num","headers","header","id"],"mappings":"aACA,IAAAA,KAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,IACAG,EAAAH,EACAI,GAAA,EACAH,YAUA,OANAI,EAAAL,GAAAM,KAAAJ,EAAAD,QAAAC,IAAAD,QAAAF,GAGAG,EAAAE,GAAA,EAGAF,EAAAD,QAKAF,EAAAQ,EAAAF,EAGAN,EAAAS,EAAAV,EAGAC,EAAAU,EAAA,SAAAR,EAAAS,EAAAC,GACAZ,EAAAa,EAAAX,EAAAS,IACAG,OAAAC,eAAAb,EAAAS,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAhB,GACA,IAAAS,EAAAT,KAAAiB,WACA,WAA2B,OAAAjB,EAAA,SAC3B,WAAiC,OAAAA,GAEjC,OADAH,EAAAU,EAAAE,EAAA,I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hG,EAAI,EAAGA,EAAIuH,EAAM1D,OAAQ7D,IAAKuH,EAAMvH,GAAG2G,WAAa,YAE7D,IAAK,IAAIa,EAAM,EAAGA,GAAO,EAAGA,IAE1B,IADA,IAAMC,EAAUhG,SAASuE,iBAAiB,kBAAoBwB,GACrDxH,EAAI,EAAGA,EAAIyH,EAAQ5D,OAAQ7D,IAAK,CACvC,IAAM0H,EAASD,EAAQzH,GACvB0H,EAAOrB,UAAP,aAAgCqB,EAAOC,GAAvC,4BAAqED,EAAOrB,cAK1E1E","file":"even.min.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 40610dccf0446872bd93","import {Even} from './even.js'\r\n\r\nimport '../css/style.scss'\r\n\r\n$(document).ready(function () {\r\n Even.backToTop()\r\n Even.mobileNavbar()\r\n Even.toc()\r\n Even.fancybox()\r\n})\r\n\r\nhljs.initHighlighting()\r\nEven.highlight()\r\n\n\n\n// WEBPACK FOOTER //\n// ./js/main.js","'use strict'\r\n\r\nconst Even = {}\r\n\r\nEven.backToTop = function () {\r\n const $backToTop = $('#back-to-top')\r\n\r\n $(window).scroll(function () {\r\n if ($(window).scrollTop() > 100) {\r\n $backToTop.fadeIn(1000)\r\n } else {\r\n $backToTop.fadeOut(1000)\r\n }\r\n })\r\n\r\n $backToTop.click(function () {\r\n $('body,html').animate({ scrollTop: 0 })\r\n })\r\n}\r\n\r\nEven.mobileNavbar = function () {\r\n const $mobileNav = $('#mobile-navbar')\r\n const $mobileNavIcon = $('.mobile-navbar-icon')\r\n const slideout = new Slideout({\r\n 'panel': document.getElementById('mobile-panel'),\r\n 'menu': document.getElementById('mobile-menu'),\r\n 'padding': 180,\r\n 'tolerance': 70\r\n })\r\n slideout.disableTouch()\r\n\r\n $mobileNavIcon.click(function () {\r\n slideout.toggle()\r\n })\r\n\r\n slideout.on('beforeopen', function () {\r\n $mobileNav.addClass('fixed-open')\r\n $mobileNavIcon.addClass('icon-click').removeClass('icon-out')\r\n })\r\n\r\n slideout.on('beforeclose', function () {\r\n $mobileNav.removeClass('fixed-open')\r\n $mobileNavIcon.addClass('icon-out').removeClass('icon-click')\r\n })\r\n\r\n $('#mobile-panel').on('touchend', function () {\r\n slideout.isOpen() && $mobileNavIcon.click()\r\n })\r\n}\r\n\r\nEven._initToc = function () {\r\n const SPACING = 20\r\n const $toc = $('.post-toc')\r\n const $footer = $('.post-footer')\r\n\r\n if ($toc.length) {\r\n const minScrollTop = $toc.offset().top - SPACING\r\n const maxScrollTop = $footer.offset().top - $toc.height() - SPACING\r\n\r\n const tocState = {\r\n start: {\r\n 'position': 'absolute',\r\n 'top': minScrollTop\r\n },\r\n process: {\r\n 'position': 'fixed',\r\n 'top': SPACING\r\n },\r\n end: {\r\n 'position': 'absolute',\r\n 'top': maxScrollTop\r\n }\r\n }\r\n\r\n $(window).scroll(function () {\r\n const scrollTop = $(window).scrollTop()\r\n\r\n if (scrollTop < minScrollTop) {\r\n $toc.css(tocState.start)\r\n } else if (scrollTop > maxScrollTop) {\r\n $toc.css(tocState.end)\r\n } else {\r\n $toc.css(tocState.process)\r\n }\r\n })\r\n }\r\n\r\n const HEADERFIX = 30\r\n const $toclink = $('.toc-link')\r\n const $headerlink = $('.headerlink')\r\n const $tocLinkLis = $('.post-toc-content li')\r\n\r\n const headerlinkTop = $.map($headerlink, function (link) {\r\n return $(link).offset().top\r\n })\r\n\r\n const headerLinksOffsetForSearch = $.map(headerlinkTop, function (offset) {\r\n return offset - HEADERFIX\r\n })\r\n\r\n const searchActiveTocIndex = function (array, target) {\r\n for (let i = 0; i < array.length - 1; i++) {\r\n if (target > array[i] && target <= array[i + 1]) return i\r\n }\r\n if (target > array[array.length - 1]) return array.length - 1\r\n return -1\r\n }\r\n\r\n $(window).scroll(function () {\r\n const scrollTop = $(window).scrollTop()\r\n const activeTocIndex = searchActiveTocIndex(headerLinksOffsetForSearch, scrollTop)\r\n\r\n $($toclink).removeClass('active')\r\n $($tocLinkLis).removeClass('has-active')\r\n\r\n if (activeTocIndex !== -1) {\r\n $($toclink[activeTocIndex]).addClass('active')\r\n let ancestor = $toclink[activeTocIndex].parentNode\r\n while (ancestor.tagName !== 'NAV') {\r\n $(ancestor).addClass('has-active')\r\n ancestor = ancestor.parentNode.parentNode\r\n }\r\n }\r\n })\r\n}\r\n\r\nEven.fancybox = function () {\r\n if ($.fancybox) {\r\n $('.post-content').each(function () {\r\n $(this).find('img').each(function () {\r\n $(this).wrap(`<a class=\"fancybox\" href=\"${this.src}\" data-fancybox=\"gallery\" data-caption=\"${this.title}\"></a>`)\r\n })\r\n })\r\n\r\n $('.fancybox').fancybox({\r\n selector: '.fancybox',\r\n protect: true\r\n })\r\n }\r\n}\r\n\r\nEven.highlight = function () {\r\n const blocks = document.querySelectorAll('pre code')\r\n for (let i = 0; i < blocks.length; i++) {\r\n const block = blocks[i]\r\n const rootElement = block.parentElement\r\n const lineCodes = block.innerHTML.split(/\\n/)\r\n if (lineCodes[lineCodes.length - 1] === '') lineCodes.pop()\r\n const lineLength = lineCodes.length\r\n\r\n let codeLineHtml = ''\r\n for (let i = 0; i < lineLength; i++) {\r\n codeLineHtml += `<div class=\"line\">${i + 1}</div>`\r\n }\r\n\r\n let codeHtml = ''\r\n for (let i = 0; i < lineLength; i++) {\r\n codeHtml += `<div class=\"line\">${lineCodes[i]}</div>`\r\n }\r\n\r\n block.className += ' highlight'\r\n const figure = document.createElement('figure')\r\n figure.className = block.className\r\n figure.innerHTML = `<table><tbody><tr><td class=\"gutter\"><pre>${codeLineHtml}</pre></td><td class=\"code\"><pre>${codeHtml}</pre></td></tr></tbody></table>`\r\n\r\n rootElement.parentElement.replaceChild(figure, rootElement)\r\n }\r\n}\r\n\r\nEven.toc = function () {\r\n const tocContainer = document.getElementById('post-toc')\r\n if (tocContainer !== null) {\r\n const toc = document.getElementById('TableOfContents')\r\n if (toc === null) {\r\n // toc = true, but there are no headings\r\n tocContainer.parentNode.removeChild(tocContainer)\r\n } else {\r\n this._refactorToc(toc)\r\n this._linkToc()\r\n this._initToc()\r\n }\r\n }\r\n}\r\n\r\nEven._refactorToc = function (toc) {\r\n // when headings do not start with `h1`\r\n const oldTocList = toc.children[0]\r\n let newTocList = oldTocList\r\n let temp\r\n while (newTocList.children.length === 1 && (temp = newTocList.children[0].children[0]).tagName === 'UL') newTocList = temp\r\n\r\n if (newTocList !== oldTocList) toc.replaceChild(newTocList, oldTocList)\r\n}\r\n\r\nEven._linkToc = function () {\r\n const links = document.querySelectorAll('#TableOfContents a:first-child')\r\n for (let i = 0; i < links.length; i++) links[i].className += ' toc-link'\r\n\r\n for (let num = 1; num <= 6; num++) {\r\n const headers = document.querySelectorAll('.post-content>h' + num)\r\n for (let i = 0; i < headers.length; i++) {\r\n const header = headers[i]\r\n header.innerHTML = `<a href=\"#${header.id}\" class=\"headerlink\"></a>${header.innerHTML}`\r\n }\r\n }\r\n}\r\n\r\nexport {Even}\r\n\n\n\n// WEBPACK FOOTER //\n// ./js/even.js"],"sourceRoot":""} \ No newline at end of file