PageSourceSearch

https://zenlytic.com/assets/scripts/lazy-embed.js

js zenlytic.com collected 2026-09-24 10:23:50 UTC 1,223 bytes, 32 lines download raw bytes

1// Lazy-mount iframes (e.g. the homepage product demo) only when they're about
2// to scroll into view. The real URL lives in data-src, so the heavy YouTube
3// player + video chunks (~2.8 MB) never load during initial page load —
4// autoplay still kicks in the moment the embed nears the viewport.
5(function () {
6  const embeds = document.querySelectorAll('iframe[data-src]');
7  if (!embeds.length) return;
8
9  function mount(iframe) {
10    if (iframe.src) return;
11    iframe.src = iframe.dataset.src;
12  }
13
14  // No IntersectionObserver (very old browsers): just mount everything.
15  if (!('IntersectionObserver' in window)) {
16    embeds.forEach(mount);
17    return;
18  }
19
20  const io = new IntersectionObserver((entries, obs) => {
21    for (const e of entries) {
22      if (!e.isIntersecting) continue;
23      mount(e.target);
24      obs.unobserve(e.target);
25    }
26  }, { rootMargin: '100px 0px' }); // small preload buffer; the demo sits just
27                                   // below the fold, so this keeps it out of the
28                                   // initial load while still mounting before
29                                   // it's fully in view as the user scrolls.
30
31  embeds.forEach((el) => io.observe(el));
32})();

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.