_includes/head/index.html in word-games-theme-0.6.3 vs _includes/head/index.html in word-games-theme-0.6.4

- old
+ new

@@ -98,9 +98,37 @@ {%- if page.tool -%} {%- include Rating/structureddata.html -%} {%- endif -%} - {% include adsense/adsense.html %} {%- include google-analytics.html -%} + + + <script> + const autoLoadDuration = 5; //In Seconds + const eventList = ["keydown", "mousemove", "wheel", "touchmove", "touchstart", "touchend"]; + + const autoLoadTimeout = setTimeout(runScripts, autoLoadDuration * 1000); + + eventList.forEach(function (event) { + window.addEventListener(event, triggerScripts, { passive: true }) + }); + + function triggerScripts() { + runScripts(); + clearTimeout(autoLoadTimeout); + eventList.forEach(function (event) { + window.removeEventListener(event, triggerScripts, { passive: true }); + }); + } + + function runScripts() { + console.log(document.querySelector("script")) + console.log("Javascript Executed!") + console.log(document.querySelectorAll("script[delay]")) + document.querySelectorAll("script[delay]").forEach(function (scriptTag) { + scriptTag.setAttribute("src", scriptTag.getAttribute("delay")); + }); + } + </script> </head> \ No newline at end of file