1/** 2 * DOMContentLoaded Event Deferral Helper 3 * 4 * Intercepts DOMContentLoaded event listeners and automatically wraps their 5 * callbacks with requestAnimationFrame to prevent forced synchronous layouts 6 * (reflows) that negatively impact page performance metrics. 7 * 8 * This approach maintains full backward compatibility while deferring layout- 9 * triggering operations (offsetHeight, getComputedStyle, etc.) until the next 10 * animation frame, allowing the browser to optimize rendering. 11 * 12 * @see https://web.dev/avoid-large-complex-layouts-and-layout-thrashing/ 13 */ 14(function() { 15 'use strict'; 16 17 var originalAddEventListener = document.addEventListener; 18 var isDOMReady = document.readyState === 'complete' || document.readyState === 'interactive'; 19 20 /** 21 * Intercept document.addEventListener to defer DOMContentLoaded callbacks 22 * 23 * @param {string} event - Event name 24 * @param {Function} callback - Event callback 25 * @param {Object|boolean} options - Event listener options 26 */ 27 document.addEventListener = function(event, callback, options) { 28 if (event === 'DOMContentLoaded' && typeof callback === 'function') { 29 var deferredCallback = function(e) { 30 requestAnimationFrame(function() { 31 callback.call(this, e); 32 }.bind(this)); 33 }; 34 35 if (isDOMReady) { 36 // DOM already loaded, execute immediately but deferred 37 requestAnimationFrame(function() { 38 callback.call(document, new Event('DOMContentLoaded')); 39 }); 40 } else { 41 originalAddEventListener.call(document, event, deferredCallback, options); 42 } 43 } else { 44 originalAddEventListener.call(document, event, callback, options); 45 } 46 }; 47 48 // Track when DOM becomes ready 49 if (!isDOMReady) { 50 originalAddEventListener.call(document, 'DOMContentLoaded', function() { 51 isDOMReady = true; 52 }); 53 } 54})(); 55!function(t,e){"function"==typeof define&&define.amd?define([],e):"object"==typeof module&&module.exports?module.exports=e():t.OptimizeLazyLoader=e()}("undefined"!=typeof self?self:this,function(){"use strict";var t=function(e){if(!(this instanceof t))throw"OptimizeLazyLoader: OptimizeLazyLoader is a constructor.";this._init.apply(this,arguments)};return t.prototype={constructor:t,_defaultOptions:{context:document,useNative:!0,prefix:"oll",tags:"img,picture,video,audio,iframe",attrs:"src,srcset",threshold:256},_init:function(t){for(var e in this._options={},this._defaultOptions)this._options[e]=t&&e in t?t[e]:this._defaultOptions[e];this._mutationObserver=null,this._intersectionObserver=null},destroy:function(){this.stop(),delete this._intersectionObserver,delete this._mutationObserver,delete this._options},get supported(){return"IntersectionObserver"in window},get status(){return!!this._intersectionObserver},getOption:function(t){var e=this._options[t];return"function"==typeof e&&(e=e.apply(this)),e},start:function(){if(!this.status){if(!this.supported)return this.preloadAll();var t,e,i=this._getContext();"function"==typeof IntersectionObserver&&(t=this._handleIntersectionObserver.bind(this),e={root:null,rootMargin:(1*this.getOption("threshold")||0)+"px",threshold:1e-6},this._intersectionObserver=new IntersectionObserver(t,e),this._prepare(i)),"function"==typeof MutationObserver&&(t=this._handleMutationObserver.bind(this),e={attributes:!1,childList:!0,subtree:!0},this._mutationObserver=new MutationObserver(t),this._mutationObserver.observe(i,e))}},stop:function(){this.status&&(this._unprepare(this._getContext()),this._intersectionObserver&&this._intersectionObserver.disconnect(),this._mutationObserver&&this._mutationObserver.disconnect(),this._intersectionObserver=null,this._mutationObserver=null)},preload:function(t){var e=this.getOption("prefix");this._matches(t,"."+e+",."+e+"-css")&&(this._matches(t,"."+e)&&(this._getElementsWithSrcAttrs(t).forEach(function(t){this.getOption("attrs").split(",").forEach(function(i){var s=this._stringTrim(i),r="data-"+e+"-"+s,n=t.getAttribute(r);null!==n&&(t.removeAttribute(r),t.setAttribute(s,n))}.bind(this))}.bind(this)),"function"==typeof t.load&&t.load()),this._matches(t,"."+e+"-css")&&this._removeClass(t,e+"-css"),this._unprepare(t))}
55,preloadAll:function(){this.stop(),this._getElements().forEach(function(t){this.preload(t)}.bind(this))},_getContext:function(t){return t||this.getOption("context")||document},_stringTrim:function(t){return t.replace(/(^\s+|\s+$)/g,"")},_toArray:function(t){return Array.prototype.slice.call(t)},_matches:function(t,e){return(t.matches||t.matchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector||t.webkitMatchesSelector).call(t,e)},_removeClass:function(t,e){var i=(t.getAttribute("class")||"").replace(/\s+/g," ").replace(/(^\s|\s$)/g,"").split(" "),s=i.indexOf(e);-1!==s&&(i.splice(s,1),t.setAttribute("class",i.join(" ")))},_getElements:function(t){var e=[];if(!((t=this._getContext(t))instanceof Node&&"querySelectorAll"in t))return e;var i=this.getOption("tags"),s=this.getOption("prefix"),r=(i.split(",").join(".{prefix},")+".{prefix},.{prefix}-css").replace(/{prefix}/g,s);return e=t.querySelectorAll(r),e=this._toArray(e),t.nodeType===Node.ELEMENT_NODE&&this._matches(t,r)&&e.unshift(t),e},_getElementsWithSrcAttrs:function(t){var e=[];if(!((t=this._getContext(t))instanceof Node&&"querySelectorAll"in t))return e;var i=this.getOption("prefix"),s=this.getOption("attrs"),r="["+s.split(",").map(function(t){return"data-"+i+"-"+this._stringTrim(t)}.bind(this)).join("],[")+"]";return e=t.querySelectorAll(r),e=this._toArray(e),this._matches(t,"img")&&this._matches(t.parentElement,"picture")&&-1!==s.split(/\s*,\s*/).indexOf("srcset")&&(e=e.concat(this._toArray(t.parentElement.querySelectorAll("source[data-"+i+"-srcset]")))),this._matches(t,r)&&e.unshift(t),e},_prepare:function(t){var e=this.getOption("prefix"),i=this.getOption("useNative");this._getElements(t).forEach(function(t){var s=this._matches(t,"."+e),r=this._matches(t,"."+e+"-css"),n=!1;s&&(i&&"loading"in t?(t.setAttribute("loading","lazy"),this.preload(t)):n=!0),r&&(n=!0),n&&this._intersectionObserver.observe(t)}.bind(this))},_unprepare:function(t){this._getElements(t).forEach(function(t){this._intersectionObserver&&this._intersectionObserver.unobserve(t),this._removeClass(t,this.getOption("prefix"))}.bind(this))},_handleMutationObserver:function(t){this.status&&t.forEach(function(t){"childList"===t.type&&(t.addedNodes.forEach(function(t){this._prepare(t)}.bind(this)),t.removedNodes.forEach(function(t){this._unprepare(t)}.bind(this)))}.bind(this))},_handleIntersectionObserver:function(t){t.forEach(function(t){(t.intersectionRatio>0||t.isIntersecting)&&this.preload(t.target)}.bind(this))}},t});window.addEventListener("DOMContentLoaded",function(t){var e={useNative:OP3.Settings&&OP3.Settings.lazyLoadAssets&&"native+js"===OP3.Settings.lazyLoadAssets};new OptimizeLazyLoader(e).start()});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.