PageSourceSearch

https://www.internationalaccountingbulletin.com/wp-content/themes/…/assets/js/modules/gdm-lazy-loading.js

js internationalaccountingbulletin.com collected 2026-09-24 22:21:35 UTC 1,711 bytes, 59 lines download raw bytes

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")
24  );
25
26  lazyImages &&
27    [...lazyImages].forEach((img) => {
28      const lazySrc = img.getAttribute("data-src") || img.getAttribute("src");
29
30      if (lazySrc) {
31        img.dataset.src = lazySrc;
32      }
33
34      img.src =
35        "/wp-content/themes/goodlife-wp-B2B/assets/img/placeholder_purple.gif";
36      img.classList.add("lazy-image");
37    });
38
39  const displayLazyContent = (entries, observer) => {
40    // const [entry] = entries;
41
42    entries.forEach((entry) => {
43      if (!entry.isIntersecting) return;
44
45      entry.target.src = entry.target.dataset.src;
46      entry.target.classList.remove("lazy-image");
47      entry.target.classList.add("lazy-loaded");
48
49      observer.unobserve(entry.target);
50    });
51  };
52  const lazyObserver = new IntersectionObserver(displayLazyContent, {
53    root: null, // observe the whole viewport
54    rootMargin: "0px",
55    threshold: 0,
56  });
57
58  lazyImages && lazyImages.forEach((img) => lazyObserver.observe(img));
59}

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.