mirror of
https://github.com/panr/hugo-theme-terminal.git
synced 2024-12-05 03:03:55 +03:00
1 line
No EOL
2.7 KiB
JavaScript
1 line
No EOL
2.7 KiB
JavaScript
!function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.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 r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));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){n(1),n(2),e.exports=n(3)},function(e,t){},function(e,t){var n=document.querySelector(".container"),o=document.querySelector(".menu"),r=document.querySelector(".menu-trigger"),i=(document.querySelector(".menu__inner--desktop"),document.querySelector(".menu__sub-inner-more-trigger")),c=document.querySelector(".menu__sub-inner-more"),u=getComputedStyle(document.body).getPropertyValue("--phoneWidth"),a=function(){return window.matchMedia(u).matches},d=function(){r&&r.classList.toggle("hidden",!a()),o&&o.classList.toggle("hidden",a()),c&&c.classList.toggle("hidden",!a())};o&&o.addEventListener("click",function(e){return e.stopPropagation()}),c&&c.addEventListener("click",function(e){return e.stopPropagation()}),d(),document.body.addEventListener("click",function(){a()||!c||c.classList.contains("hidden")?a()&&!o.classList.contains("hidden")&&o.classList.add("hidden"):c.classList.add("hidden")}),window.addEventListener("resize",d),r&&r.addEventListener("click",function(e){e.stopPropagation(),o&&o.classList.toggle("hidden")}),i&&i.addEventListener("click",function(e){e.stopPropagation(),c&&c.classList.toggle("hidden"),c.getBoundingClientRect().right>n.getBoundingClientRect().right&&(c.style.left="auto",c.style.right=0)})},function(e,t){var n=getComputedStyle(document.body).getPropertyValue("--phoneWidth");window.matchMedia(n).matches||(languageSelector=document.querySelector(".language-selector-current"),moreLanguagesContainer=document.querySelector(".language-selector__more"),document.body.addEventListener("click",function(){moreLanguagesContainer&&!moreLanguagesContainer.classList.contains("hidden")&&moreLanguagesContainer.classList.add("hidden")}),languageSelector&&languageSelector.addEventListener("click",function(e){e.stopPropagation(),moreLanguagesContainer.classList.toggle("hidden")}))}]); |