oont-contents/plugins/wp-optimize/js/delay-js-4-1-1.min.js
2025-04-06 08:34:48 +02:00

1 line
No EOL
1.2 KiB
JavaScript

!function(){function t(t){return o(t),r(t)}function n(e,o,r,c){e<o.length?t(o[e]).then(function(){n(e+1,o,r,c)})["catch"](function(){n(e+1,o,r,c)}):(i(),r())}function e(t){return new Promise(function(e,o){n(0,t,e,o)})}function o(t){const n=t.getAttribute("data-type"),e=t.hasAttribute("data-no-delay-js");if(n&&!e){t.type=n,t.removeAttribute("data-type");const o=t.cloneNode(!0);t.parentNode.replaceChild(o,t)}}function r(t){return new Promise(function(n,e){const o=t.hasAttribute("data-no-delay-js"),r=t.getAttribute("data-src");return!r||o?n():(t.src=r,t.removeAttribute("data-src"),t.onload=n,void(t.onerror=e))})}function i(){window.wpo_delayed_scripts_loaded=!0;var t=new Event("DOMContentLoaded");document.dispatchEvent(t),t=new Event("load"),window.dispatchEvent(t)}function c(){return["scroll","mousemove","mouseover","resize","touchstart","touchmove"]}function d(){c().forEach(function(t){window.addEventListener(t,a)})}function u(){c().forEach(function(t){window.removeEventListener(t,a)})}function a(){if(!s){s=!0,u();const t=document.querySelectorAll("script");e(t)}}var s=!1;document.addEventListener("DOMContentLoaded",function(){window.wpo_delayed_scripts_loaded||d()})}();