PageSourceSearch

https://www.bigibyte.com/assets/motion.js

js bigibyte.com collected 2026-10-02 01:24:17 UTC 2,557 bytes, 69 lines download raw bytes

1// Site-wide motion: Lenis smooth scrolling + reveal-on-scroll.
2// Skipped entirely for visitors who prefer reduced motion.
3(function () {
4  if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return;
5  var root = document.documentElement;
6
7  // Smooth, inertial wheel scrolling (touch scrolling stays native).
8  if (window.Lenis) {
9    var lenis = new window.Lenis({ lerp: 0.09, smoothWheel: true, wheelMultiplier: 0.95 });
10    window.__lenis = lenis;
11    var raf = function (t) { lenis.raf(t); requestAnimationFrame(raf); };
12    requestAnimationFrame(raf);
13  }
14
15  // Reveal-on-scroll. Grid/list items animate individually with a short stagger;
16  // other blocks animate as one. Elements already on screen are shown at once.
17  var ITEMS = [
18    '#dc-root section [style*="grid-template-columns"] > *',
19    '#dc-root section article',
20    'main .grid > *',
21    'main .bl-grid > *',
22    'main .post-related-grid > *',
23    'main .legal > *'
24  ].join(',');
25  var BLOCKS = [
26    '#dc-root section > div > *',
27    '#dc-root footer > div',
28    'main section > *',
29    'main .container > *',
30    'main .legal-wrap > *',
31    'main .rv-block'
32  ].join(',');
33
34  root.classList.add('rv-on');
35  var io = new IntersectionObserver(function (entries) {
36    entries.forEach(function (e) {
37      if (!e.isIntersecting) return;
38      e.target.classList.add('rv-in');
39      io.unobserve(e.target);
40    });
41  }, { rootMargin: '0px 0px -6% 0px', threshold: 0.06 });
42
43  function mark(el, delay) {
44    if (el.classList.contains('rv') || el.closest('.rv') || el.closest('#dc-prerender,header,[data-no-reveal]')) return;
45    if (el.querySelector('.rv')) return;
46    var r = el.getBoundingClientRect();
47    if (!r.width && !r.height) return;
48    el.classList.add('rv');
49    if (r.top < window.innerHeight * 0.92) { el.classList.add('rv-in'); return; }
50    if (delay) el.style.transitionDelay = delay + 'ms';
51    io.observe(el);
52  }
53
54  function scan() {
55    document.querySelectorAll(ITEMS).forEach(function (el) {
56      var i = Array.prototype.indexOf.call(el.parentNode.children, el);
57      mark(el, Math.min(i, 5) * 70);
58    });
59    document.querySelectorAll(BLOCKS).forEach(function (el) { mark(el, 0); });
60  }
61
62  var pending = 0;
63  function schedule() {
64    if (pending) return;
65    pending = requestAnimationFrame(function () { pending = 0; scan(); });
66  }
67  if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', scan); else scan();
68  new MutationObserver(schedule).observe(document.body, { childList: true, subtree: true });
69})();

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.