1 line
1.7 KiB
JavaScript
1 line
1.7 KiB
JavaScript
|
(()=>{"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(e,n){for(var o=0;o<n.length;o++){var r=n[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(i=r.key,a=void 0,a=function(e,n){if("object"!==t(e)||null===e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var r=o.call(e,n||"default");if("object"!==t(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(i,"string"),"symbol"===t(a)?a:String(a)),r)}var i,a}var n,o=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var n,o,r;return n=t,o=[{key:"emit",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:document,o=new CustomEvent(t,{detail:e,bubbles:!0,composed:!0});n.dispatchEvent(o)}},{key:"on",value:function(t,e){(arguments.length>2&&void 0!==arguments[2]?arguments[2]:document).addEventListener(t,e)}},{key:"off",value:function(t,e){(arguments.length>2&&void 0!==arguments[2]?arguments[2]:document).removeEventListener(t,e)}}],o&&e(n.prototype,o),r&&e(n,r),Object.defineProperty(n,"prototype",{writable:!1}),t}();new o;n=()=>{document.querySelectorAll(".category-nav li[data-path]").forEach((t=>{var e;const n=null!==(e=t.getAttribute("data-path"))&&void 0!==e?e:"";location.pathname.indexOf(n)>-1?t.classList.add("active"):t.classList.remove("active")}))},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",n):n()})();
|