j1m_toc 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.md +21 -0
- data/README.md +41 -0
- data/_data/modules/default/j1_toc-0.0.1/j1_tocbot.yml +165 -0
- data/_data/resources/default/j1_toc-0.0.1/resource.yml +24 -0
- data/assets/themes/j1/j1/js/adapters/tocbot.js +161 -0
- data/assets/themes/j1/tocbot/css/tocbot.css +101 -0
- data/assets/themes/j1/tocbot/css/tocbot.min.css +43 -0
- data/assets/themes/j1/tocbot/js/tocbot.js +709 -0
- data/assets/themes/j1/tocbot/js/tocbot.min.js +18 -0
- data/assets/themes/j1/tocbot/js/tocbot.min.js.map +1 -0
- data/exe/console +14 -0
- data/exe/setup +8 -0
- data/lib/j1m_toc.rb +5 -0
- data/lib/j1m_toc/version.rb +3 -0
- metadata +104 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
!function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return e[o].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([/*!*************************!*\
|
2
|
+
!*** ./src/js/index.js ***!
|
3
|
+
\*************************/
|
4
|
+
function(e,t,n){var o,i,r;(function(l){!function(n,l){i=[],o=l(n),r="function"==typeof o?o.apply(t,i):o,!(void 0!==r&&(e.exports=r))}("undefined"!=typeof l?l:this.window||this.global,function(e){"use strict";function t(){for(var e={},t=0;t<arguments.length;t++){var n=arguments[t];for(var o in n)h.call(n,o)&&(e[o]=n[o])}return e}function o(e,t,n){t||(t=250);var o,i;return function(){var r=n||this,l=+new Date,s=arguments;o&&l<o+t?(clearTimeout(i),i=setTimeout(function(){o=l,e.apply(r,s)},t)):(o=l,e.apply(r,s))}}var i,r,l,s=n(/*! smooth-scroll */1),c=n(/*! ./default-options.js */2),a={},u={},d=n(/*! ./build-html.js */3),f=n(/*! ./parse-content.js */4),m=(e.document,document.body,!!e.document.querySelector&&!!e.addEventListener),h=Object.prototype.hasOwnProperty;return u.destroy=function(){try{document.querySelector(a.tocSelector).innerHTML=""}catch(e){console.warn("Element not found: "+a.tocSelector)}document.removeEventListener("scroll",this._scrollListener,!1),document.removeEventListener("resize",this._scrollListener,!1),i&&document.removeEventListener("click",this._clickListener,!1),s&&s.destroy()},u.init=function(e){if(m&&(a=t(c,e||{}),this.options=a,this.state={},i=d(a),r=f(a),this._buildHtml=i,this._parseContent=r,u.destroy(),l=r.selectHeadings(a.contentSelector,a.headingSelector),null!==l)){var n=r.nestHeadingsArray(l),h=n.nest;return i.render(a.tocSelector,h),this._scrollListener=o(function(){i.updateToc(l)},a.throttleTimeout),this._scrollListener(),document.addEventListener("scroll",this._scrollListener,!1),document.addEventListener("resize",this._scrollListener,!1),this._clickListener=o(function(e){i.disableTocAnimation(e),i.updateToc(l)},a.throttleTimeout),document.addEventListener("click",this._clickListener,!1),s&&(this.smoothScroll=s.init(t(a.smoothScrollOptions,{callback:i.enableTocAnimation}))),this}},u.refresh=function(e){u.destroy(),u.init(e||this.options)},e.tocbot=u,u})}).call(t,function(){return this}())},/*!******************************************************!*\
|
5
|
+
!*** ./~/smooth-scroll/dist/js/smooth-scroll.min.js ***!
|
6
|
+
\******************************************************/
|
7
|
+
function(e,t,n){var o,i,r;(function(n){/*! smooth-scroll v10.0.1 | (c) 2016 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/smooth-scroll */
|
8
|
+
!function(n,l){i=[],o=l(n),r="function"==typeof o?o.apply(t,i):o,!(void 0!==r&&(e.exports=r))}("undefined"!=typeof n?n:this.window||this.global,function(e){"use strict";var t,n,o,i,r,l,s,c={},a="querySelector"in document&&"addEventListener"in e,u={selector:"[data-scroll]",selectorHeader:null,speed:500,easing:"easeInOutCubic",offset:0,callback:function(){}},d=function(){var e={},t=!1,n=0,o=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(var i=function(n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t&&"[object Object]"===Object.prototype.toString.call(n[o])?e[o]=d(!0,e[o],n[o]):e[o]=n[o])};o>n;n++){var r=arguments[n];i(r)}return e},f=function(e){return Math.max(e.scrollHeight,e.offsetHeight,e.clientHeight)},m=function(e,t){var n,o,i=t.charAt(0),r="classList"in document.documentElement;for("["===i&&(t=t.substr(1,t.length-2),n=t.split("="),n.length>1&&(o=!0,n[1]=n[1].replace(/"/g,"").replace(/'/g,"")));e&&e!==document&&1===e.nodeType;e=e.parentNode){if("."===i)if(r){if(e.classList.contains(t.substr(1)))return e}else if(new RegExp("(^|\\s)"+t.substr(1)+"(\\s|$)").test(e.className))return e;if("#"===i&&e.id===t.substr(1))return e;if("["===i&&e.hasAttribute(n[0])){if(!o)return e;if(e.getAttribute(n[0])===n[1])return e}if(e.tagName.toLowerCase()===t)return e}return null},h=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,i=-1,r="",l=n.charCodeAt(0);++i<o;){if(t=n.charCodeAt(i),0===t)throw new InvalidCharacterError("Invalid character: the input contains U+0000.");r+=t>=1&&31>=t||127==t||0===i&&t>=48&&57>=t||1===i&&t>=48&&57>=t&&45===l?"\\"+t.toString(16)+" ":t>=128||45===t||95===t||t>=48&&57>=t||t>=65&&90>=t||t>=97&&122>=t?n.charAt(i):"\\"+n.charAt(i)}return"#"+r},p=function(e,t){var n;return"easeInQuad"===e&&(n=t*t),"easeOutQuad"===e&&(n=t*(2-t)),"easeInOutQuad"===e&&(n=.5>t?2*t*t:-1+(4-2*t)*t),"easeInCubic"===e&&(n=t*t*t),"easeOutCubic"===e&&(n=--t*t*t+1),"easeInOutCubic"===e&&(n=.5>t?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e&&(n=t*t*t*t),"easeOutQuart"===e&&(n=1- --t*t*t*t),"easeInOutQuart"===e&&(n=.5>t?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e&&(n=t*t*t*t*t),"easeOutQuint"===e&&(n=1+--t*t*t*t*t),"easeInOutQuint"===e&&(n=.5>t?16*t*t*t*t*t:1+16*--t*t*t*t*t),n||t},v=function(e,t,n){var o=0;if(e.offsetParent)do o+=e.offsetTop,e=e.offsetParent;while(e);return o=Math.max(o-t-n,0),Math.min(o,b()-g())},g=function(){return Math.max(document.documentElement.clientHeight,e.innerHeight||0)},b=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},C=function(e){return e&&"object"==typeof JSON&&"function"==typeof JSON.parse?JSON.parse(e):{}},S=function(e){return e?f(e)+e.offsetTop:0},y=function(t,n,o){o||(t.focus(),document.activeElement.id!==t.id&&(t.setAttribute("tabindex","-1"),t.focus(),t.style.outline="none"),e.scrollTo(0,n))};c.animateScroll=function(n,o,l){var c=C(o?o.getAttribute("data-options"):null),a=d(t||u,l||{},c),f="[object Number]"===Object.prototype.toString.call(n),m=f||!n.tagName?null:n;if(f||m){var h=e.pageYOffset;a.selectorHeader&&!i&&(i=document.querySelector(a.selectorHeader)),r||(r=S(i));var g,x,N=f?n:v(m,r,parseInt(a.offset,10)),L=N-h,O=b(),E=0,A=function(t,i,r){var l=e.pageYOffset;(t==i||l==i||e.innerHeight+l>=O)&&(clearInterval(r),y(n,i,f),a.callback(n,o))},H=function(){E+=16,g=E/parseInt(a.speed,10),g=g>1?1:g,x=h+L*p(a.easing,g),e.scrollTo(0,Math.floor(x)),A(x,N,s)},T=function(){clearInterval(s),s=setInterval(H,16)};0===e.pageYOffset&&e.scrollTo(0,0),T()}};var x=function(t){e.location.hash,n&&(n.id=n.getAttribute("data-scroll-id"),c.animateScroll(n,o),n=null,o=null)},N=function(i){if(0===i.button&&!i.metaKey&&!i.ctrlKey&&(o=m(i.target,t.selector),o&&"a"===o.tagName.toLowerCase()&&o.hostname===e.location.hostname&&o.pathname===e.location.pathname&&/#/.test(o.href))){var r=h(o.hash);if("#"===r){i.preventDefault(),n=document.body;var l=n.id?n.id:"smooth-scroll-top";return n.setAttribute("data-scroll-id",l),n.id="",void(e.location.hash.substring(1)===l?x():e.location.hash=l)}n=document.querySelector(r),n&&(n.setAttribute("data-scroll-id",n.id),n.id="",o.hash===e.location.hash&&(i.preventDefault(),x()))}},L=function(e){l||(l=setTimeout(function(){l=null,r=S(i)},66))};return c.destroy=function(){t&&(document.removeEventListener("click",N,!1),e.removeEventListener("resize",L,!1),t=null,n=null,o=null,i=null,r=null,l=null,s=null)},c.init=function(n){a&&(c.destroy(),t=d(u,n||{}),i=t.selectorHeader?document.querySelector(t.selectorHeader):null,r=S(i),document.addEventListener("click",N,!1),e.addEventListener("hashchange",x,!1),i&&e.addEventListener("resize",L,!1))},c})}).call(t,function(){return this}())},/*!***********************************!*\
|
9
|
+
!*** ./src/js/default-options.js ***!
|
10
|
+
\***********************************/
|
11
|
+
function(e,t){e.exports={tocSelector:".js-toc",contentSelector:".js-toc-content",headingSelector:"h1, h2, h3",ignoreSelector:".js-toc-ignore",linkClass:"toc-link",extraLinkClasses:"",activeLinkClass:"is-active-link",listClass:"toc-list",extraListClasses:"",isCollapsedClass:"is-collapsed",collapsibleClass:"is-collapsible",listItemClass:"toc-list-item",collapseDepth:0,smoothScrollOptions:{easing:"easeInOutCubic",offset:0,speed:300,updateURL:!0},headingsOffset:0,throttleTimeout:50,positionFixedSelector:null,positionFixedClass:"is-position-fixed",fixedSidebarOffset:"auto",includeHtml:!1}},/*!******************************!*\
|
12
|
+
!*** ./src/js/build-html.js ***!
|
13
|
+
\******************************/
|
14
|
+
function(e,t){e.exports=function(e){function t(e,n){var r=n.appendChild(o(e));if(e.children.length){var l=i(e.isCollapsed);e.children.forEach(function(e){t(e,l)}),r.appendChild(l)}}function n(e,n){var o=!1,r=i(o);n.forEach(function(e){t(e,r)});var l=document.querySelector(e);if(null!==l)return l.firstChild&&l.removeChild(l.firstChild),l.appendChild(r)}function o(t){var n=document.createElement("li"),o=document.createElement("a");return e.listItemClass&&n.setAttribute("class",e.listItemClass),e.includeHtml&&t.childNodes.length?u.call(t.childNodes,function(e){o.appendChild(e.cloneNode(!0))}):o.textContent=t.textContent,o.setAttribute("data-scroll",""),o.setAttribute("href","#"+t.id),o.setAttribute("class",e.linkClass+h+"node-name--"+t.nodeName+h+e.extraLinkClasses),n.appendChild(o),n}function i(t){var n=document.createElement("ul"),o=e.listClass+h+e.extraListClasses;return t&&(o+=h+e.collapsibleClass,o+=h+e.isCollapsedClass),n.setAttribute("class",o),n}function r(){var t=document.documentElement.scrollTop||f.scrollTop,n=document.querySelector(e.positionFixedSelector);"auto"===e.fixedSidebarOffset&&(e.fixedSidebarOffset=document.querySelector(e.tocSelector).offsetTop),t>e.fixedSidebarOffset?n.className.indexOf(e.positionFixedClass)===-1&&(n.className+=h+e.positionFixedClass):n.className=n.className.split(h+e.positionFixedClass).join("")}function l(t){var n=document.documentElement.scrollTop||f.scrollTop;e.positionFixedSelector&&r();var o,i=t;if(m&&null!==document.querySelector(e.tocSelector)&&i.length>0){d.call(i,function(t,r){if(t.offsetTop>n+e.headingsOffset){var l=0===r?r:r-1;return o=i[l],!0}if(r===i.length-1)return o=i[i.length-1],!0});var l=document.querySelector(e.tocSelector).querySelectorAll("."+e.linkClass);u.call(l,function(t){t.className=t.className.split(h+e.activeLinkClass).join("")});var c=document.querySelector(e.tocSelector).querySelector("."+e.linkClass+".node-name--"+o.nodeName+'[href="#'+o.id+'"]');c.className+=h+e.activeLinkClass;var a=document.querySelector(e.tocSelector).querySelectorAll("."+e.listClass+"."+e.collapsibleClass);u.call(a,function(t){var n=h+e.isCollapsedClass;t.className.indexOf(n)===-1&&(t.className+=h+e.isCollapsedClass)}),c.nextSibling&&(c.nextSibling.className=c.nextSibling.className.split(h+e.isCollapsedClass).join("")),s(c.parentNode.parentNode)}}function s(t){return t.className.indexOf(e.collapsibleClass)!==-1?(t.className=t.className.split(h+e.isCollapsedClass).join(""),s(t.parentNode.parentNode)):t}function c(t){var n=t.target||t.srcElement;n.className.indexOf(e.linkClass)!==-1&&(m=!1)}function a(){m=!0}var u=[].forEach,d=[].some,f=document.body,m=!0,h=" ";return{enableTocAnimation:a,disableTocAnimation:c,render:n,updateToc:l}}},/*!*********************************!*\
|
15
|
+
!*** ./src/js/parse-content.js ***!
|
16
|
+
\*********************************/
|
17
|
+
function(e,t){e.exports=function(e){function t(e){return e[e.length-1]}function n(e){return+e.nodeName.split("H").join("")}function o(t){var o={id:t.id,children:[],nodeName:t.nodeName,headingLevel:n(t),textContent:t.textContent.trim()};return e.includeHtml&&(o.childNodes=t.childNodes),o}function i(i,r){for(var l=o(i),s=n(i),c=r,a=t(c),u=a?a.headingLevel:0,d=s-u;d>0;)a=t(c),a&&void 0!==a.children&&(c=a.children),d--;return s>=e.collapseDepth&&(l.isCollapsed=!0),c.push(l),c}function r(t,n){var o=n;e.ignoreSelector&&(o=n.split(",").map(function(t){return t.trim()+":not("+e.ignoreSelector+")"}));try{return document.querySelector(t).querySelectorAll(o)}catch(i){return console.warn("Element not found: "+t),null}}function l(e){return s.call(e,function(e,t){var n=o(t);return i(n,e.nest),e},{nest:[]})}var s=[].reduce;return{nestHeadingsArray:l,selectHeadings:r}}}]);
|
18
|
+
//# sourceMappingURL=tocbot.min.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["webpack:///webpack/bootstrap 555f597016c3faac7633","webpack:///./src/js/index.js","webpack:///./~/smooth-scroll/dist/js/smooth-scroll.min.js","webpack:///./src/js/default-options.js","webpack:///./src/js/build-html.js","webpack:///./src/js/parse-content.js"],"names":[],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;;;;iGCtCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAE;AACF;AACA,GAAE;AACF;AACA;AACA,EAAC;;AAED;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,2EAA0E;AAC1E;;AAEA;AACA;AACA;AACA;AACA,oBAAmB,sBAAsB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL,iEAAgE;AAChE;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yDAAwD;AACxD;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;;AAEA;AACA;AACA,4CAA2C;AAC3C;AACA,MAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,EAAC;;;;;;;;;;;iGChMD;AACA,gBAAe,+bAAuH,wEAAwE,aAAa,sBAAsB,yDAAyD,8GAA8G,cAAc,QAAQ,6BAA6B,wFAAwF,sBAAsB,wJAAwJ,IAAI,KAAK,mBAAmB,KAAK,SAAS,eAAe,8DAA8D,iBAAiB,+DAA+D,sHAAsH,gCAAgC,gBAAgB,iBAAiB,8CAA8C,+EAA+E,wCAAwC,kCAAkC,eAAe,wCAAwC,wCAAwC,YAAY,eAAe,mCAAmC,6DAA6D,MAAM,EAAE,4GAA4G,gMAAgM,YAAY,iBAAiB,MAAM,kfAAkf,mBAAmB,QAAQ,qDAAqD,SAAS,+CAA+C,cAAc,wEAAwE,cAAc,oNAAoN,eAAe,gFAAgF,eAAe,4BAA4B,mBAAmB,qIAAqI,gCAAgC,6DAA6D,yFAAyF,SAAS,oBAAoB,+EAA+E,6EAA6E,oBAAoB,8EAA8E,cAAc,kGAAkG,cAAc,sCAAsC,yCAAyC,kBAAkB,gBAAgB,8EAA8E,eAAe,4LAA4L,gBAAgB,YAAY,mCAAmC,oCAAoC,+GAA+G,mIAAmI,eAAe,4BAA4B,cAAc,OAAO,4BAA4B,sIAAsI,oBAAoB,2BAA2B,8LAA8L,GAAG,E;;;;;;;;;;ACD3xJ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;ACjEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAa,OAAO;AACpB,cAAa,YAAY;AACzB,eAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;;AAEA;AACA;AACA,cAAa,OAAO;AACpB,cAAa,MAAM;AACnB,eAAc;AACd;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAK;;AAEL;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,cAAa,OAAO;AACpB,eAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAa,QAAQ;AACrB,eAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAc;AACd;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA,QAAO;;AAEP;AACA;AACA;AACA;AACA;AACA,QAAO;;AAEP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAa,YAAY;AACzB,eAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;ACxOA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,cAAa,MAAM;AACnB,eAAc;AACd;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAa,YAAY;AACzB,eAAc;AACd;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAa,YAAY;AACzB,eAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,cAAa,OAAO;AACpB,cAAa,MAAM;AACnB,eAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,cAAa,OAAO;AACpB,cAAa,MAAM;AACnB,eAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA,MAAK;AACL,6DAA4D;AAC5D;AACA;AACA;;AAEA;AACA;AACA,cAAa,MAAM;AACnB,eAAc;AACd;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAK;AACL;AACA,MAAK;AACL;;AAEA;AACA;AACA;AACA;AACA","file":"tocbot.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\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\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.loaded = 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// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 555f597016c3faac7633\n **/","/**\n * Tocbot\n * Tocbot creates a toble of contents based on HTML headings on a page,\n * this allows users to easily jump to different sections of the document.\n * Tocbot was inspired by tocify (http://gregfranko.com/jquery.tocify.js/).\n * The main differences are that it works natively without any need for jquery or jquery UI).\n *\n * @author Tim Scanlin\n */\n\n/* globals define */\n\n(function(root, factory) {\n if (typeof define === 'function' && define.amd) {\n define([], factory(root));\n\t} else if (typeof exports === 'object') {\n module.exports = factory(root);\n\t} else {\n root.tocbot = factory(root);\n\t}\n})(typeof global !== 'undefined' ? global : this.window || this.global, function(root) {\n\n 'use strict';\n\n // Require smooth-scroll by default.\n var smoothScroll = require('smooth-scroll');\n\n // Default options.\n var defaultOptions = require('./default-options.js');\n // Object to store current options.\n var options = {};\n // Object for public APIs.\n var tocbot = {};\n\n var BuildHtml = require('./build-html.js');\n var ParseContent = require('./parse-content.js');\n // Keep these variables at top scope once options are passed in.\n var buildHtml;\n var parseContent;\n\n var doc = root.document;\n var body = document.body;\n var supports = !!root.document.querySelector && !!root.addEventListener; // Feature test\n var headingsArray;\n\n // From: https://github.com/Raynos/xtend\n var hasOwnProperty = Object.prototype.hasOwnProperty;\n function extend() {\n var target = {};\n for (var i = 0; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n }\n\n // From: https://remysharp.com/2010/07/21/throttling-function-calls\n function throttle(fn, threshhold, scope) {\n threshhold || (threshhold = 250);\n var last;\n var deferTimer;\n return function() {\n var context = scope || this;\n var now = +new Date;\n var args = arguments;\n if (last && now < last + threshhold) {\n // hold on to it\n clearTimeout(deferTimer);\n deferTimer = setTimeout(function() {\n last = now;\n fn.apply(context, args);\n }, threshhold);\n } else {\n last = now;\n fn.apply(context, args);\n }\n };\n }\n\n function updateTocListener(headings) {\n return function updateToc() {\n return buildHtml.updateToc(headings);\n };\n }\n\n /**\n\t * Destroy tocbot.\n\t */\n tocbot.destroy = function() {\n // Clear HTML.\n try {\n document.querySelector(options.tocSelector).innerHTML = '';\n } catch (e) {\n console.warn('Element not found: ' + options.tocSelector); // eslint-disable-line\n }\n\n\t\t// Remove event listeners.\n document.removeEventListener('scroll', this._scrollListener, false);\n document.removeEventListener('resize', this._scrollListener, false);\n if (buildHtml) {\n document.removeEventListener('click', this._clickListener, false);\n }\n\n // Destroy smoothScroll if it exists.\n if (smoothScroll) {\n smoothScroll.destroy();\n }\n };\n\n /**\n\t * Initialize tocbot.\n\t * @param {object} customOptions\n\t */\n tocbot.init = function(customOptions) {\n // feature test\n if (!supports) {\n return;\n }\n\n // Merge defaults with user options.\n // Set to options variable at the top.\n options = extend(defaultOptions, customOptions || {});\n this.options = options;\n this.state = {};\n\n // Pass options to these modules.\n buildHtml = BuildHtml(options);\n parseContent = ParseContent(options);\n\n // For testing purposes.\n this._buildHtml = buildHtml;\n this._parseContent = parseContent;\n\n // Destroy it if it exists first.\n tocbot.destroy();\n\n // Get headings array.\n headingsArray = parseContent.selectHeadings(options.contentSelector, options.headingSelector);\n // Return if no headings are found.\n if (headingsArray === null) {\n return;\n }\n\n // Build nested headings array.\n var nestedHeadingsObj = parseContent.nestHeadingsArray(headingsArray);\n var nestedHeadings = nestedHeadingsObj.nest;\n\n // Render.\n buildHtml.render(options.tocSelector, nestedHeadings);\n\n // Update Sidebar and bind listeners.\n // buildHtml.updateToc(headingsArray);\n this._scrollListener = throttle(function() {\n buildHtml.updateToc(headingsArray);\n }, options.throttleTimeout);\n this._scrollListener();\n document.addEventListener('scroll', this._scrollListener, false);\n document.addEventListener('resize', this._scrollListener, false);\n\n // Bind click listeners to disable animation.\n this._clickListener = throttle(function(event) {\n buildHtml.disableTocAnimation(event); // Save reference so event is created / removed properly.\n buildHtml.updateToc(headingsArray);\n }, options.throttleTimeout);\n document.addEventListener('click', this._clickListener, false);\n\n // Initialize smoothscroll if it exists.\n if (smoothScroll) {\n this.smoothScroll = smoothScroll.init(extend(options.smoothScrollOptions, {\n callback: buildHtml.enableTocAnimation\n }));\n }\n\n return this;\n };\n\n /**\n * Refresh tocbot.\n */\n tocbot.refresh = function(customOptions) {\n tocbot.destroy();\n tocbot.init(customOptions || this.options);\n };\n\n // Make tocbot available globally.\n root.tocbot = tocbot;\n\n return tocbot;\n});\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/js/index.js\n ** module id = 0\n ** module chunks = 0\n **/","/*! smooth-scroll v10.0.1 | (c) 2016 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/smooth-scroll */\n!function(e,t){\"function\"==typeof define&&define.amd?define([],t(e)):\"object\"==typeof exports?module.exports=t(e):e.smoothScroll=t(e)}(\"undefined\"!=typeof global?global:this.window||this.global,function(e){\"use strict\";var t,n,o,r,a,i,u,c={},l=\"querySelector\"in document&&\"addEventListener\"in e,s={selector:\"[data-scroll]\",selectorHeader:null,speed:500,easing:\"easeInOutCubic\",offset:0,callback:function(){}},f=function(){var e={},t=!1,n=0,o=arguments.length;\"[object Boolean]\"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(var r=function(n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t&&\"[object Object]\"===Object.prototype.toString.call(n[o])?e[o]=f(!0,e[o],n[o]):e[o]=n[o])};o>n;n++){var a=arguments[n];r(a)}return e},d=function(e){return Math.max(e.scrollHeight,e.offsetHeight,e.clientHeight)},h=function(e,t){var n,o,r=t.charAt(0),a=\"classList\"in document.documentElement;for(\"[\"===r&&(t=t.substr(1,t.length-2),n=t.split(\"=\"),n.length>1&&(o=!0,n[1]=n[1].replace(/\"/g,\"\").replace(/'/g,\"\")));e&&e!==document&&1===e.nodeType;e=e.parentNode){if(\".\"===r)if(a){if(e.classList.contains(t.substr(1)))return e}else if(new RegExp(\"(^|\\\\s)\"+t.substr(1)+\"(\\\\s|$)\").test(e.className))return e;if(\"#\"===r&&e.id===t.substr(1))return e;if(\"[\"===r&&e.hasAttribute(n[0])){if(!o)return e;if(e.getAttribute(n[0])===n[1])return e}if(e.tagName.toLowerCase()===t)return e}return null},m=function(e){\"#\"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,r=-1,a=\"\",i=n.charCodeAt(0);++r<o;){if(t=n.charCodeAt(r),0===t)throw new InvalidCharacterError(\"Invalid character: the input contains U+0000.\");a+=t>=1&&31>=t||127==t||0===r&&t>=48&&57>=t||1===r&&t>=48&&57>=t&&45===i?\"\\\\\"+t.toString(16)+\" \":t>=128||45===t||95===t||t>=48&&57>=t||t>=65&&90>=t||t>=97&&122>=t?n.charAt(r):\"\\\\\"+n.charAt(r)}return\"#\"+a},g=function(e,t){var n;return\"easeInQuad\"===e&&(n=t*t),\"easeOutQuad\"===e&&(n=t*(2-t)),\"easeInOutQuad\"===e&&(n=.5>t?2*t*t:-1+(4-2*t)*t),\"easeInCubic\"===e&&(n=t*t*t),\"easeOutCubic\"===e&&(n=--t*t*t+1),\"easeInOutCubic\"===e&&(n=.5>t?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),\"easeInQuart\"===e&&(n=t*t*t*t),\"easeOutQuart\"===e&&(n=1- --t*t*t*t),\"easeInOutQuart\"===e&&(n=.5>t?8*t*t*t*t:1-8*--t*t*t*t),\"easeInQuint\"===e&&(n=t*t*t*t*t),\"easeOutQuint\"===e&&(n=1+--t*t*t*t*t),\"easeInOutQuint\"===e&&(n=.5>t?16*t*t*t*t*t:1+16*--t*t*t*t*t),n||t},p=function(e,t,n){var o=0;if(e.offsetParent)do o+=e.offsetTop,e=e.offsetParent;while(e);return o=Math.max(o-t-n,0),Math.min(o,v()-b())},b=function(){return Math.max(document.documentElement.clientHeight,e.innerHeight||0)},v=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},y=function(e){return e&&\"object\"==typeof JSON&&\"function\"==typeof JSON.parse?JSON.parse(e):{}},O=function(e){return e?d(e)+e.offsetTop:0},H=function(t,n,o){o||(t.focus(),document.activeElement.id!==t.id&&(t.setAttribute(\"tabindex\",\"-1\"),t.focus(),t.style.outline=\"none\"),e.scrollTo(0,n))};c.animateScroll=function(n,o,i){var c=y(o?o.getAttribute(\"data-options\"):null),l=f(t||s,i||{},c),d=\"[object Number]\"===Object.prototype.toString.call(n)?!0:!1,h=d||!n.tagName?null:n;if(d||h){var m=e.pageYOffset;l.selectorHeader&&!r&&(r=document.querySelector(l.selectorHeader)),a||(a=O(r));var b,I,S=d?n:p(h,a,parseInt(l.offset,10)),E=S-m,A=v(),j=0,L=function(t,r,a){var i=e.pageYOffset;(t==r||i==r||e.innerHeight+i>=A)&&(clearInterval(a),H(n,r,d),l.callback(n,o))},w=function(){j+=16,b=j/parseInt(l.speed,10),b=b>1?1:b,I=m+E*g(l.easing,b),e.scrollTo(0,Math.floor(I)),L(I,S,u)},C=function(){clearInterval(u),u=setInterval(w,16)};0===e.pageYOffset&&e.scrollTo(0,0),C()}};var I=function(t){e.location.hash;n&&(n.id=n.getAttribute(\"data-scroll-id\"),c.animateScroll(n,o),n=null,o=null)},S=function(r){if(0===r.button&&!r.metaKey&&!r.ctrlKey&&(o=h(r.target,t.selector),o&&\"a\"===o.tagName.toLowerCase()&&o.hostname===e.location.hostname&&o.pathname===e.location.pathname&&/#/.test(o.href))){var a=m(o.hash);if(\"#\"===a){r.preventDefault(),n=document.body;var i=n.id?n.id:\"smooth-scroll-top\";return n.setAttribute(\"data-scroll-id\",i),n.id=\"\",void(e.location.hash.substring(1)===i?I():e.location.hash=i)}n=document.querySelector(a),n&&(n.setAttribute(\"data-scroll-id\",n.id),n.id=\"\",o.hash===e.location.hash&&(r.preventDefault(),I()))}},E=function(e){i||(i=setTimeout(function(){i=null,a=O(r)},66))};return c.destroy=function(){t&&(document.removeEventListener(\"click\",S,!1),e.removeEventListener(\"resize\",E,!1),t=null,n=null,o=null,r=null,a=null,i=null,u=null)},c.init=function(n){l&&(c.destroy(),t=f(s,n||{}),r=t.selectorHeader?document.querySelector(t.selectorHeader):null,a=O(r),document.addEventListener(\"click\",S,!1),e.addEventListener(\"hashchange\",I,!1),r&&e.addEventListener(\"resize\",E,!1))},c});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/smooth-scroll/dist/js/smooth-scroll.min.js\n ** module id = 1\n ** module chunks = 0\n **/","/**\n * Tocbot default options should all live in this file.\n *\n * @author Tim Scanlin\n */\n\nmodule.exports = {\n // Where to render the table of contents.\n tocSelector: '.js-toc',\n // Where to grab the headings to build the table of contents.\n contentSelector: '.js-toc-content',\n // Which headings to grab inside of the contentSelector element.\n headingSelector: 'h1, h2, h3',\n\n // Headings that match the ignoreSelector will be skipped.\n ignoreSelector: '.js-toc-ignore',\n // Main class to add to links.\n linkClass: 'toc-link',\n // Extra classes to add to links.\n extraLinkClasses: '',\n // Class to add to active links,\n // the link corresponding to the top most heading on the page.\n activeLinkClass: 'is-active-link',\n // Main class to add to lists.\n listClass: 'toc-list',\n // Extra classes to add to lists.\n extraListClasses: '',\n // Class that gets added when a list should be collapsed.\n isCollapsedClass: 'is-collapsed',\n // Class that gets added when a list should be able\n // to be collapsed but isn't necessarily collpased.\n collapsibleClass: 'is-collapsible',\n // Class to add to list items.\n listItemClass: 'toc-list-item',\n // How many heading levels should not be collpased.\n // For example, number 6 will show everything since\n // there are only 6 heading levels and number 0 will collpase them all.\n // The sections that are hidden will open\n // and close as you scroll to headings within them.\n collapseDepth: 0,\n // smooth-scroll options object, see docs at:\n // https://github.com/cferdinandi/smooth-scroll\n smoothScrollOptions: {\n easing: 'easeInOutCubic',\n offset: 0,\n speed: 300, // animation duration.\n updateURL: true\n },\n // Headings offset between the headings and the top of the document.\n headingsOffset: 0,\n // Timeout between events firing to make sure it's\n // not too rapid (for performance reasons).\n throttleTimeout: 50,\n // Element to add the positionFixedClass to.\n positionFixedSelector: null,\n // Fixed position class to add to make sidebar fixed after scrolling\n // down past the fixedSidebarOffset.\n positionFixedClass: 'is-position-fixed',\n // fixedSidebarOffset can be any number but by default is set\n // to auto which sets the fixedSidebarOffset to the sidebar\n // element's offsetTop from the top of the document on init.\n fixedSidebarOffset: 'auto',\n // includeHtml can be set to true to include the HTML markup from the\n // heading node instead of just including the textContent.\n includeHtml: false\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/js/default-options.js\n ** module id = 2\n ** module chunks = 0\n **/","/**\n * This file is responsible for building the DOM and updating DOM state.\n *\n * @author Tim Scanlin\n */\n\nmodule.exports = function(options) {\n var forEach = [].forEach;\n var some = [].some;\n var body = document.body;\n var currentlyHighlighting = true;\n var SPACE_CHAR = ' ';\n\n /**\n * Create link and list elements.\n * @param {Object} d\n * @param {HTMLElement} container\n * @return {HTMLElement}\n */\n function createEl(d, container) {\n var link = container.appendChild(createLink(d));\n if (d.children.length) {\n var list = createList(d.isCollapsed);\n d.children.forEach(function(child) {\n createEl(child, list);\n });\n link.appendChild(list);\n }\n }\n\n /**\n * Render nested heading array data into a given selector.\n * @param {String} selector\n * @param {Array} data\n * @return {HTMLElement}\n */\n function render(selector, data) {\n var self = this;\n var collapsed = false;\n var container = createList(collapsed);\n\n data.forEach(function(d) {\n createEl(d, container);\n });\n\n var parent = document.querySelector(selector);\n\n // Return if no parent is found.\n if (parent === null) {\n return;\n }\n\n // Remove existing child if it exists.\n if (parent.firstChild) {\n parent.removeChild(parent.firstChild);\n }\n\n // Append the Elements that have been created;\n return parent.appendChild(container);\n }\n\n /**\n * Create link element.\n * @param {Object} data\n * @return {HTMLElement}\n */\n function createLink(data) {\n var item = document.createElement('li');\n var a = document.createElement('a');\n if (options.listItemClass) {\n item.setAttribute('class', options.listItemClass);\n }\n if (options.includeHtml && data.childNodes.length) {\n forEach.call(data.childNodes, function(node) {\n a.appendChild(node.cloneNode(true));\n });\n } else {\n // Default behavior.\n a.textContent = data.textContent;\n }\n // Property for smooth-scroll.\n a.setAttribute('data-scroll', '');\n a.setAttribute('href', '#' + data.id);\n a.setAttribute('class', options.linkClass\n + SPACE_CHAR + 'node-name--' + data.nodeName\n + SPACE_CHAR + options.extraLinkClasses);\n item.appendChild(a);\n return item;\n }\n\n /**\n * Create list element.\n * @param {Boolean} isCollapsed\n * @return {HTMLElement}\n */\n function createList(isCollapsed) {\n var list = document.createElement('ul');\n var classes = options.listClass\n + SPACE_CHAR + options.extraListClasses;\n if (isCollapsed) {\n classes += SPACE_CHAR + options.collapsibleClass;\n classes += SPACE_CHAR + options.isCollapsedClass;\n }\n list.setAttribute('class', classes);\n return list;\n }\n\n /**\n * Update fixed sidebar class.\n * @return {HTMLElement}\n */\n function updateFixedSidebarClass() {\n var top = document.documentElement.scrollTop || body.scrollTop;\n var posFixedEl = document.querySelector(options.positionFixedSelector);\n\n if (options.fixedSidebarOffset === 'auto') {\n options.fixedSidebarOffset = document.querySelector(options.tocSelector).offsetTop;\n }\n\n if (top > options.fixedSidebarOffset) {\n if (posFixedEl.className.indexOf(options.positionFixedClass) === -1) {\n posFixedEl.className += SPACE_CHAR + options.positionFixedClass;\n }\n } else {\n posFixedEl.className = posFixedEl.className.split(SPACE_CHAR + options.positionFixedClass).join('');\n }\n }\n\n /**\n * Update TOC highlighting and collpased groupings.\n */\n function updateToc(headingsArray) {\n var top = document.documentElement.scrollTop || body.scrollTop;\n\n // Add fixed class at offset;\n if (options.positionFixedSelector) {\n updateFixedSidebarClass();\n }\n\n // Get the top most heading currently visible on the page so we know what to highlight.\n var headings = headingsArray;\n var topHeader;\n // Using some instead of each so that we can escape early.\n if (currentlyHighlighting\n && document.querySelector(options.tocSelector) !== null\n && headings.length > 0) {\n some.call(headings, function(heading, i) {\n if (heading.offsetTop > top + options.headingsOffset) {\n // Don't allow negative index value.\n var index = (i === 0) ? i : i - 1;\n topHeader = headings[index];\n return true;\n } else if (i === headings.length - 1) {\n // This allows scrolling for the last heading on the page.\n topHeader = headings[headings.length - 1];\n return true;\n }\n });\n\n // Remove the active class from the other tocLinks.\n var tocLinks = document.querySelector(options.tocSelector)\n .querySelectorAll('.' + options.linkClass);\n forEach.call(tocLinks, function(tocLink) {\n tocLink.className = tocLink.className.split(SPACE_CHAR + options.activeLinkClass).join('');\n });\n\n // Add the active class to the active tocLink.\n var activeTocLink = document.querySelector(options.tocSelector)\n .querySelector('.' + options.linkClass\n + '.node-name--' + topHeader.nodeName\n + '[href=\"#' + topHeader.id + '\"]');\n activeTocLink.className += SPACE_CHAR + options.activeLinkClass;\n\n var tocLists = document.querySelector(options.tocSelector)\n .querySelectorAll('.' + options.listClass + '.' + options.collapsibleClass);\n\n // Collapse the other collapsible lists.\n forEach.call(tocLists, function(list) {\n var collapsedClass = SPACE_CHAR + options.isCollapsedClass;\n if (list.className.indexOf(collapsedClass) === -1) {\n list.className += SPACE_CHAR + options.isCollapsedClass;\n }\n });\n\n // Expand the active link's collapsible list and its sibling if applicable.\n if (activeTocLink.nextSibling) {\n activeTocLink.nextSibling.className = activeTocLink.nextSibling.className.split(SPACE_CHAR + options.isCollapsedClass).join('');\n }\n removeCollapsedFromParents(activeTocLink.parentNode.parentNode);\n }\n }\n\n /**\n * Remove collpased class from parent elements.\n * @param {HTMLElement} element\n * @return {HTMLElement}\n */\n function removeCollapsedFromParents(element) {\n if (element.className.indexOf(options.collapsibleClass) !== -1) {\n element.className = element.className.split(SPACE_CHAR + options.isCollapsedClass).join('');\n return removeCollapsedFromParents(element.parentNode.parentNode);\n }\n return element;\n }\n\n /**\n * Disable TOC Animation when a link is clicked.\n * @param {Event} event\n */\n function disableTocAnimation(event) {\n var target = event.target || event.srcElement;\n if (target.className.indexOf(options.linkClass) === -1) {\n return;\n }\n // Bind to tocLink clicks to temporarily disable highlighting\n // while smoothScroll is animating.\n currentlyHighlighting = false;\n }\n\n /**\n * Enable TOC Animation.\n */\n function enableTocAnimation() {\n currentlyHighlighting = true;\n }\n\n return {\n enableTocAnimation: enableTocAnimation,\n disableTocAnimation: disableTocAnimation,\n render: render,\n updateToc: updateToc\n };\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/js/build-html.js\n ** module id = 3\n ** module chunks = 0\n **/","/**\n * This file is responsible for parsing the content from the DOM and making\n * sure data is nested properly.\n *\n * @author Tim Scanlin\n */\n\nmodule.exports = function parseContent(options) {\n var reduce = [].reduce;\n\n /**\n * Get the last item in an array and return a reference to it.\n * @param {Array} array\n * @return {Object}\n */\n function getLastItem(array) {\n return array[array.length - 1];\n }\n\n /**\n * Get heading level for a heading dom node.\n * @param {HTMLElement} heading\n * @return {Number}\n */\n function getHeadingLevel(heading) {\n return +heading.nodeName.split('H').join('');\n }\n\n /**\n * Get important properties from a heading element and store in a plain object.\n * @param {HTMLElement} heading\n * @return {Object}\n */\n function getHeadingObject(heading) {\n var obj = {\n id: heading.id,\n children: [],\n nodeName: heading.nodeName,\n headingLevel: getHeadingLevel(heading),\n textContent: heading.textContent.trim()\n };\n\n if (options.includeHtml) {\n obj.childNodes = heading.childNodes;\n }\n\n return obj;\n }\n\n /**\n * Add a node to the nested array.\n * @param {Object} node\n * @param {Array} nest\n * @return {Array}\n */\n function addNode(node, nest) {\n var obj = getHeadingObject(node);\n var level = getHeadingLevel(node);\n var array = nest;\n var lastItem = getLastItem(array);\n var lastItemLevel = lastItem\n ? lastItem.headingLevel\n : 0;\n var counter = level - lastItemLevel;\n\n while (counter > 0) {\n lastItem = getLastItem(array);\n if (lastItem && lastItem.children !== undefined) {\n array = lastItem.children;\n }\n counter--;\n }\n\n if (level >= options.collapseDepth) {\n obj.isCollapsed = true;\n }\n\n array.push(obj);\n return array;\n }\n\n /**\n * Select headings in content area, exclude any selector in options.ignoreSelector\n * @param {String} contentSelector\n * @param {Array} headingSelector\n * @return {Array}\n */\n function selectHeadings(contentSelector, headingSelector) {\n var selectors = headingSelector;\n if (options.ignoreSelector) {\n selectors = headingSelector.split(',')\n .map(function mapSelectors(selector) {\n return selector.trim() + ':not(' + options.ignoreSelector + ')';\n });\n }\n try {\n return document.querySelector(contentSelector)\n .querySelectorAll(selectors);\n } catch (e) {\n console.warn('Element not found: ' + contentSelector); // eslint-disable-line\n return null;\n }\n }\n\n /**\n * Nest headings array into nested arrays with 'children' property.\n * @param {Array} headingsArray\n * @return {Object}\n */\n function nestHeadingsArray(headingsArray) {\n return reduce.call(headingsArray, function reducer(prev, curr) {\n var currentHeading = getHeadingObject(curr);\n\n addNode(currentHeading, prev.nest);\n return prev;\n }, {\n nest: []\n });\n }\n\n return {\n nestHeadingsArray: nestHeadingsArray,\n selectHeadings: selectHeadings\n };\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/js/parse-content.js\n ** module id = 4\n ** module chunks = 0\n **/"],"sourceRoot":""}
|
data/exe/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "j1m_nav"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/exe/setup
ADDED
data/lib/j1m_toc.rb
ADDED
metadata
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: j1m_toc
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Juergen Adams
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-03-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: jekyll
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.14'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.14'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
description: J1 TOC Module is a gem-based module for J1 Template to create a table
|
56
|
+
of contents (TOC) automatically from the headlines of a page based on Tocbot.
|
57
|
+
email:
|
58
|
+
- juergen@jekyll-one.com
|
59
|
+
executables:
|
60
|
+
- console
|
61
|
+
- setup
|
62
|
+
extensions: []
|
63
|
+
extra_rdoc_files: []
|
64
|
+
files:
|
65
|
+
- LICENSE.md
|
66
|
+
- README.md
|
67
|
+
- _data/modules/default/j1_toc-0.0.1/j1_tocbot.yml
|
68
|
+
- _data/resources/default/j1_toc-0.0.1/resource.yml
|
69
|
+
- assets/themes/j1/j1/js/adapters/tocbot.js
|
70
|
+
- assets/themes/j1/tocbot/css/tocbot.css
|
71
|
+
- assets/themes/j1/tocbot/css/tocbot.min.css
|
72
|
+
- assets/themes/j1/tocbot/js/tocbot.js
|
73
|
+
- assets/themes/j1/tocbot/js/tocbot.min.js
|
74
|
+
- assets/themes/j1/tocbot/js/tocbot.min.js.map
|
75
|
+
- exe/console
|
76
|
+
- exe/setup
|
77
|
+
- lib/j1m_toc.rb
|
78
|
+
- lib/j1m_toc/version.rb
|
79
|
+
homepage: https://jekyll-one.com
|
80
|
+
licenses:
|
81
|
+
- MIT
|
82
|
+
metadata:
|
83
|
+
allowed_push_host: https://rubygems.org
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options: []
|
86
|
+
require_paths:
|
87
|
+
- lib
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
requirements: []
|
99
|
+
rubyforge_project:
|
100
|
+
rubygems_version: 2.6.11
|
101
|
+
signing_key:
|
102
|
+
specification_version: 4
|
103
|
+
summary: J1 TOC Module
|
104
|
+
test_files: []
|