2 lines
8.8 KiB
JavaScript
2 lines
8.8 KiB
JavaScript
(function(e){var t={};function o(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,o),i.l=!0,i.exports}o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)o.d(n,i,function(t){return e[t]}.bind(null,i));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=2)})([function(e,t,o){"use strict";o.d(t,"a",(function(){return n}));function n(e,t,o,n){function i(e){return e instanceof o?e:new o((function(t){t(e)}))}return new(o||(o=Promise))((function(o,s){function c(e){try{r(n.next(e))}catch(t){s(t)}}function a(e){try{r(n["throw"](e))}catch(t){s(t)}}function r(e){e.done?o(e.value):i(e.value).then(c,a)}r((n=n.apply(e,t||[])).next())}))}},,function(e,t,o){"use strict";o.r(t);var n=o(0);class i{static toggleClass(e,t,o){e&&(o?e.classList.contains(t)||e.classList.toggle(t):e.classList.contains(t)&&e.classList.toggle(t))}static getElementByTagName(e){try{return document.getElementsByTagName(e)[0]}catch(t){return null}}static getElementByID(e){try{return document.getElementById(e)}catch(t){return null}}}class s{static init(){const e=document.getElementById("cookie-layer"),t=this.getLocalStore("accepted");e&&null===t&&this.showLayer(e)}static showLayer(e){i.toggleClass(e,"hide-cookie-consent",!1),i.toggleClass(e,"show-cookie-consent",!0);try{const t=e.getElementsByClassName("cookie-layer__accept")[0];t.addEventListener("click",t=>{t.stopImmediatePropagation(),t.preventDefault(),i.toggleClass(e,"show-cookie-consent",!1),i.toggleClass(e,"hide-cookie-consent",!0),this.setLocalStore("accepted","true")});const o=e.getElementsByClassName("cookie-layer__decline")[0];o.addEventListener("click",t=>{t.stopImmediatePropagation(),t.preventDefault(),i.toggleClass(e,"show-cookie-consent",!1),i.toggleClass(e,"hide-cookie-consent",!0),this.setLocalStore("accepted","false")})}catch(t){console.log("eeeor",t)}}static setLocalStore(e,t){try{s.onCookieAcceptCallback&&s.onCookieAcceptCallback("true"===t),localStorage.setItem("cookieConsent_"+e,t)}catch(o){}}static getLocalStore(e){try{return"true"===localStorage.getItem("cookieConsent_"+e)||"false"===localStorage.getItem("cookieConsent_"+e)?"true"===localStorage.getItem("cookieConsent_"+e):null}catch(t){return!1}}static get cookiesAccepted(){return this.getLocalStore("accepted")}}s.onCookieAcceptCallback=null;class c{static init(){document.querySelectorAll("a.btn-scroll-up").forEach(e=>{try{const t=e;t.addEventListener("click",e=>{e.preventDefault(),e.stopImmediatePropagation(),window.scroll(0,0)})}catch(t){}})}}class a{static log(...e){console.log.apply(console,e)}static error(...e){console.error.apply(console,e)}}class r{constructor(e){this.componentName="",this.componentName=e}static getLogger(e,t=!1){const o=new r(e);return o.log=()=>{},o.error=()=>{},o}log(...e){e.unshift(`[${this.componentName}] `),a.log(...e)}error(...e){e.unshift(`[${this.componentName}] `),a.error(...e)}}class l{static delay(e){return Object(n["a"])(this,void 0,void 0,(function*(){return new Promise(t=>setTimeout(t,e))}))}}const d=r.getLogger("Navigation",!0);class g{static init(e,t){if(d.log("INIT NAVI CONTROLLER"),!e&&!t)return void d.log("INIT NAVI CONTROLLER - RETURN");g.previousScrollPosition=window.pageYOffset,g.updateHeight(t,e.offsetHeight),e.style.top="0rem",window.onscroll=()=>{g.openState;const o=window.pageYOffset;if(g.previousScrollPosition>o)e.style.top="0rem";else{const t=e.offsetHeight/16;"0rem"==e.style.top&&(e.style.top="-"+t+"rem")}0==o?(e.classList.remove("page-head--sticky"),t.classList.remove("page-head__spacer--sticky")):o>e.offsetHeight&&(e.classList.contains("page-head--sticky")||e.classList.add("page-head--sticky"),t.classList.contains("page-head__spacer--sticky")||t.classList.add("page-head__spacer--sticky")),g.previousScrollPosition=o},window.onresize=()=>{g.updateHeight(t,e.offsetHeight)};const o=e.querySelector("input.prm-nav__mobile-toggle");if(o&&o.addEventListener("change",()=>{const e=document.getElementsByTagName("body")[0];o.checked?(g.openState=!0,e.style.overflow="hidden"):(g.openState=!1,e.style.overflow="auto")}),o){const t=e.querySelectorAll("a");for(const i of t)i.addEventListener("click",()=>Object(n["a"])(this,void 0,void 0,(function*(){o.checked=!1,g.openState=!1;const t=document.getElementsByTagName("body")[0];t.style.overflow="auto";const n=e.offsetHeight/16;yield l.delay(200),"0rem"==e.style.top&&(e.style.top="-"+n+"rem")})))}}static updateHeight(e,t){e.style.height=t+"px"}}g.previousScrollPosition=0,g.openState=!1;class u{static init(){const e=".animation",t="animate",o=e=>e.classList.add(t),n=e=>e.classList.contains(t),i=()=>{let e=[],t=20;for(let o=1;o<=t;o++){let n=o/t;e.push(n)}return e.push(0),e},s={root:null,rootMargin:"0px",threshold:i()},c=new IntersectionObserver((e,t)=>{e.forEach(e=>{e.isIntersecting,e.intersectionRatio>.3&&(o(e.target),t.unobserve(e.target))})},s),a=[].filter.call(document.querySelectorAll(e),e=>!n(e));a.forEach(e=>c.observe(e))}}const p=r.getLogger("GoogleAnalyticsHelper",!0);class h{constructor(){this.useTracking=!1}static get instance(){return h.theInstance||(h.theInstance=new h),h.theInstance}opt_out(){if(p.log("optout"),this.useTracking)try{const e="ga-disable-"+this.getUACode();window[e]=!0}catch(e){p.error(e)}this.useTracking=!1}opt_in(){p.log("optin"),this.useTracking=!0;try{const e="ga-disable-"+this.getUACode();window[e]=!1}catch(e){p.error(e)}}sendEvent(e,t,o,i,s=!1){return Object(n["a"])(this,void 0,void 0,(function*(){if(this.useTracking)try{const n=yield this.getGTag();p.log("Sending event:",e),n("event",t,{event_category:e,event_label:o,value:i,non_interaction:s})}catch(n){p.error(n)}else p.log("do not send - disabled")}))}sendException(e){return Object(n["a"])(this,void 0,void 0,(function*(){if(this.useTracking){p.log("Sending exception");try{const t=yield this.getGTag();t("event","exception",{description:e,fatal:!1})}catch(t){p.error(t)}}else p.log("do not send exception- disabled")}))}sendPageView(e=null){return Object(n["a"])(this,void 0,void 0,(function*(){if(this.useTracking)try{const t=yield this.getGTag();p.log("Sending pageview",e);let o={};return e&&(o=Object.assign({page_title:e})),t("config",this.getUACode(),o),!0}catch(t){p.error(t)}else p.log("do not sendPageView - disabled")}))}getGTag(){return Object(n["a"])(this,void 0,void 0,(function*(){return this.gaPromise||(this.gaPromise=new Promise((e,t)=>Object(n["a"])(this,void 0,void 0,(function*(){try{yield this.initGA();const t=window;function o(...e){t.dataLayer.push(arguments)}t.dataLayer=t.dataLayer||[],o("js",new Date),o("config",this.getUACode(),{anonymize_ip:!0,send_page_view:!1}),e(o)}catch(n){t("GA NOT AVAILABLE")}})))),this.gaPromise}))}getUACode(){const e=document.getElementsByTagName("body")[0];return e.dataset["ua"]||"UA-000000000-0"}initGA(){return Object(n["a"])(this,void 0,void 0,(function*(){const e="https://www.googletagmanager.com/gtag/js?id="+this.getUACode();return document.querySelector("head script[google-analytics]")?Promise.resolve():new Promise((t,o)=>{p.log("LOAD GOOGLE ANALYTICS");const n=document.head||document.getElementsByTagName("head")[0],i=document.createElement("script");i.setAttribute("data-name","google_analytics"),i.async=!0,i.src=e,n.appendChild(i),i.onload=()=>{t()},i.onerror=o})}))}}const f=r.getLogger("TrackingController");class y{static init(){return Object(n["a"])(this,void 0,void 0,(function*(){f.log("cookiesAccepted",s.cookiesAccepted),null===s.cookiesAccepted?s.onCookieAcceptCallback=e=>Object(n["a"])(this,void 0,void 0,(function*(){e?(h.instance.opt_in(),yield h.instance.sendPageView()):h.instance.opt_out()})):s.cookiesAccepted?(h.instance.opt_in(),yield h.instance.sendPageView()):h.instance.opt_out()}))}}class m{static init(){const e=document.querySelectorAll(".page-header__topline-words");window.onresize=()=>{e.forEach(e=>{m.calculateLines(e)})},e.forEach(e=>{m.calculateLines(e)})}static calculateLines(e){const t=e.querySelectorAll("span");let o=0;t.forEach(e=>{e.offsetTop>o?(o=e.offsetTop,i.toggleClass(e,"page-header__topline-words-first-in-line",!0)):i.toggleClass(e,"page-header__topline-words-first-in-line",!1)})}}function v(){return Object(n["a"])(this,void 0,void 0,(function*(){g.init(document.getElementsByTagName("header")[0],document.getElementsByClassName("page-head__spacer")[0]),s.init(),c.init(),u.init(),m.init(),document.dispatchEvent(new Event("initialized")),yield y.init()}))}document.addEventListener("DOMContentLoaded",v,!1)}]);
|