PageSourceSearch

https://www.nzherald.co.nz/pf/resources/scripts/utils/appear.js?d=1068

js nzherald.co.nz collected 2026-09-24 07:39:48 UTC 4,089 bytes, 142 lines download raw bytes

1appear = (function () {
2  "use strict";
3  var t = null,
4    n = 0,
5    h = {};
6  return (
7    addEventListener(
8      "scroll",
9      function () {
10        var e = window.scrollY || window.pageYOffset;
11        null != t &&
12          ((h.velocity = e - t), (h.delta = 0 <= h.velocity ? h.velocity : -1 * h.velocity)),
13          (t = e),
14          n && clearTimeout(n),
15          (n = setTimeout(function () {
16            t = null;
17          }, 30));
18      },
19      !1
20    ),
21    function (e) {
22      return (
23        (p = !1),
24        (l = []),
25        (s = []),
26        (f = m = 0),
27        (v = {}),
28        (function (e) {
29          (v = {
30            init: (e = e || {}).init,
31            elements: e.elements,
32            appear: e.appear,
33            disappear: e.disappear,
34            done: e.done,
35            reappear: e.reappear,
36            bounds: e.bounds || 0,
37            debounce: e.debounce || 50,
38            delta: {
39              speed: e.deltaSpeed || 50,
40              timeout: e.deltaTimeout || 500
41            }
42          }),
43            addEventListener("DOMContentLoaded", a, !1);
44          var t = !1;
45          Function("/*@cc_on return document.documentMode===10@*/")() && (t = !0);
46          var n = "complete" === document.readyState || "loaded" === document.readyState;
47          return (
48            t ? n && a() : (!n && "interactive" !== document.readyState) || a(),
49            {
50              trigger: function () {
51                r();
52              },
53              pause: function () {
54                o();
55              },
56              resume: function () {
57                i();
58              },
59              destroy: function () {
60                (l = []), u && clearTimeout(u), o();
61              }
62            }
63          );
64        })(e)
65      );
66
67      function t() {
68        h.delta < v.delta.speed &&
69          (d ||
70            ((d = !0),
71            r(),
72            setTimeout(function () {
73              d = !1;
74            }, v.delta.timeout))),
75          (function (n, i) {
76            return function () {
77              var e = this,
78                t = arguments;
79              clearTimeout(u),
80                (u = setTimeout(function () {
81                  n.apply(e, t);
82                }, i));
83            };
84          })(function () {
85            r();
86          }, v.debounce)();
87      }
88
89      function i() {
90        r(), addEventListener("scroll", t, !1), addEventListener("resize", t, !1);
91      }
92
93      function o() {
94        removeEventListener("scroll", t, !1), removeEventListener("resize", t, !1);
95      }
96
97      function r() {
98        c ||
99          (l.forEach(function (e, t) {
100            e &&
101            (function (e, t) {
102              var n = e.getBoundingClientRect();
103              if (n.width === 0 && n.height === 0) return false;
104              return (
105                0 <= n.top + n.height &&
106                0 <= n.left + n.width &&
107                n.bottom - n.height <=
108                  (window.innerHeight || document.documentElement.clientHeight) + t &&
109                n.right - n.width <= (window.innerWidth || document.documentElement.clientWidth) + t
110              );
111            })(e, v.bounds)
112              ? s[t] &&
113                ((s[t] = !1),
114                m++,
115                v.appear && v.appear(e),
116                v.disappear || v.reappear || (l[t] = null))
117              : (!1 === s[t] && (v.disappear && v.disappear(e), f++, v.reappear || (l[t] = null)),
118                (s[t] = !0));
119          }),
120          v.reappear ||
121            (v.appear && (!v.appear || m !== n)) ||
122            (v.disappear && (!v.disappear || f !== n)) ||
123            ((c = !0), o(), v.done && v.done()));
124      }
125
126      function a() {
127        var e;
128        if (
129          !p &&
130          ((p = !0),
131          v.init && v.init(),
132          (e = "function" == typeof v.elements ? v.elements() : v.elements))
133        ) {
134          n = e.length;
135          for (var t = 0; t < n; t += 1) l.push(e[t]), s.push(!0);
136          i();
137        }
138      }
139      var n, u, d, c, p, l, s, m, f, v;
140    }
141  );
142})();

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.