Webseite:aThemes - Awesome WordPress ThemesInhalt
aThemes-AwesomeWordPressThemes&PluginsclassLazyLoaderJsCss{constructor(triggerEvents){this.triggerEvents=triggerEvents;this.eventOptions={passive:true};this.userEventListener=this.triggerListener.bind(this);this.delayedScripts={normal:[],async:[],defer:[]};this.allJQueries=[]}_addUserInteractionListener(){this.triggerEvents.forEach(event=>window.addEventListener(event,this.userEventListener,this.eventOptions))}_removeUserInteractionListener(){this.triggerEvents.forEach(event=>window.removeEventListener(event,this.userEventListener,this.eventOptions))}triggerListener(){this._removeUserInteractionListener(this);if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",this._loadEverythingNow.bind(this))}else{this._loadEverythingNow()}}async_loadEverythingNow(){this._runAllDelayedCSS();this._delayEventListeners();this._delayJQueryReady();this._handleDocumentWrite();this._registerAllDelayedScripts();awaitthis._loadScriptsFromList(this.delayedScripts.normal);awaitthis._loadScriptsFromList(this.delayedScripts.defer);awaitthis._loadScriptsFromList(this.delayedScripts.async);awaitthis._triggerDOMContentLoaded();awaitthis._triggerWindowLoad();window.dispatchEvent(newEvent("wpr-allScriptsLoaded"))}_registerAllDelayedScripts(){document.querySelectorAll("script[type=atdelay]").forEach(script=>{if(script.hasAttribute("src")){if(script.hasAttribute("async")&&script.async!==false){this.delayedScripts.async.push(script)}elseif(script.hasAttribaThemes - Awesome WordPress Themesute("defer")&&script.defer!==false||script.getAttribute("data-type")==="module"){this.delayedScripts.defer.push(script)}else{this.delayedScripts.normal.push(script)}}else{this.delayedScripts.normal.push(script)}})}_runAllDelayedCSS(){document.querySelectorAll("link[rel=atdelay]").forEach(link=>{link.setAttribute("rel","stylesheet")})}async_transformScript(script){awaitthis._requestAnimFrame();returnnewPromise(resolve=>{constnewScript=document.createElement("script");letdataType;[...script.attributes].forEach(attr=>{letattrName=attr.nodeName;if(attrName!=="type"){if(attrName==="data-type"){attrName="type";dataType=attr.nodeValue}newScript.setAttribute(attrName,attr.nodeValue)}});if(script.hasAttribute("src")){newScript.addEventListener("load",resolve);newScript.addEventListener("error",resolve)}else{newScript.text=script.text;resolve()}script.parentNode.replaceChild(newScript,script)})}async_loadScriptsFromList(scriptList){constscript=scriptList.shift();if(script){awaitthis._transformScript(script);returnthis._loadScriptsFromList(scriptList)}else{returnPromise.resolve()}}_delayEventListeners(){constrewrittenEvents={};functionrewriteEventListener(target,eventName){if(!rewrittenEvents[target]){rewrittenEvents[target]={originalFunctions:{add:target.addEventListener,remove:target.removeEventListener},eventsToRewrite:[]};target.addEventListener=function(){arguments[0]=getRewrittenEvent(arguments[0]);rewrittenEvents[target].originalFunctions.addaThemes - Awesome WordPress Themes.apply(target,arguments)};target.removeEventListener=function(){arguments[0]=getRewrittenEvent(arguments[0]);rewrittenEvents[target].originalFunctions.remove.apply(target,arguments)}}rewrittenEvents[target].eventsToRewrite.push(eventName)}functiongetRewrittenEvent(eventName){returnrewrittenEvents[document].eventsToRewrite.indexOf(eventName)>=0?"wpr-"+eventName:eventName}rewriteEventListener(document,"DOMContentLoaded");rewriteEventListener(window,"DOMContentLoaded");rewriteEventListener(window,"load");rewriteEventListener(window,"peshow");rewriteEventListener(document,"readystatechange");functiondefinePropertyRewriter(target,prop){letoriginal=target[prop];Object.defineProperty(target,prop,{get:()=>original||function(){},set(value){target["wpr"+prop]=original=value}})}definePropertyRewriter(document,"onreadystatechange");definePropertyRewriter(window,"onload");definePropertyRewriter(window,"onpeshow")}_delayJQueryReady(){letjQuery=window.jQuery;Object.defineProperty(window,"jQuery",{get:()=>jQuery,set:newValue=>{if(newValue&&newValue.fn&&!this.allJQueries.includes(newValue)){newValue.fn.ready=newValue.fn.init.prototype.ready=(fn)=>{if(this.domReadyFired){fn.bind(document)(newValue)}else{document.addEventListener("DOMContentLoaded2",()=>fn.bind(document)(newValue))}};constoriginalOn=newValue.fn.on;newValue.fn.on=newValue.fn.init.prototype.on=function(){if(this[0]===window){arguments[0]=rewriteJQueryEvents(arguments[0])}returnoriginalOn.apply(this,arguments)};this.allJQueries.push(newValue)}jQuery=newValue}});functionrewriteJQueryEvents(eventString){returneventString.split("").map(event=>{returnevent==="load"||event.startsWith("load.")?"wpr-jquery-load":event}).join("")}}async_triggerDOMContentLoaded(){this.domReadyFired=true;awaitthis._requestAnimFrame();document.dispatchEvent(newEvent("DOMContentLoaded2"));awaitthis._requestAnimFrame();window.dispatchEvent(newEvent("DOMContentLoaded2"));awaitthis._requestAnimFrame();document.dispatchEvent(newEvent("wpr-readystatechange"));awaitthis._requestAnimFrame();if(docaThemes - Awesome WordPress Themesument.wpronreadystatechange){document.wpronreadystatechange()}}async_triggerWindowLoad(){awaitthis._requestAnimFrame();window.dispatchEvent(newEvent("wpr-load"));awaitthis._requestAnimFrame();if(window.wpronload){window.wpronload()}awaitthis._requestAnimFrame();this.allJQueries.forEach(jQuery=>jQuery(window).trigger("wpr-jquery-load"));window.dispatchEvent(newEvent("wpr-peshow"));awaitthis._requestAnimFrame();if(window.wpronpeshow){window.wpronpeshow()}}_handleDocumentWrite(){constnextSiblings=newMap();document.write=document.writeln=(html)=>{constscript=document.currentScript;constrange=document.createRange();constparent=script.parentElement;letnextSibling=nextSiblings.get(script);if(nextSibling===undefined){nextSibling=script.nextSibling;nextSiblings.set(script,nextSibling)}constfrment=document.createDocumentFrment();range.setStart(frment,0);frment.appendChild(range.createContextualFrment(html));parent.insertBefore(frment,nextSibling)}}async_requestAnimFrame(){returnnewPromise(resolve=>requestAnimationFrame(resolve))}staticrun(){constloader=newLazyLoaderJsCss(["keydown","mousemove","touchmove","touchstart","touchend","wheel"]);loader._addUserInteractionListener()}}LazyLoaderJsCss.run();setTimeout(function(){if(window.scrollY>500){window.dispatchEvent(newEvent("mousemove"));}},100);/**/!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version=‘2.0’;n.queue=[];t=b.createElement(e);t.async=!0;t.src=v;s=b.getElementsByTName(e)[0];s.parentNode.insertBefore(t,s)}(window,document,‘script’,‘connect.facebook.net/en_US/fbevents.js’);fbq(‘init’,‘’);fbq(‘track’,‘PeView’);