1export default function GDMLazyLoading() { 2 const images = document.querySelectorAll("img"); 3 4 // Images to not lazyload: 5 const swiperImages = document.querySelectorAll(".swiper-slide img"); 6 const whitepaperCovers = document.querySelectorAll( 7 ".gdm-company-profile-unit__image-container img" 8 ); 9 const SponsoredWhitepaperCovers = document.querySelectorAll( 10 ".sponsored-whitepaper img" 11 ); 12 const paywallFigureImages = document.querySelectorAll( 13 ".access-premium figure img" 14 ); 15 const lazyImages = [...images].filter( 16 (img) => 17 ![ 18 ...swiperImages, 19 ...whitepaperCovers, 20 ...SponsoredWhitepaperCovers, 21 ...paywallFigureImages, 22 ].includes(img) && 23 !img.src.includes("ipad-frame.png") && !img.src.includes("datacenter_ipad.png") 24 ); 25 lazyImages && 26 [...lazyImages].forEach((img) => { 27 const lazySrc = img.getAttribute("data-src") || img.getAttribute("src"); 28 29 if (lazySrc) { 30 img.dataset.src = lazySrc; 31 } 32 33 img.src = 34 "/w
34p-content/themes/goodlife-wp-B2B/assets/img/placeholder_purple.gif"; 35 img.classList.add("lazy-image"); 36 }); 37 38 const displayLazyContent = (entries, observer) => { 39 // const [entry] = entries; 40 41 entries.forEach((entry) => { 42 if (!entry.isIntersecting) return; 43 44 entry.target.src = entry.target.dataset.src; 45 entry.target.classList.remove("lazy-image"); 46 entry.target.classList.add("lazy-loaded"); 47 48 observer.unobserve(entry.target); 49 }); 50 }; 51 const lazyObserver = new IntersectionObserver(displayLazyContent, { 52 root: null, // observe the whole viewport 53 rootMargin: "0px", 54 threshold: 0, 55 }); 56 57 lazyImages && lazyImages.forEach((img) => lazyObserver.observe(img)); 58}
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.