www.netz39.de/assets/js/main.min.js

6 lines
No EOL
2.8 KiB
JavaScript

/* @preserve Cookie Consent Init */
function createCookie(e,t,n){var o="";if(n){var a=new Date;a.setTime(a.getTime()+24*n*60*60*1e3),o="; expires="+a.toUTCString()}document.cookie=`${e}=${t}${o}; path=/`}function readCookie(e){for(var t=e+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){for(var a=n[o];" "===a.charAt(0);)a=a.substring(1,a.length);if(0===a.indexOf(t))return a.substring(t.length,a.length)}return null}function addCookieConsentListener(){document.getElementById("cookie-notice-accept").addEventListener("click",(function(){createCookie(cookieName,"true",31),document.getElementById("cookie-notice").style.display="none",location.reload()}))}function googleAnalytics(){if(""!==analyticsName.toLowerCase()){function e(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],e("js",new Date),e("config",analyticsName,{anonymize_ip:!0}),analyticsNameGA4&&e("config",analyticsNameGA4,{anonymize_ip:!0})}}"true"===isCookieConsent.toLowerCase()?(addCookieConsentListener(),"true"===readCookie(cookieName)?googleAnalytics():document.getElementById("cookie-notice").style.display="block"):googleAnalytics()
/* @preserve Dark mode Init */;const themeButton={light:`<i class="fas fa-adjust" aria-hidden="true"></i><span class="navbar-label-with-icon"> ${darkBtn}</span>`,dark:`<i class="fas fa-adjust fa-rotate-180" aria-hidden="true"></i><span class="navbar-label-with-icon"> ${lightBtn}</span>`};function currentTheme(){return localStorage.getItem("theme")}function setMode(e){document.documentElement.setAttribute("data-theme",e),localStorage.setItem("theme",e);const t=document.getElementById("theme-toggle");t&&(t.innerHTML=themeButton[e])}function themeToggle(){setMode("light"===currentTheme()?"dark":"light")}function bootstrapTheme(){if(isAutoTheme){if(!currentTheme()){let e=window.matchMedia("(prefers-color-scheme: dark)");e.matches&&localStorage.setItem("theme","dark"),e.addEventListener("change",(()=>{e.matches&&localStorage.setItem("theme","dark")}))}let e=currentTheme();setMode(e||"light")}}bootstrapTheme();
/* @preserve Masonry Init */
try{var elem=document.querySelector(".grid"),msnry=new Masonry(elem,{itemSelector:".grid-item",columnWidth:".grid-sizer",gutter:".gutter-sizer",percentPosition:!0}),imgLoad=imagesLoaded(elem);imgLoad.on("progress",(function(e,t){msnry.layout()}))}catch(e){if(!(e instanceof ReferenceError))throw e}
/* @preserve Navbar */document.addEventListener("DOMContentLoaded",(function(e){const t=document.getElementById("pull"),n=document.querySelector("nav ul");["click","touch"].forEach((function(e){t?.addEventListener(e,(function(){n.classList.toggle("hide")}),!1)})),window.addEventListener("scroll",(function(){const e=-(window.scrollY||window.pageYOffset||document.body.scrollTop)/3,t=document.getElementById("main");t&&(t.style.backgroundPosition="100% "+(e-50)+"px, 0%, center top")}))}));