{"version":3,"sources":["webpack:///even.min.js","webpack:///webpack/bootstrap 912d3227609ea1ec5f72","webpack:///./js/main.js","webpack:///./js/even.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","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","value","$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","searchActiveTocIndex","array","target","activeTocIndex","ancestor","parentNode","tagName","each","this","find","wrap","src","title","selector","protect","blocks","querySelectorAll","block","rootElement","parentElement","lineCodes","innerHTML","split","slice","lineLength","codeLineHtml","codeHtml","className","figure","createElement","replaceChild","tocContainer","removeChild","_refactorToc","_linkToc","oldTocList","children","newTocList","temp","links","num","headers","header","id"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,EAAAQ,IACAG,OAAAC,eAAAZ,EAAAQ,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAf,GACA,GAAAQ,GAAAR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D,EAAOD,EAAWD,SAAS,GAAGA,SAAS,IAAI9B,SAAkB+B,EAAaC,CAElHD,KAAeF,GAAYtF,EAAIiF,aAAaO,EAAYF,IAG9DzF,EAAKwF,SAAW,WAEd,IAAK,GADCK,GAAQ/F,SAASwE,iBAAiB,sBAC/BhG,EAAI,EAAGA,EAAIuH,EAAM1D,OAAQ7D,IAAKuH,EAAMvH,GAAG2G,WAAa,WAE7D,KAAK,GAAIa,GAAM,EAAGA,GAAO,EAAGA,IAE1B,IAAK,GADCC,GAAUjG,SAASwE,iBAAiB,kBAAoBwB,GACrDxH,EAAI,EAAGA,EAAIyH,EAAQ5D,OAAQ7D,IAAK,CACvC,GAAM0H,GAASD,EAAQzH,EACvB0H,GAAOrB,UAAP,aAAgCqB,EAAOC,GAAvC,+BAAwED,EAAOrB,UAA/E,SAAiGqB,EAAOrB,YHmG9GvG,EG9FQ4B,QHkGF,SAAU3B,EAAQD","file":"even.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \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/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _even = __webpack_require__(1);\n\n__webpack_require__(2);\n\n$(document).ready(function () {\n _even.Even.backToTop();\n _even.Even.mobileNavbar();\n _even.Even.toc();\n _even.Even.fancybox();\n});\n\nhljs.initHighlighting();\n_even.Even.highlight();\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nvar Even = {};\n\nEven.backToTop = function () {\n var $backToTop = $('#back-to-top');\n\n $(window).scroll(function () {\n if ($(window).scrollTop() > 100) {\n $backToTop.fadeIn(1000);\n } else {\n $backToTop.fadeOut(1000);\n }\n });\n\n $backToTop.click(function () {\n $('body,html').animate({ scrollTop: 0 });\n });\n};\n\nEven.mobileNavbar = function () {\n var $mobileNav = $('#mobile-navbar');\n var $mobileNavIcon = $('.mobile-navbar-icon');\n var slideout = new Slideout({\n 'panel': document.getElementById('mobile-panel'),\n 'menu': document.getElementById('mobile-menu'),\n 'padding': 180,\n 'tolerance': 70\n });\n slideout.disableTouch();\n\n $mobileNavIcon.click(function () {\n slideout.toggle();\n });\n\n slideout.on('beforeopen', function () {\n $mobileNav.addClass('fixed-open');\n $mobileNavIcon.addClass('icon-click').removeClass('icon-out');\n });\n\n slideout.on('beforeclose', function () {\n $mobileNav.removeClass('fixed-open');\n $mobileNavIcon.addClass('icon-out').removeClass('icon-click');\n });\n\n $('#mobile-panel').on('touchend', function () {\n slideout.isOpen() && $mobileNavIcon.click();\n });\n};\n\nEven._initToc = function () {\n var SPACING = 20;\n var $toc = $('.post-toc');\n var $footer = $('.post-footer');\n\n if ($toc.length) {\n var minScrollTop = $toc.offset().top - SPACING;\n var maxScrollTop = $footer.offset().top - $toc.height() - SPACING;\n\n var tocState = {\n start: {\n 'position': 'absolute',\n 'top': minScrollTop\n },\n process: {\n 'position': 'fixed',\n 'top': SPACING\n },\n end: {\n 'position': 'absolute',\n 'top': maxScrollTop\n }\n };\n\n $(window).scroll(function () {\n var scrollTop = $(window).scrollTop();\n\n if (scrollTop < minScrollTop) {\n $toc.css(tocState.start);\n } else if (scrollTop > maxScrollTop) {\n $toc.css(tocState.end);\n } else {\n $toc.css(tocState.process);\n }\n });\n }\n\n var HEADERFIX = 30;\n var $toclink = $('.toc-link');\n var $headerlink = $('.headerlink');\n var $tocLinkLis = $('.post-toc-content li');\n\n var headerlinkTop = $.map($headerlink, function (link) {\n return $(link).offset().top;\n });\n\n var headerLinksOffsetForSearch = $.map(headerlinkTop, function (offset) {\n return offset - HEADERFIX;\n });\n\n var searchActiveTocIndex = function searchActiveTocIndex(array, target) {\n for (var i = 0; i < array.length - 1; i++) {\n if (target > array[i] && target <= array[i + 1]) return i;\n }\n if (target > array[array.length - 1]) return array.length - 1;\n return -1;\n };\n\n $(window).scroll(function () {\n var scrollTop = $(window).scrollTop();\n var activeTocIndex = searchActiveTocIndex(headerLinksOffsetForSearch, scrollTop);\n\n $($toclink).removeClass('active');\n $($tocLinkLis).removeClass('has-active');\n\n if (activeTocIndex !== -1) {\n $($toclink[activeTocIndex]).addClass('active');\n var ancestor = $toclink[activeTocIndex].parentNode;\n while (ancestor.tagName !== 'NAV') {\n $(ancestor).addClass('has-active');\n ancestor = ancestor.parentNode.parentNode;\n }\n }\n });\n};\n\nEven.fancybox = function () {\n if ($.fancybox) {\n $('.post-content').each(function () {\n $(this).find('img').each(function () {\n $(this).wrap('');\n });\n });\n\n $('.fancybox').fancybox({\n selector: '.fancybox',\n protect: true\n });\n }\n};\n\nEven.highlight = function () {\n var blocks = document.querySelectorAll('pre code');\n for (var i = 0; i < blocks.length; i++) {\n var block = blocks[i];\n var rootElement = block.parentElement;\n var lineCodes = block.innerHTML.split(/\\n/).slice(0, -1);\n var lineLength = lineCodes.length;\n\n var codeLineHtml = '';\n for (var _i = 0; _i < lineLength; _i++) {\n codeLineHtml += '
' + (_i + 1) + '
';\n }\n\n var codeHtml = '';\n for (var _i2 = 0; _i2 < lineLength; _i2++) {\n codeHtml += '' + lineCodes[_i2] + '
';\n }\n\n block.className += ' highlight';\n var figure = document.createElement('figure');\n figure.className = block.className;\n figure.innerHTML = '' + codeLineHtml + ' | ' + codeHtml + ' |
';\n\n rootElement.parentElement.replaceChild(figure, rootElement);\n }\n};\n\nEven.toc = function () {\n var tocContainer = document.getElementById('post-toc');\n if (tocContainer !== null) {\n var toc = document.getElementById('TableOfContents');\n if (toc === null) {\n // toc = true, but there are no headings\n tocContainer.parentNode.removeChild(tocContainer);\n } else {\n this._refactorToc(toc);\n this._linkToc();\n this._initToc();\n }\n }\n};\n\nEven._refactorToc = function (toc) {\n var oldTocList = toc.children[0];\n var newTocList = oldTocList;\n var temp = void 0;\n while (newTocList.children.length === 1 && (temp = newTocList.children[0].children[0]).tagName === 'UL') {\n newTocList = temp;\n }if (newTocList !== oldTocList) toc.replaceChild(newTocList, oldTocList);\n};\n\nEven._linkToc = function () {\n var links = document.querySelectorAll('#TableOfContents a');\n for (var i = 0; i < links.length; i++) {\n links[i].className += ' toc-link';\n }for (var num = 1; num <= 6; num++) {\n var headers = document.querySelectorAll('.post-content>h' + num);\n for (var _i3 = 0; _i3 < headers.length; _i3++) {\n var header = headers[_i3];\n header.innerHTML = '' + header.innerHTML;\n }\n }\n};\n\nexports.Even = Even;\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports) {\n\n// removed by extract-text-webpack-plugin\n\n/***/ })\n/******/ ]);\n\n\n// WEBPACK FOOTER //\n// even.min.js"," \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 912d3227609ea1ec5f72","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(``)\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/).slice(0, -1)\r\n const lineLength = lineCodes.length\r\n\r\n let codeLineHtml = ''\r\n for (let i = 0; i < lineLength; i++) {\r\n codeLineHtml += `${i + 1}
`\r\n }\r\n\r\n let codeHtml = ''\r\n for (let i = 0; i < lineLength; i++) {\r\n codeHtml += `${lineCodes[i]}
`\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 = `${codeLineHtml} | ${codeHtml} |
`\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 = `${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":""}