PageSourceSearch

https://www.yritystieto.net/static/pages/js/hero_landscapes.js?v=20260916

js yritystieto.net collected 2026-10-07 19:59:53 UTC 1,397 bytes, 48 lines download raw bytes

1(() => {
2  const slides = [...document.querySelectorAll('.hero-landscape')];
3  if (slides.length < 2) return;
4
5  const motion = window.matchMedia('(prefers-reduced-motion: reduce)');
6  const interval = 20000;
7  let current = 0;
8  let timer;
9  let generation = 0;
10
11  async function prepare(slide) {
12    if (slide.dataset.src) {
13      slide.src = slide.dataset.src;
14      delete slide.dataset.src;
15    }
16    try {
17      await slide.decode();
18      return slide.naturalWidth > 0;
19    } catch {
20      return false;
21    }
22  }
23
24  function schedule() {
25    clearTimeout(timer);
26    const token = ++generation;
27    if (motion.matches || document.hidden) return;
28
29    const next = (current + 1) % slides.length;
30    const ready = prepare(slides[next]);
31    timer = setTimeout(async () => {
32      const loaded = await ready;
33      if (token !== generation || motion.matches || document.hidden) return;
34      if (loaded) {
35        slides[next].classList.add('is-active');
36        slides[current].classList.remove('is-active');
37        current = next;
38      }
39      schedule();
40    }, interval);
41  }
42
43  document.addEventListener('visibilitychange', schedule);
44  motion.addEventListener('change', schedule);
45  // Keep the initial image's network request ahead of the next background.
46  if (document.readyState === 'complete') schedule();
47  else window.addEventListener('load', schedule, { once: true });
48})();

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.