diff --git a/assets/css/tocbot.css b/assets/css/tocbot.css index 21089a0a..40266bdf 100644 --- a/assets/css/tocbot.css +++ b/assets/css/tocbot.css @@ -52,6 +52,12 @@ a.toc-link { width: 2px } +@media (prefers-color-scheme: dark) { + .toc-link::before { + background-color: #EEE; + } +} + .is-active-link::before { background-color: #54BC4B } @@ -68,6 +74,8 @@ a.toc-link { .toc-list { overflow: hidden; list-style: none; + font-size: 16px; + line-height: 1.4; } @media (min-width: 1300px) { @@ -77,6 +85,7 @@ a.toc-link { bottom: 0; margin-top: 4vmin; grid-column: wide-start / main-start; /* Place the TOC to the left of the content */ + width: 250px; } .gh-toc { @@ -85,6 +94,12 @@ a.toc-link { } } -.gh-toc .is-active-link::before { - background-color: var(--ghost-accent-color); /* Defines TOC accent color based on Accent color set in Ghost Admin */ +a.toc-link { + text-decoration: none; } + +.gh-toc .is-active-link::before { + background-color: var(--ghost-accent-color); /* Defines TOC accent color based on Accent color set in Ghost Admin */ +} + +/* Additional style information from Jean interspersed */ diff --git a/assets/js/lib/tocbot.min.js b/assets/js/lib/tocbot.min.js new file mode 100644 index 00000000..6a7de0ea --- /dev/null +++ b/assets/js/lib/tocbot.min.js @@ -0,0 +1 @@ +!function(e){var t={};function n(o){if(t[o])return t[o].exports;var l=t[o]={i:o,l:!1,exports:{}};return e[o].call(l.exports,l,l.exports,n),l.l=!0,l.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var l in e)n.d(o,l,function(t){return e[t]}.bind(null,l));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){(function(o){var l,r,i,s;s=void 0!==o?o:this.window||this.global,r=[],l=function(e){"use strict";var t,o,l,r=n(2),i={},s={},c=n(3),a=n(4),u=n(5),d=!!(e&&e.document&&e.document.querySelector&&e.addEventListener);if("undefined"!=typeof window||d){var f=Object.prototype.hasOwnProperty;return s.destroy=function(){if(!i.skipRendering)try{document.querySelector(i.tocSelector).innerHTML=""}catch(e){console.warn("Element not found: "+i.tocSelector)}i.scrollContainer&&document.querySelector(i.scrollContainer)?(document.querySelector(i.scrollContainer).removeEventListener("scroll",this._scrollListener,!1),document.querySelector(i.scrollContainer).removeEventListener("resize",this._scrollListener,!1),t&&document.querySelector(i.scrollContainer).removeEventListener("click",this._clickListener,!1)):(document.removeEventListener("scroll",this._scrollListener,!1),document.removeEventListener("resize",this._scrollListener,!1),t&&document.removeEventListener("click",this._clickListener,!1))},s.init=function(e){if(d&&(i=function(){for(var e={},t=0;te.fixedSidebarOffset?-1===n.className.indexOf(e.positionFixedClass)&&(n.className+=" "+e.positionFixedClass):n.className=n.className.split(" "+e.positionFixedClass).join("")}();var s,c=r;if(l&&null!==document.querySelector(e.tocSelector)&&c.length>0){n.call(c,(function(t,n){return function t(n){var o=0;return n!==document.querySelector(e.contentSelector&&null!=n)&&(o=n.offsetTop,e.hasInnerContainers&&(o+=t(n.offsetParent))),o}(t)>i+e.headingsOffset+10?(s=c[0===n?n:n-1],!0):n===c.length-1?(s=c[c.length-1],!0):void 0}));var a=document.querySelector(e.tocSelector).querySelectorAll("."+e.linkClass);t.call(a,(function(t){t.className=t.className.split(" "+e.activeLinkClass).join("")}));var u=document.querySelector(e.tocSelector).querySelectorAll("."+e.listItemClass);t.call(u,(function(t){t.className=t.className.split(" "+e.activeListItemClass).join("")}));var d=document.querySelector(e.tocSelector).querySelector("."+e.linkClass+".node-name--"+s.nodeName+'[href="'+e.basePath+"#"+s.id.replace(/([ #;&,.+*~':"!^$[\]()=>|/@])/g,"\\$1")+'"]');-1===d.className.indexOf(e.activeLinkClass)&&(d.className+=" "+e.activeLinkClass);var f=d.parentNode;f&&-1===f.className.indexOf(e.activeListItemClass)&&(f.className+=" "+e.activeListItemClass);var m=document.querySelector(e.tocSelector).querySelectorAll("."+e.listClass+"."+e.collapsibleClass);t.call(m,(function(t){-1===t.className.indexOf(e.isCollapsedClass)&&(t.className+=" "+e.isCollapsedClass)})),d.nextSibling&&-1!==d.nextSibling.className.indexOf(e.isCollapsedClass)&&(d.nextSibling.className=d.nextSibling.className.split(" "+e.isCollapsedClass).join("")),function t(n){if(-1!==n.className.indexOf(e.collapsibleClass)&&-1!==n.className.indexOf(e.isCollapsedClass))return n.className=n.className.split(" "+e.isCollapsedClass).join(""),t(n.parentNode.parentNode);return n}(d.parentNode.parentNode)}}}}},function(e,t){e.exports=function(e){var t=[].reduce;function n(e){return e[e.length-1]}function o(e){return+e.nodeName.split("H").join("")}function l(t){if(!(t instanceof window.HTMLElement))return t;if(e.ignoreHiddenElements&&(!t.offsetHeight||!t.offsetParent))return null;var n={id:t.id,children:[],nodeName:t.nodeName,headingLevel:o(t),textContent:e.headingLabelCallback?String(e.headingLabelCallback(t.textContent)):t.textContent.trim()};return e.includeHtml&&(n.childNodes=t.childNodes),e.headingObjectCallback?e.headingObjectCallback(n,t):n}return{nestHeadingsArray:function(o){return t.call(o,(function(t,o){var r=l(o);return r&&function(t,o){for(var r=l(t),i=r.headingLevel,s=o,c=n(s),a=i-(c?c.headingLevel:0);a>0;)(c=n(s))&&void 0!==c.children&&(s=c.children),a--;i>=e.collapseDepth&&(r.isCollapsed=!0),s.push(r)}(r,t.nest),t}),{nest:[]})},selectHeadings:function(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(e){return console.warn("Element not found: "+t),null}}}}},function(e,t){e.exports=function(e){var t=document.querySelector(e.tocSelector);if(t&&t.scrollHeight>t.clientHeight){var n=t.querySelector("."+e.activeListItemClass);n&&(t.scrollTop=n.offsetTop)}}},function(e,t){t.initSmoothScrolling=function(e){document.documentElement.style;var t=e.duration,n=e.offset,o=location.hash?l(location.href):location.href;function l(e){return e.slice(0,e.lastIndexOf("#"))}document.body.addEventListener("click",(function(r){var i;"a"!==(i=r.target).tagName.toLowerCase()||!(i.hash.length>0||"#"===i.href.charAt(i.href.length-1))||l(i.href)!==o&&l(i.href)+"#"!==o||r.target.className.indexOf("no-smooth-scroll")>-1||"#"===r.target.href.charAt(r.target.href.length-2)&&"!"===r.target.href.charAt(r.target.href.length-1)||-1===r.target.className.indexOf(e.linkClass)||function(e,t){var n,o,l=window.pageYOffset,r={duration:t.duration,offset:t.offset||0,callback:t.callback,easing:t.easing||function(e,t,n,o){return(e/=o/2)<1?n/2*e*e+t:(e--,-n/2*(e*(e-2)-1)+t)}},i=document.querySelector('[id="'+decodeURI(e).split("#").join("")+'"]'),s="string"==typeof e?r.offset+(e?i&&i.getBoundingClientRect().top||0:-(document.documentElement.scrollTop||document.body.scrollTop)):e,c="function"==typeof r.duration?r.duration(s):r.duration;function a(e){o=e-n,window.scrollTo(0,r.easing(o,l,s,c)),o {{meta_title}} - - - + {{#is "home"}} {{#if @site.cover_image}} @@ -109,7 +68,7 @@ {{! Tocbot is used for the table of contents }} - +