PageSourceSearch

https://www.metasolutions.ai/js/ScrollSmooth.js

js metasolutions.ai collected 2026-10-05 14:37:30 UTC 15,965 bytes, 473 lines download raw bytes

1!(function () {
2    var s,
3        i,
4        c,
5        a,
6        o = {
7            frameRate: 300,
8            animationTime: 600,
9            stepSize: 100,
10            pulseAlgorithm: !0,
11            pulseScale: 4,
12            pulseNormalize: 1,
13            accelerationDelta: 50,
14            accelerationMax: 3,
15            keyboardSupport: !0,
16            arrowScroll: 50,
17            fixedBackground: !0,
18            excluded: "",
19        },
20        p = o,
21        u = !1,
22        d = !1,
23        n = {
24            x: 0,
25            y: 0,
26        },
27        f = !1,
28        m = document.documentElement,
29        l = [],
30        h = /^Mac/.test(navigator.platform),
31        w = {
32            left: 37,
33            up: 38,
34            right: 39,
35            down: 40,
36            spacebar: 32,
37            pageup: 33,
38            pagedown: 34,
39            end: 35,
40            home: 36,
41        },
42        v = {
43            37: 1,
44            38: 1,
45            39: 1,
46            40: 1,
47        };
48    function y() {
49        if (!f && document.body) {
50            f = !0;
51            var e = document.body,
52                t = document.documentElement,
53                o = window.innerHeight,
54                n = e.scrollHeight;
55            if (
56                ((m = 0 <= document.compatMode.indexOf("CSS") ? t : e),
57                (s = e),
58                p.keyboardSupport && Y("keydown", x),
59                top != self)
60            )
61                d = !0;
62            else if (
63                Q &&
64                o < n &&
65                (e.offsetHeight <= o || t.offsetHeight <= o)
66            ) {
67                var r,
68                    a = document.createElement("div");
69                (a.style.cssText =
70                    "position:absolute; z-index:-10000; top:0; left:0; right:0; height:" +
71                    m.scrollHeight +
72                    "px"),
73                    document.body.appendChild(a),
74                    (c = function () {
75                        r =
76                            r ||
77                            setTimeout(function () {
78                                u ||
79                                    ((a.style.height = "0"),
80                                    (a.style.height = m.scrollHeight + "px"),
81                                    (r = null));
82                            }, 500);
83                    }),
84                    setTimeout(c, 10),
85                    Y("resize", c);
86                if (
87                    ((i = new R(c)).observe(e, {
88                        attributes: !0,
89                        childList: !0,
90                        characterData: !1,
91                    }),
92                    m.offsetHeight <= o)
93                ) {
94                    var l = document.createElement("div");
95                    (l.style.clear = "both"), e.appendChild(l);
96                }
97            }
98            p.fixedBackground ||
99                u ||
100                ((e.style.backgroundAttachment = "scroll"),
101                (t.style.backgroundAttachment = "scroll"));
102        }
103    }
104    var b = [],
105        g = !1,
106        r = Date.now();
107    function S(d, f, m) {
108        if (
109            ((function (e, t) {
110                (e = 0 < e ? 1 : -1),
111                    (t = 0 < t ? 1 : -1),
112                    (n.x === e && n.y === t) ||
113                        ((n.x = e), (n.y = t), (b = []), (r = 0));
114            })(f, m),
115            1 != p.accelerationMax)
116        ) {
117            var e = Date.now() - r;
118            if (e < p.accelerationDelta) {
119                var t = (1 + 50 / e) / 2;
120                1 < t &&
121                    ((t = Math.min(t, p.accelerationMax)), (f *= t), (m *= t));
122            }
123            r = Date.now();
124        }
125        if (
126            (b.push({
127                x: f,
128                y: m,
129                lastX: f < 0 ? 0.99 : -0.99,
130                lastY: m < 0 ? 0.99 : -0.99,
131                start: Date.now(),
132            }),
133            !g)
134        ) {
135            var o = q(),
136                h = d === o || d === document.body;
137            null == d.$scrollBehavior &&
138                (function (e) {
139                    var t = M(e);
140                    if (null == B[t]) {
141                        var o = getComputedStyle(e, "")["scroll-behavior"];
142                        B[t] = "smooth" == o;
143                    }
144                    return B[t];
145                })(d) &&
146                ((d.$scrollBehavior = d.style.scrollBehavior),
147                (d.style.scrollBehavior = "auto"));
148            var w = function (e) {
149                for (
150                    var t = Date.now(), o = 0, n = 0, r = 0;
151                    r < b.length;
152                    r++
153                ) {
154                    var a = b[r],
155                        l = t - a.start,
156                        i = l >= p.animationTime,
157                        c = i ? 1 : l / p.animationTime;
158                    p.pulseAlgorithm && (c = F(c));
159                    var s = (a.x * c - a.lastX) >> 0,
160                        u = (a.y * c - a.lastY) >> 0;
161                    (o += s),
162                        (n += u),
163                        (a.lastX += s),
164                        (a.lastY += u),
165                        i && (b.splice(r, 1), r--);
166                }
167                h
168                    ? window.scrollBy(o, n)
169                    : (o && (d.scrollLeft += o), n && (d.scrollTop += n)),
170                    f || m || (b = []),
171                    b.length
172                        ? j(w, d, 1e3 / p.frameRate + 1)
173                        : ((g = !1),
174                          null != d.$scrollBehavior &&
175                              ((d.style.scrollBehavior = d.$scrollBehavior),
176                              (d.$scrollBehavior = null)));
177            };
178            j(w, d, 0), (g = !0);
179        }
180    }
181    function e(e) {
182        f || y();
183        var t = e.target;
184        if (e.defaultPrevented || e.ctrlKey) return !0;
185        if (
186            N(s, "embed") ||
187            (N(t, "embed") && /\.pdf/i.test(t.src)) ||
188            N(s, "object") ||
189            t.shadowRoot
190        )
191            return !0;
192        var o = -e.wheelDeltaX || e.deltaX || 0,
193            n = -e.wheelDeltaY || e.deltaY || 0;
194        h &&
195            (e.wheelDeltaX &&
196                K(e.wheelDeltaX, 120) &&
197                (o = (e.wheelDeltaX / Math.abs(e.wheelDeltaX)) * -120),
198            e.wheelDeltaY &&
199                K(e.wheelDeltaY, 120) &&
200                (n = (e.wheelDeltaY / Math.abs(e.wheelDeltaY)) * -120)),
201            o || n || (n = -e.wheelDelta || 0),
202            1 === e.deltaMode && ((o *= 40), (n *= 40));
203        var r = z(t);
204        return r
205            ? !!(function (e) {
206                  if (!e) return;
207                  l.length || (l = [e, e, e]);
208                  (e = Math.abs(e)),
209                      l.push(e),
210                      l.shift(),
211                      clearTimeout(a),
212                      (a = setTimeout(function () {
213                          try {
214                              localStorage.SS_deltaBuffer = l.join(",");
215                          } catch (e) {}
216                      }, 1e3));
217                  var t = 120 < e && P(e),
218                      o = !P(120) && !P(100) && !t;
219                  return e < 50 || o;
220              })(n) ||
221                  (1.2 < Math.abs(o) && (o *= p.stepSize / 120),
222                  1.2 < Math.abs(n) && (n *= p.stepSize / 120),
223                  S(r, o, n),
224                  e.preventDefault(),
225                  void C())
226            : !d ||
227                  !W ||
228                  (Object.defineProperty(e, "target", {
229                      value: window.frameElement,
230                  }),
231                  parent.wheel(e));
232    }
233    function x(e) {
234        var t = e.target,
235            o =
236                e.ctrlKey ||
237                e.altKey ||
238                e.metaKey ||
239                (e.shiftKey && e.keyCode !== w.spacebar);
240        document.body.contains(s) || (s = document.activeElement);
241        var n = /^(button|submit|radio|checkbox|file|color|image)$/i;
242        if (
243            e.defaultPrevented ||
244            /^(textarea|select|embed|object)$/i.test(t.nodeName) ||
245            (N(t, "input") && !n.test(t.type)) ||
246            N(s, "video") ||
247            (function (e) {
248                var t = e.target,
249                    o = !1;
250                if (-1 != document.URL.indexOf("www.youtube.com/watch"))
251                    do {
252                        if (
253                            (o =
254                                t.classList &&
255                                t.classList.contains("html5-video-controls"))
256                        )
257                            break;
258                    } while ((t = t.parentNode));
259                return o;
260            })(e) ||
261            t.isContentEditable ||
262            o
263        )
264            return !0;
265        if (
266            (N(t, "button") || (N(t, "input") && n.test(t.type))) &&
267            e.keyCode === w.spacebar
268        )
269            return !0;
270        if (N(t, "input") && "radio" == t.type && v[e.keyCode]) return !0;
271        var r = 0,
272            a = 0,
273            l = z(s);
274        if (!l) return !d || !W || parent.keydown(e);
275        var i = l.clientHeight;
276        switch ((l == document.body && (i = window.innerHeight), e.keyCode)) {
277            case w.up:
278                a = -p.arrowScroll;
279                break;
280            case w.down:
281                a = p.arrowScroll;
282                break;
283            case w.spacebar:
284                a = -(e.shiftKey ? 1 : -1) * i * 0.9;
285                break;
286            case w.pageup:
287                a = 0.9 * -i;
288                break;
289            case w.pagedown:
290                a = 0.9 * i;
291                break;
292            case w.home:
293                l == document.body &&
294                    document.scrollingElement &&
295                    (l = document.scrollingElement),
296                    (a = -l.scrollTop);
297                break;
298            case w.end:
299                var c = l.scrollHeight - l.scrollTop - i;
300                a = 0 < c ? 10 + c : 0;
301                break;
302            case w.left:
303                r = -p.arrowScroll;
304                break;
305            case w.right:
306                r = p.arrowScroll;
307                break;
308            default:
309                return !0;
310        }
311        S(l, r, a), e.preventDefault(), C();
312    }
313    function t(e) {
314        s = e.target;
315    }
316    var k,
317        D,
318        M =
319            ((k = 0),
320            function (e) {
321                return e.uniqueID || (e.uniqueID = k++);
322            }),
323        E = {},
324        T = {},
325        B = {};
326    function C() {
327        clearTimeout(D),
328            (D = setInterval(function () {
329                E = T = B = {};
330            }, 1e3));
331    }
332    function H(e, t, o) {
333        for (var n = o ? E : T, r = e.length; r--; ) n[M(e[r])] = t;
334        return t;
335    }
336    function z(e) {
337        var t = [],
338            o = document.body,
339            n = m.scrollHeight;
340        do {
341            var r = (!1 ? E : T)[M(e)];
342            if (r) return H(t, r);
343            if ((t.push(e), n === e.scrollHeight)) {
344                var a = (O(m) && O(o)) || X(m);
345                if ((d && L(m)) || (!d && a)) return H(t, q());
346            } else if (L(e) && X(e)) return H(t, e);
347        } while ((e = e.parentElement));
348    }
349    function L(e) {
350        return e.clientHeight + 10 < e.scrollHeight;
351    }
352    function O(e) {
353        return (
354            "hidden" !== getComputedStyle(e, "").getPropertyValue("overflow-y")
355        );
356    }
357    function X(e) {
358        var t = getComputedStyle(e, "").getPropertyValue("overflow-y");
359        return "scroll" === t || "auto" === t;
360    }
361    function Y(e, t, o) {
362        window.addEventListener(e, t, o || !1);
363    }
364    function A(e, t, o) {
365        window.removeEventListener(e, t, o || !1);
366    }
367    function N(e, t) {
368        return e && (e.nodeName || "").toLowerCase() === t.toLowerCase();
369    }
370    if (window.localStorage && localStorage.SS_deltaBuffer)
371        try {
372            l = localStorage.SS_deltaBuffer.split(",");
373        } catch (e) {}
374    function K(e, t) {
375        return Math.floor(e / t) == e / t;
376    }
377    function P(e) {
378        return K(l[0], e) && K(l[1], e) && K(l[2], e);
379    }
380    var $,
381        j =
382            window.requestAnimationFrame ||
383            window.webkitRequestAnimationFrame ||
384            window.mozRequestAnimationFrame ||
385            function (e, t, o) {
386                window.setTimeout(e, o || 1e3 / 60);
387            },
388        R =
389            window.MutationObserver ||
390            window.WebKitMutationObserver ||
391            window.MozMutationObserver,
392        q =
393            (($ = document.scrollingElement),
394            function () {
395                if (!$) {
396                    var e = document.createElement("div");
397                    (e.style.cssText = "height:10000px;width:1px;"),
398                        document.body.appendChild(e);
399                    var t = document.body.scrollTop;
400                    document.documentElement.scrollTop,
401                        window.scrollBy(0, 3),
402                        ($ =
403                            document.body.scrollTop != t
404                                ? document.body
405                                : document.documentElement),
406                        window.scrollBy(0, -3),
407                        document.body.removeChild(e);
408                }
409                return $;
410            });
411    function V(e) {
412        var t;
413        return (
414            ((e *= p.pulseScale) < 1
415                ? e - (1 - Math.exp(-e))
416                : ((e -= 1),
417                  (t = Math.exp(-1)) + (1 - Math.exp(-e)) * (1 - t))) *
418            p.pulseNormalize
419        );
420    }
421    function F(e) {
422        return 1 <= e
423            ? 1
424            : e <= 0
425            ? 0
426            : (1 == p.pulseNormalize && (p.pulseNormalize /= V(1)), V(e));
427    }
428    var I = window.navigator.userAgent,
429        _ = /Edge/.test(I),
430        W = /chrome/i.test(I) && !_,
431        U = /safari/i.test(I) && !_,
432        G = /mobile/i.test(I),
433        J = /Windows NT 6.1/i.test(I) && /rv:11/i.test(I),
434        Q = U && (/Version\/8/i.test(I) || /Version\/9/i.test(I)),
435        Z = (W || U || J) && !G,
436        ee = !1;
437    try {
438        window.addEventListener(
439            "test",
440            null,
441            Object.defineProperty({}, "passive", {
442                get: function () {
443                    ee = !0;
444                },
445            })
446        );
447    } catch (e) {}
448    var te = !!ee && {
449            passive: !1,
450        },
451        oe =
452            "onwheel" in document.createElement("div") ? "wheel" : "mousewheel";
453    function ne(e) {
454        for (var t in e) o.hasOwnProperty(t) && (p[t] = e[t]);
455    }
456    oe && Z && (Y(oe, e, te), Y("mousedown", t), Y("load", y)),
457        (ne.destroy = function () {
458            i && i.disconnect(),
459                A(oe, e),
460                A("mousedown", t),
461                A("keydown", x),
462                A("resize", c),
463                A("load", y);
464        }),
465        window.SmoothScrollOptions && ne(window.SmoothScrollOptions),
466        "function" == typeof define && define.amd
467            ? define(function () {
468                  return ne;
469              })
470            : "object" == typeof exports
471            ? (module.exports = ne)
472            : (window.SmoothScroll = ne);
473})();

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.