daux.io/themes/daux/js/daux.min.js
2020-02-08 15:49:07 +01:00

3 regels
2.8 KiB
JavaScript

!function(){"use strict";function e(e){"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()}function t(e,t){for(var n=0;n<e.length;n++)e[n].classList.toggle("CodeToggler--hidden",t);try{localStorage.setItem("daux_code_blocks_hidden",t)}catch(e){}}function n(e){var t=void 0!==e.preventDefault;t&&e.preventDefault();var n=function(e){for(var t=e;(t=t.parentNode)&&9!==t.nodeType;)if(1===t.nodeType&&t.classList.contains("Nav__item"))return t;throw new Error("Could not find a NavItem...")}(e.target),o=n.querySelector("ul.Nav");t&&n.classList.contains("Nav__item--open")?(o.style.height="".concat(o.scrollHeight,"px"),o.style.transitionDuration="150ms",o.style.height="0px",n.classList.remove("Nav__item--open")):t?(o.style.transitionDuration="150ms",o.addEventListener("transitionend",(function e(t){"0px"!==t.target.style.height&&(t.target.style.height="auto"),t.target.removeEventListener("transitionend",e)})),o.style.height="".concat(o.scrollHeight,"px"),n.classList.add("Nav__item--open")):o.style.height="auto"}e((function(){var e=document.querySelectorAll(".s-content pre"),n=document.querySelector(".CodeToggler");n&&(e.length?function(e,n){var o=e.querySelector(".CodeToggler__button--main");o.addEventListener("change",(function(e){t(n,!e.target.checked)}),!1);var a=!1;try{"false"===(a=localStorage.getItem("daux_code_blocks_hidden"))?a=!1:"true"===a&&(a=!0),a&&(t(n,!!a),o.checked=!a)}catch(e){}}(n,e):n.classList.add("CodeToggler--hidden"))})),e((function(){var e=document.querySelector(".Collapsible__trigger");if(e){var t=document.querySelector(".Collapsible__content");e.addEventListener("click",(function(n){t.classList.contains("Collapsible__content--open")?(t.style.height=0,t.classList.remove("Collapsible__content--open"),e.setAttribute("aria-expanded","false")):(e.setAttribute("aria-expanded","true"),t.style.transitionDuration="150ms",t.style.height="".concat(t.scrollHeight,"px"),t.classList.add("Collapsible__content--open"))}))}})),e((function(){var e=document.querySelectorAll("pre > code:not(.hljs)");if(e.length){var t=document.getElementsByTagName("head")[0],n=document.createElement("script");n.type="text/javascript",n.async=!0,n.src="".concat(window.base_url,"daux_libraries/highlight.pack.js"),n.onload=function(t){[].forEach.call(e,window.hljs.highlightBlock)},t.appendChild(n)}})),e((function(){for(var e,t=document.querySelectorAll(".Nav__item.has-children i.Nav__arrow"),o=t.length-1;o>=0;o--)(e=t[o]).addEventListener("click",n),e.parentNode.parentNode.classList.contains("Nav__item--open")&&n({target:e});var a=document.querySelectorAll(".Nav__item__link--nopage"),r=!0,i=!1,l=void 0;try{for(var c,s=a[Symbol.iterator]();!(r=(c=s.next()).done);r=!0){c.value.addEventListener("click",n)}}catch(e){i=!0,l=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw l}}}))}();
//# sourceMappingURL=daux.min.js.map