1(function() { 2 function initLazyload() { 3 const lazyElements = document.querySelectorAll(".lws-optimize-lazyload"); 4 5 if ("IntersectionObserver" in window) { 6 let observer = new IntersectionObserver((entries, observer) => { 7 entries.forEach(entry => { 8 if (entry.isIntersecting) { 9 let el = entry.target; 10 if (el.dataset.src) { 11 el.src = el.dataset.src; 12 el.removeAttribute("data-src"); 13 } else if (el.dataset.datasrc) { 14 el.src = el.dataset.datasrc; 15 el.removeAttribute("data-datasrc"); 16 } 17 18 if (el.tagName === "VIDEO") { 19 const sources = el.querySelectorAll("source[data-src]"); 20 sources.forEach(source => { 21 if (source.dataset.src) { 22 source.src = source.dataset.src; 23 source.removeAttribute("data-src"); 24 } else if (source.dataset.datasrc) { 25 source.src = source.dataset.datasrc; 26 source.removeAttribute("data-datasrc"); 27 } 28 }); 29 el.load(); 30 } 31 el.classList.remove("lws-optimize-lazyload"); 32 observer.unobserve(el); 33 } 34 }); 35 }); 36 37 lazyElements.forEach(el => { 38 observer.observe(el); 39 }); 40 41 } else { 42 // Fallback for browsers that don't support IntersectionObserver 43 lazyElements.forEach(el => { 44 if (el.dataset.src) { 45 el.src = el.dataset.src; 46 el.removeAttribute("data-src"); 47 } else if (el.dataset.datasrc) { 48 el.src = el.dataset.datasrc; 49 el.removeAttribute("data-datasrc"); 50 } 51 }); 52 } 53 } 54 55 // Run immediately if DOM is already loaded 56 if (document.readyState === "loading") { 57 document.addEventListener("DOMContentLoaded", initLazyload); 58 } else { 59 initLazyload(); 60 } 61})();
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.