1 line
20 KiB
JavaScript
Executable File
1 line
20 KiB
JavaScript
Executable File
Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(e){var t=this;do{if(t.matches(e))return t;t=t.parentElement||t.parentNode}while(null!==t&&1===t.nodeType);return null}),window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach),function(){var e=function(e){return e.replace(/^\s+|\s+$/g,"")},t=function(e){return RegExp("(^|\\s+)"+e+"(\\s+|$)")},r=function(e,t,r){for(var n=0;n<e.length;n++)t.call(r,e[n])};function n(e){this.element=e}n.prototype={add:function(){r(arguments,function(t){this.contains(t)||(this.element.className=e(this.element.className+" "+t))},this)},remove:function(){r(arguments,function(r){this.element.className=e(this.element.className.replace(t(r)," "))},this)},toggle:function(e){return this.contains(e)?(this.remove(e),!1):(this.add(e),!0)},contains:function(e){return t(e).test(this.element.className)},item:function(e){return this.element.className.split(/\s+/)[e]||null},replace:function(e,t){this.remove(e),this.add(t)}},"classList"in Element.prototype||Object.defineProperty(Element.prototype,"classList",{get:function(){return new n(this)}}),window.DOMTokenList&&!DOMTokenList.prototype.replace&&(DOMTokenList.prototype.replace=n.prototype.replace)}();var hesterGetIndex=function(e){for(var t=0;e=e.previousElementSibling;)t++;return t},hesterSlideUp=(e,t=500)=>{e.style.transitionProperty="height, margin, padding",e.style.transitionDuration=t+"ms",e.style.boxSizing="border-box",e.style.height=e.offsetHeight+"px",e.offsetHeight,e.style.overflow="hidden",e.style.height=0,e.style.paddingTop=0,e.style.paddingBottom=0,e.style.marginTop=0,e.style.marginBottom=0,window.setTimeout(()=>{e.style.display=null,e.style.removeProperty("height"),e.style.removeProperty("padding-top"),e.style.removeProperty("padding-bottom"),e.style.removeProperty("margin-top"),e.style.removeProperty("margin-bottom"),e.style.removeProperty("overflow"),e.style.removeProperty("transition-duration"),e.style.removeProperty("transition-property")},t)},hesterSlideDown=(e,t=500)=>{e.style.removeProperty("display");let r=window.getComputedStyle(e).display;"none"===r&&(r="block"),e.style.display=r;let n=e.offsetHeight;e.style.overflow="hidden",e.style.height=0,e.style.paddingTop=0,e.style.paddingBottom=0,e.style.marginTop=0,e.style.marginBottom=0,e.offsetHeight,e.style.boxSizing="border-box",e.style.transitionProperty="height, margin, padding",e.style.transitionDuration=t+"ms",e.style.height=n+"px",e.style.removeProperty("padding-top"),e.style.removeProperty("padding-bottom"),e.style.removeProperty("margin-top"),e.style.removeProperty("margin-bottom"),window.setTimeout(()=>{e.style.removeProperty("height"),e.style.removeProperty("overflow"),e.style.removeProperty("transition-duration"),e.style.removeProperty("transition-property")},t)},hesterScrollTo=function(){var e={tolerance:0,duration:800,easing:"easeOutQuart",container:window,callback:function e(){}};function t(e,t,r,n){return e/=n,-r*(--e*e*e*e-1)+t}function r(e,t){var r={};return Object.keys(e).forEach(function(t){r[t]=e[t]}),Object.keys(t).forEach(function(e){r[e]=t[e]}),r}function n(e){return e instanceof HTMLElement?e.scrollTop:e.pageYOffset}function s(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},s=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};this.options=r(e,n),this.easeFunctions=r({easeOutQuart:t},s)}return s.prototype.registerTrigger=function(e,t){var n=this;if(e){var s,o,i,l=e.getAttribute("href")||e.getAttribute("data-target"),a=l&&"#"!==l?document.getElementById(l.substring(1)):document.body,c=r(this.options,(s=e,o=this.options,i={},Object.keys(o).forEach(function(e){var t,r=s.getAttribute("data-mt-".concat((t=e).replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})));r&&(i[e]=isNaN(r)?r:parseInt(r,10))}),i));"function"==typeof t&&(c.callback=t);var d=function e(t){t.preventDefault(),n.move(a,c)};return e.addEventListener("click",d,!1),function(){return e.removeEventListener("click",d,!1)}}},s.prototype.move=function(e){var t,s=this,o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(0===e||e){o=r(this.options,o);var i="number"==typeof e?e:e.getBoundingClientRect().top,l=n(o.container),a=null;i-=o.tolerance;var c=function r(c){var d=n(s.options.container);a||(a=c-1);var u=c-a;if(t&&(0<i&&t>d||0>i&&t<d))return o.callback(e);t=d;var h=s.easeFunctions[o.easing](u,l,i,o.duration);o.container.scroll(0,h),u<o.duration?window.requestAnimationFrame(r):(o.container.scroll(0,i+l),o.callback(e))};window.requestAnimationFrame(c)}},s.prototype.addEaseFunction=function(e,t){this.easeFunctions[e]=t},s}(),hesterGetParents=(e,t)=>{Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),r=t.length;0<=--r&&t.item(r)!==this;);return -1<r});for(var r=[];e&&e!==document;e=e.parentNode)t?e.matches(t)&&r.push(e):r.push(e);return r};!function(){if("function"==typeof window.CustomEvent)return!1;function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var r=document.createEvent("CustomEvent");return r.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),r}e.prototype=window.Event.prototype,window.CustomEvent=e}();var hesterTriggerEvent=function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},n=new CustomEvent(t,r);e.dispatchEvent(n)};!function(){var e=document.querySelector("#hester-scroll-top"),t=document.getElementById("page"),r=()=>{var e,t,r;!document.body.classList.contains("hester-is-mobile")&&(r=window.innerWidth,document.querySelectorAll(".sub-menu").forEach(n=>{n.style.visibility="visible";let s=n.getBoundingClientRect();e=(t=s.left+window.pageXOffset)+s.width,n.removeAttribute("style"),e>r?n.closest("li").classList.add("opens-left"):0>t&&n.closest("li").classList.add("opens-right")}))},n=e=>{var t;return function(){var r=arguments;t&&window.cancelAnimationFrame(t),t=window.requestAnimationFrame(function(){e.apply(this,r)})}},s=()=>{null!==e&&(450<window.pageYOffset||450<document.documentElement.scrollTop?e.classList.add("hester-visible"):e.classList.remove("hester-visible"))},o=()=>{if(hester_vars["sticky-header"].enabled){var e,t,r=document.getElementById("hester-header"),s=document.getElementById("hester-header-inner"),o=document.getElementById("wpadminbar");if(document.body.classList.contains("hester-header-layout-3")&&(r=document.querySelector("#hester-header .hester-nav-container"),s=document.querySelector("#hester-header .hester-nav-container .hester-container")),window.outerWidth<=hester_vars["responsive-breakpoint"])var r=document.getElementById("hester-header"),s=document.getElementById("hester-header-inner");if(null!==r&&null!==s){var i=r.getBoundingClientRect().bottom,l=0>=i-e;e=null===o?0:600>=window.outerWidth?0:o.getBoundingClientRect().height;var a=function(){e=null===o?0:600>=window.outerWidth?0:o.getBoundingClientRect().height,l=0>=(i=r.getBoundingClientRect().bottom)-e,c()},c=function(){let e=hester_vars["sticky-header"].hide_on;e.includes("desktop")&&992<=window.innerWidth&&(l=!1),e.includes("tablet")&&481<=window.innerWidth&&992>window.innerWidth&&(l=!1),e.includes("mobile")&&481>window.innerWidth&&(l=!1),l?document.body.classList.contains("hester-sticky-header")||((t=document.createElement("div")).setAttribute("id","hester-sticky-placeholder"),t.style.height=s.getBoundingClientRect().height+"px",r.appendChild(t),document.body.classList.add("hester-sticky-header"),document.body.style.setProperty("--hester-sticky-h-offset",r.offsetHeight+20+"px")):(document.body.classList.contains("hester-sticky-header")&&(document.body.classList.remove("hester-sticky-header"),document.getElementById("hester-sticky-placeholder").remove()),document.body.style.removeProperty("--hester-sticky-h-offset"))};"true"!==r.getAttribute("data-scroll-listener")&&(window.addEventListener("scroll",function(){n(a())}),r.setAttribute("data-scroll-listener","true")),"true"!==r.getAttribute("data-resize-listener")&&(window.addEventListener("resize",function(){n(a())}),r.setAttribute("data-resize-listener","true")),hesterTriggerEvent(window,"scroll")}}},i=()=>{let e=new hesterScrollTo({tolerance:null===document.getElementById("wpadminbar")?0:document.getElementById("wpadminbar").getBoundingClientRect().height}),t=document.getElementsByClassName("hester-smooth-scroll");for(var r=0;r<t.length;r++)e.registerTrigger(t[r])},l=()=>{document.body.classList.contains("hester-menu-accessibility")&&document.querySelectorAll(".hester-nav").forEach(e=>{e.querySelectorAll("ul").forEach(e=>{e.parentNode.setAttribute("aria-haspopup","true")}),e.querySelectorAll("a").forEach(e=>{e.addEventListener("focus",a,!0),e.addEventListener("blur",a,!0)})})};function a(){for(var e=this;!e.classList.contains("hester-nav");)"li"===e.tagName.toLowerCase()&&(e.classList.contains("hovered")?e.classList.remove("hovered"):e.classList.add("hovered")),e=e.parentElement}var c=()=>{document.body.addEventListener("keydown",function(e){document.body.classList.add("using-keyboard")}),document.body.addEventListener("mousedown",function(e){document.body.classList.remove("using-keyboard")})},d=()=>{document.body.style.setProperty("--hester-screen-width",document.body.clientWidth+"px")},u=()=>{var e=null;document.querySelectorAll(".hester-nav .menu-item-has-children").forEach(e=>{e.addEventListener("mouseenter",function(){document.querySelectorAll(".menu-item-has-children").forEach(e=>{e.classList.remove("hovered")})})}),document.querySelectorAll(".hester-nav .menu-item-has-children").forEach(t=>{t.addEventListener("mouseleave",function(){t.classList.add("hovered"),null!==e&&(clearTimeout(e),e=null),e=setTimeout(()=>{t.classList.remove("hovered"),t.querySelectorAll(".menu-item-has-children").forEach(e=>{e.classList.remove("hovered")})},700)})})},h=()=>{var e=null;document.querySelectorAll(".hester-header-widget__cart .hester-widget-wrapper").forEach(e=>{e.addEventListener("mouseenter",function(){e.classList.remove("dropdown-visible")})}),document.querySelectorAll(".hester-header-widget__cart .hester-widget-wrapper").forEach(t=>{t.addEventListener("mouseleave",function(){t.classList.add("dropdown-visible"),null!==e&&(clearTimeout(e),e=null),e=setTimeout(()=>{t.classList.remove("dropdown-visible")},700)})})},m=()=>{var e=document.querySelectorAll(".hester-search");if(0!==e.length){e.forEach(e=>{e.addEventListener("click",t=>{t.preventDefault(),e.classList.contains("hester-active")?n(e):r(e)})}),document.querySelectorAll(".hester-search-close").forEach(e=>e.addEventListener("click",function(t){t.preventDefault(),e.classList.contains("hester-active")||(n(document.querySelector(".hester-search")),document.querySelector(".hester-search").focus())}));var r=function(e){document.querySelectorAll(".hester-search-form").forEach(function(e){if(!e)return!1;document.addEventListener("keydown",function(t){var r,n,s,o,i,l;n="input, a, button",o=(s=e.querySelectorAll(n))[s.length-1],r=s[0],i=9===t.keyCode,(l=t.shiftKey)||!i||o!==document.activeElement||(t.preventDefault(),r.focus()),l&&i&&r===document.activeElement&&(t.preventDefault(),o.focus())})}),document.body.classList.add("hester-search-visible"),setTimeout(function(){e.classList.add("hester-active"),null!==e.nextElementSibling&&null!==e.nextElementSibling.querySelector("input")&&(e.nextElementSibling.querySelector("input").focus(),e.nextElementSibling.querySelector("input").select())},100),document.addEventListener("keydown",s),t.addEventListener("click",o)},n=function(e){document.body.classList.remove("hester-search-visible"),e.classList.remove("hester-active"),document.removeEventListener("keydown",s),t.removeEventListener("click",o)},s=function(e){27==e.keyCode&&document.querySelectorAll(".hester-search").forEach(e=>{n(e)})},o=function(e){null===e.target.closest(".hester-search-container")&&null===e.target.closest(".hester-search")&&document.querySelectorAll(".hester-search").forEach(e=>{n(e)})}}},y=()=>{var e=t,r=document.querySelector("#hester-header-inner .hester-nav");document.querySelectorAll(".hester-mobile-nav > button").forEach(e=>{e.addEventListener("click",function(e){e.preventDefault(),document.body.parentNode.classList.contains("is-mobile-menu-active")?s():n()},!1)});var n=function(t){var n=document.querySelectorAll(".site-header");document.body.classList.contains("hester-is-mobile")&&n.forEach(function(e){if(!e)return!1;document.addEventListener("keydown",function(t){var r,n,s,o,i,l,a;n=".hester-nav a, .hester-nav button",o=(s=e.querySelectorAll(n))[s.length-1],r=s[0],i=9===t.keyCode,l=t.shiftKey,a=document.querySelector(".hester-hamburger-hester-primary-nav"),!l&&i&&o===document.activeElement&&(t.preventDefault(),a.focus()),l&&i&&r===document.activeElement&&(t.preventDefault(),a.focus()),i&&r===o&&t.preventDefault()})}),document.body.parentNode.classList.add("is-mobile-menu-active"),document.addEventListener("keyup",i),null!==e&&e.addEventListener("click",o),document.querySelectorAll("#hester-header .hester-nav").forEach(e=>{e.addEventListener("click",l)}),hesterSlideDown(r,350)},s=function(t){document.body.parentNode.classList.remove("is-mobile-menu-active"),document.removeEventListener("keyup",i),null!==e&&e.removeEventListener("click",o),document.querySelectorAll("#hester-header .hester-nav > ul > .hester-open").forEach(e=>{a(e)}),r.querySelectorAll(".hovered").forEach(e=>{e.classList.remove("hovered")}),document.body.classList.contains("hester-is-mobile")?(document.querySelectorAll("#hester-header .hester-nav").forEach(e=>{e.removeEventListener("click",l)}),hesterSlideUp(r,250)):r.style.display=null},o=function(e){null===e.target.closest(".hester-hamburger")&&null===e.target.closest(".site-navigation")&&s()},i=function(e){27==e.keyCode&&s()},l=function(e){e.target.parentElement.querySelectorAll(".sub-menu").length&&(e.preventDefault(),"button"===e.target.type&&a(e.target.parentElement))},a=e=>{e.classList.contains("hester-open")?(e.classList.remove("hester-open"),e.querySelectorAll(".sub-menu").forEach(e=>{hesterSlideUp(e,350)}),e.querySelectorAll("li").forEach(e=>{e.parentElement.classList.remove("hester-open"),e.nextElementSibling.querySelectorAll(".sub-menu").forEach(e=>{hesterSlideUp(e,350)})})):(e.querySelectorAll(".sub-menu").forEach(t=>{e===t.parentElement&&hesterSlideDown(t,350)}),e.classList.add("hester-open"))};document.addEventListener("hester-close-mobile-menu",s)},v=(e=0)=>{if(null!==document.getElementById("hester-preloader")){var t=()=>{!document.body.classList.contains("hester-loaded")&&(document.body.classList.add("hester-loading"),setTimeout(function(){document.body.classList.replace("hester-loading","hester-loaded"),hesterTriggerEvent(document.body,"hester-preloader-done")},250))};return 0<e?setTimeout(function(){t()},e):t(),!1}},p=()=>{if(document.body.classList.contains("hester-has-comments-toggle")&&null!=document.getElementById("hester-comments-toggle")){var e=e=>{void 0!==e&&e.preventDefault(),document.body.classList.contains("comments-visible")?(document.body.classList.remove("comments-visible"),document.getElementById("hester-comments-toggle").querySelector("span").innerHTML=hester_vars.strings.comments_toggle_show):(document.body.classList.add("comments-visible"),document.getElementById("hester-comments-toggle").querySelector("span").innerHTML=hester_vars.strings.comments_toggle_hide)};null!==document.getElementById("hester-comments-toggle")&&(-1!==location.href.indexOf("#comment")||-1!==location.href.indexOf("respond"))&&e(),document.getElementById("hester-comments-toggle").addEventListener("click",e)}},f=()=>{var e=document.querySelector(".single .comments-link");null!==e&&e.addEventListener("click",function(e){document.body.classList.contains("hester-has-comments-toggle")&&!document.body.classList.contains("comments-visible")&&document.getElementById("hester-comments-toggle").click()})},g=()=>{window.innerWidth<=hester_vars["responsive-breakpoint"]?document.body.classList.add("hester-is-mobile"):document.body.classList.contains("hester-is-mobile")&&(document.body.classList.remove("hester-is-mobile"),hesterTriggerEvent(document,"hester-close-mobile-menu"))};document.addEventListener("DOMContentLoaded",function(){v(5e3),l(),c(),s(),i(),u(),p(),m(),y(),g(),r(),f(),h(),o(),d()}),window.addEventListener("load",function(){v()}),window.addEventListener("scroll",function(){n(s())}),window.addEventListener("resize",function(){n(r()),n(g()),n(d())}),hesterTriggerEvent(document.body,"hester-ready"),window.hester=window.hester||{},window.hester.preloader=v,window.hester.stickyHeader=o,window.App={},App.config={headroom:{enabled:!0,options:{classes:{initial:"headroom",pinned:"is-pinned",unpinned:"is-unpinned",top:"is-top",notTop:"is-not-top",bottom:"is-bottom",notBottom:"is-not-bottom",frozen:"is-frozen"}}},ajax:{enabled:!0},cursorFollower:{enabled:!0,disableBreakpoint:"992"}},App.html=document.querySelector("html"),App.body=document.querySelector("body"),window.onload=function(){App.config.cursorFollower.enabled&&b.init()};let b=function(){let e=document.querySelector(".hester-js-cursor"),t,r,n,s,o,i,l,a,c;function d({target:t}){e.classList.add("is-active"),t.getAttribute("data-cursor-label")&&(App.body.classList.add("is-cursor-active"),e.classList.add("has-label"),r.innerHTML=t.getAttribute("data-cursor-label")),t.getAttribute("data-cursor-icon")&&(App.body.classList.add("is-cursor-active"),e.classList.add("has-icon"),t.getAttribute("data-cursor-icon"))}function u({target:t}){App.body.classList.remove("is-cursor-active"),e.classList.remove("is-active"),e.classList.remove("has-label"),e.classList.remove("has-icon"),r.innerHTML="",n.innerHTML=""}function h(){e&&(a=document.querySelectorAll(["button","a","input","[data-cursor]","[data-cursor-label]","[data-cursor-icon]","textarea"])).forEach(e=>{e.addEventListener("mouseenter",d),e.addEventListener("mouseleave",u)})}function m(){e&&a.forEach(e=>{e.removeEventListener("mouseenter",d),e.removeEventListener("mouseleave",u)})}return{init:function a(){if(!e)return;t=e.querySelector(".hester-js-follower"),r=e.querySelector(".hester-js-label"),n=e.querySelector(".hester-js-icon"),s=-100,o=-100,i=e.offsetWidth/2,l=e.offsetHeight/2,c=!1,c=!0,e.classList.add("is-enabled"),document.addEventListener("mousedown",t=>{e.classList.add("is-mouse-down")}),document.addEventListener("mouseup",t=>{e.classList.remove("is-mouse-down")}),document.addEventListener("mousemove",e=>{s=e.clientX,o=e.clientY});let d=()=>{e.style.transform=`translate(${s-i}px, ${o-l}px)`,requestAnimationFrame(d)};requestAnimationFrame(d),h(),function t(){if(c&&App.config.cursorFollower.disableBreakpoint)(0<window.innerWidth?window.innerWidth:screen.width)<App.config.cursorFollower.disableBreakpoint?(c=!1,e.classList.remove("is-enabled"),m()):(c=!0,e.classList.add("is-enabled"),h()),window.addEventListener("resize",()=>{(0<window.innerWidth?window.innerWidth:screen.width)<App.config.cursorFollower.disableBreakpoint?(c=!1,e.classList.remove("is-enabled"),m()):(c=!0,e.classList.add("is-enabled"),h())})}()},update:h,clear:m,hide:function t(){e&&e.classList.add("is-hidden")},show:function t(){e&&e.classList.remove("is-hidden")}}}();if(document.body.classList.contains("is-parallax-footer")){var E,L,$=document.querySelector(".is-parallax-footer");function S(e,t){var r,n;(r=t,window.innerHeight<r.offsetHeight)?(t.style.bottom="",t.style.top="0"):(t.style.top="",t.style.bottom="0"),window.scrollY>(n=e,n.offsetTop+n.offsetHeight)?(t.style.position="static",$.style.marginBottom="0"):($.style.marginBottom=t.offsetHeight+"px",t.style.position="fixed")}E=document.getElementById("main"),L=document.getElementById("colophon"),L.style.left="0",L.style.right="0",L.style.zIndex="-1",S(E,L),window.addEventListener("resize",function(){S(E,L)}),window.addEventListener("scroll",function(){S(E,L)})}let k=document.querySelector(".hester-darkmode"),q=localStorage.getItem("theme");q&&(document.documentElement.setAttribute("data-theme",q),"dark"===q&&null!=k&&(k.checked=!0)),null!=k?k.addEventListener("change",function e(t){t.target.checked?(document.documentElement.setAttribute("data-theme","dark"),localStorage.setItem("theme","dark")):(document.documentElement.setAttribute("data-theme","light"),localStorage.setItem("theme","light"))},!1):localStorage.removeItem("theme")}(); |