/*============ COOKIE CONSENT ============*/ document.addEventListener("DOMContentLoaded", function() { var cookieHint = document.getElementById("cookie-consent"); if (cookieHint !== null) { function getCookieValue(a) { var b = document.cookie.match('(^|;)\\s*' + a + '\\s*=\\s*([^;]+)'); return b ? b.pop() : ''; } var ccRawValue = getCookieValue("langohr-dsgvo"); var ccDecodedValue = decodeURIComponent(ccRawValue); var ccCheckboxes = document.querySelectorAll(".cc-checkbox"); var ccOptBtn = document.getElementById("cc-opt-btn"); var ccReqBtn = document.getElementById("cc-req-btn"); var host = window.location.hostname; if (document.cookie.indexOf("langohr-dsgvo") !== -1) { cookieHint.style.display = "none"; } else { cookieHint.style.display = "block"; } // cookieHint.style.display = "block"; var ccSetCheckmarks = function() { // setTimeout(function(){ var ccCookieCheckbox2168 = document.getElementById(2168); ccCookieCheckbox2168.removeAttribute("checked"); ccCookieCheckbox2168.classList.remove("checked"); ccCookieCheckbox2168.classList.add("notchecked"); if (ccDecodedValue.search(2168) !== -1) { ccCookieCheckbox2168.setAttribute("checked", "checked"); ccCookieCheckbox2168.classList.remove("notchecked"); ccCookieCheckbox2168.classList.add("checked"); // console.log(ccCookieCheckbox); } var ccCookieCheckbox2171 = document.getElementById(2171); ccCookieCheckbox2171.removeAttribute("checked"); ccCookieCheckbox2171.classList.remove("checked"); ccCookieCheckbox2171.classList.add("notchecked"); if (ccDecodedValue.search(2171) !== -1) { ccCookieCheckbox2171.setAttribute("checked", "checked"); ccCookieCheckbox2171.classList.remove("notchecked"); ccCookieCheckbox2171.classList.add("checked"); // console.log(ccCookieCheckbox); } var ccCookieCheckbox2172 = document.getElementById(2172); ccCookieCheckbox2172.removeAttribute("checked"); ccCookieCheckbox2172.classList.remove("checked"); ccCookieCheckbox2172.classList.add("notchecked"); if (ccDecodedValue.search(2172) !== -1) { ccCookieCheckbox2172.setAttribute("checked", "checked"); ccCookieCheckbox2172.classList.remove("notchecked"); ccCookieCheckbox2172.classList.add("checked"); // console.log(ccCookieCheckbox); } // }, 500); }; if (document.cookie.indexOf("langohr-dsgvo") !== -1) { // if (host.search("local") === -1) { ccSetCheckmarks(); if (ccDecodedValue.search(2168) !== -1) { window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-P268V4RZ21'); } if (ccDecodedValue.search(2171) !== -1) { } if (ccDecodedValue.search(2172) !== -1) { } // } } var ccSetCookie = function(btnMode) { var cc_checked_Ids = "id"; for (var i = ccCheckboxes.length - 1; i >= 0; i--) { if (ccCheckboxes[i].checked) { if (btnMode === "opt") { cc_checked_Ids = cc_checked_Ids + "-" + ccCheckboxes[i].getAttribute("id"); } else { if (ccCheckboxes[i].hasAttribute("required")) { cc_checked_Ids = cc_checked_Ids + "-" + ccCheckboxes[i].getAttribute("id"); } } } } var expDate = new Date(); expDate = expDate.setDate(expDate.getDate() + 365); expDate = new Date(expDate).toUTCString(); document.cookie = "langohr-dsgvo=" + cc_checked_Ids + "; expires=" + expDate + "; path=/; SameSite; Secure"; if (cc_checked_Ids.search(2168) !== -1) { window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-P268V4RZ21'); } if (cc_checked_Ids.search(2171) !== -1) { } if (cc_checked_Ids.search(2172) !== -1) { } }; var btnMode = "req"; ccOptBtn.addEventListener("click", function() { btnMode = "opt"; ccSetCookie(btnMode); // if (document.body.className.search("dp-page") !== -1) { location.reload(); // } else { // TweenMax.to(cookieHint, 0.5, {opacity: 0, ease:Power3.easeInOut, onComplete:function(){ cookieHint.style.display = "none"; }}); // } }); ccReqBtn.addEventListener("click", function() { btnMode = "req"; ccSetCookie(btnMode); location.reload(); if (document.body.className.search("dp-page") !== -1) { location.reload(); } else { TweenMax.to(cookieHint, 0.5, {opacity: 0, ease:Power3.easeInOut, onComplete:function(){ cookieHint.style.display = "none"; }}); } }); } var ccToggleBtns = document.querySelectorAll(".cc-toggle-btn"); if (ccToggleBtns.length) { /* ======== TOGGLE ======== */ var ccTgglBtnAction = function(toggleBtn) { var toggleBtnId = toggleBtn.getAttribute("id"); var toggleFrame = document.getElementById(toggleBtnId.replace("btn", "frame")); var toggleWrapper = document.getElementById(toggleBtnId.replace("btn", "wrapper")); var toggleContent = document.getElementById(toggleBtnId.replace("btn", "content")); var toggleContentHeight = toggleContent.clientHeight; toggleBtn.addEventListener("click" , function(event) { event.preventDefault(); toggleContentHeight = toggleContent.clientHeight; if (toggleBtn.className.search(" active") !== -1) { toggleBtn.classList.remove("active"); toggleFrame.classList.remove("active"); toggleWrapper.style.height = 0; // TweenMax.to(toggleWrapper, 0.75, { height:0, ease:Circ.easeOut}); } else { toggleBtn.classList.add("active"); toggleFrame.classList.add("active"); toggleWrapper.style.height = toggleContentHeight + "px"; // TweenMax.to(toggleWrapper, 0.75, { height:toggleContentHeight, ease:Circ.easeOut}); } }); window.addEventListener("resize" , function() { if (toggleBtn.className.search(" active") !== -1) { toggleWrapper.style.height = toggleContent.clientHeight + "px"; } }); }; for (var i = ccToggleBtns.length - 1; i >= 0; i--) { ccTgglBtnAction(ccToggleBtns[i]); } } });