hugo-theme-hello-friend/static/assets/main.js

1 line
2.5 KiB
JavaScript
Raw Normal View History

2019-02-01 10:13:10 +01:00
!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,n){"use strict"},function(e,t,n){"use strict";var o=document.querySelector(".container"),r=document.querySelector(".menu"),i=document.querySelector(".menu-trigger"),c=(document.querySelector(".menu__inner--desktop"),document.querySelector(".menu__sub-inner-more-trigger")),d=document.querySelector(".menu__sub-inner-more"),u=getComputedStyle(document.body).getPropertyValue("--phoneWidth"),s=function(){return window.matchMedia(u).matches},l=function(){i&&i.classList.toggle("hidden",!s()),r&&r.classList.toggle("hidden",s()),d&&d.classList.toggle("hidden",!s())};r&&r.addEventListener("click",function(e){return e.stopPropagation()}),d&&d.addEventListener("click",function(e){return e.stopPropagation()}),l(),document.body.addEventListener("click",function(){s()||d.classList.contains("hidden")?s()&&!r.classList.contains("hidden")&&r.classList.add("hidden"):d.classList.add("hidden")}),window.addEventListener("resize",l),i&&i.addEventListener("click",function(e){e.stopPropagation(),r&&r.classList.toggle("hidden")}),c&&c.addEventListener("click",function(e){e.stopPropagation(),d&&d.classList.toggle("hidden"),d.getBoundingClientRect().right>o.getBoundingClientRect().right&&(d.style.left="auto",d.style.right=0)})},function(e,t,n){"use strict";var o=window.localStorage&&window.localStorage.getItem("theme"),r=document.querySelector(".theme-toggle"),i="dark"===o;null!==o&&document.body.classList.toggle("dark-theme",i),r.addEventListener("click",function(){document.body.classList.toggle("dark-theme"),window.localStorage&&window.localStorage.setItem("theme",document.body.classList.contains("dark-theme")?"dark":"light")})}]);