Skip to content

armgit / moli

Public Imported from GitHub
0

Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust

1.7 KB
Raw Blame
<!doctype html>
<html>
<body>
  <script>
    const target = document.createElement("div");
    document.body.appendChild(target);

    const capture = [];
    const observer = new IntersectionObserver((entries) => {
      const entry = entries[0];
      capture.push(`${entry.isIntersecting}:${entry.intersectionRatio}`);
    }, { threshold: [0, 1] });

    observer.observe(target);

    setTimeout(() => {
      target.remove();
      setTimeout(() => {
        document.body.appendChild(target);
        setTimeout(() => {
          window.intersectionThresholdCapture = capture.join("|");
          window.intersectionThresholdCount = capture.length;
          observer.disconnect();
        }, 0);
      }, 0);
    }, 0);

    const burstRoot = document.createElement("div");
    burstRoot.setAttribute("style", "width: 100px; height: 100px; overflow: hidden");
    const burstTarget = document.createElement("div");
    burstTarget.setAttribute("style", "width: 100px; height: 100px");
    burstRoot.appendChild(burstTarget);
    document.body.appendChild(burstRoot);

    const burstObserver = new IntersectionObserver(() => {}, {
      root: burstRoot,
      threshold: [0.5],
    });
    burstObserver.observe(burstTarget);

    setTimeout(() => {
      burstTarget.remove();
      burstRoot.appendChild(burstTarget);

      const burstRecords = burstObserver.takeRecords();
      window.intersectionThresholdBurstCount = burstRecords.length;
      window.intersectionThresholdBurstCapture = Array.from(burstRecords)
        .map(entry => `${entry.isIntersecting}:${entry.intersectionRatio > 0}`)
        .join("|");
      burstObserver.disconnect();
    }, 0);
  </script>
</body>
</html>