PageSourceSearch

https://digitalopsdev.com/js/jquery.waypoints.min.js

js digitalopsdev.com collected 2026-10-02 01:27:29 UTC 13,720 bytes, 421 lines download raw bytes

1
2!(function () {
3  "use strict";
4  function t(o) {
5    if (!o) throw new Error("No options passed to Waypoint constructor");
6    if (!o.element)
7      throw new Error("No element option passed to Waypoint constructor");
8    if (!o.handler)
9      throw new Error("No handler option passed to Waypoint constructor");
10    (this.key = "waypoint-" + e),
11      (this.options = t.Adapter.extend({}, t.defaults, o)),
12      (this.element = this.options.element),
13      (this.adapter = new t.Adapter(this.element)),
14      (this.callback = o.handler),
15      (this.axis = this.options.horizontal ? "horizontal" : "vertical"),
16      (this.enabled = this.options.enabled),
17      (this.triggerPoint = null),
18      (this.group = t.Group.findOrCreate({
19        name: this.options.group,
20        axis: this.axis,
21      })),
22      (this.context = t.Context.findOrCreateByElement(this.options.context)),
23      t.offsetAliases[this.options.offset] &&
24        (this.options.offset = t.offsetAliases[this.options.offset]),
25      this.group.add(this),
26      this.context.add(this),
27      (i[this.key] = this),
28      (e += 1);
29  }
30  var e = 0,
31    i = {};
32  (t.prototype.queueTrigger = function (t) {
33    this.group.queueTrigger(this, t);
34  }),
35    (t.prototype.trigger = function (t) {
36      this.enabled && this.callback && this.callback.apply(this, t);
37    }),
38    (t.prototype.destroy = function () {
39      this.context.remove(this), this.group.remove(this), delete i[this.key];
40    }),
41    (t.prototype.disable = function () {
42      return (this.enabled = !1), this;
43    }),
44    (t.prototype.enable = function () {
45      return this.context.refresh(), (this.enabled = !0), this;
46    }),
47    (t.prototype.next = function () {
48      return this.group.next(this);
49    }),
50    (t.prototype.previous = function () {
51      return this.group.previous(this);
52    }),
53    (t.invokeAll = function (t) {
54      var e = [];
55      for (var o in i) e.push(i[o]);
56      for (var n = 0, r = e.length; r > n; n++) e[n][t]();
57    }),
58    (t.destroyAll = function () {
59      t.invokeAll("destroy");
60    }),
61    (t.disableAll = function () {
62      t.invokeAll("disable");
63    }),
64    (t.enableAll = function () {
65      t.Context.refreshAll();
66      for (var e in i) i[e].enabled = !0;
67      return this;
68    }),
69    (t.refreshAll = function () {
70      t.Context.refreshAll();
71    }),
72    (t.viewportHeight = function () {
73      return window.innerHeight || document.documentElement.clientHeight;
74    }),
75    (t.viewportWidth = function () {
76      return document.documentElement.clientWidth;
77    }),
78    (t.adapters = []),
79    (t.defaults = {
80      context: window,
81      continuous: !0,
82      enabled: !0,
83      group: "default",
84      horizontal: !1,
85      offset: 0,
86    }),
87    (t.offsetAliases = {
88      "bottom-in-view": function () {
89        return this.context.innerHeight() - this.adapter.outerHeight();
90      },
91      "right-in-view": function () {
92        return this.context.innerWidth() - this.adapter.outerWidth();
93      },
94    }),
95    (window.Waypoint = t);
96})(),
97  (function () {
98    "use strict";
99    function t(t) {
100      window.setTimeout(t, 1e3 / 60);
101    }
102    function e(t) {
103      (this.element = t),
104        (this.Adapter = n.Adapter),
105        (this.adapter = new this.Adapter(t)),
106        (this.key = "waypoint-context-" + i),
107        (this.didScroll = !1),
108        (this.didResize = !1),
109        (this.oldScroll = {
110          x: this.adapter.scrollLeft(),
111          y: this.adapter.scrollTop(),
112        }),
113        (this.waypoints = { vertical: {}, horizontal: {} }),
114        (t.waypointContextKey = this.key),
115        (o[t.waypointContextKey] = this),
116        (i += 1),
117        n.windowContext ||
118          ((n.windowContext = !0), (n.windowContext = new e(window))),
119        this.createThrottledScrollHandler(),
120        this.createThrottledResizeHandler();
121    }
122    var i = 0,
123      o = {},
124      n = window.Waypoint,
125      r = window.onload;
126    (e.prototype.add = function (t) {
127      var e = t.options.horizontal ? "horizontal" : "vertical";
128      (this.waypoints[e][t.key] = t), this.refresh();
129    }),
130      (e.prototype.checkEmpty = function () {
131        var t = this.Adapter.isEmptyObject(this.waypoints.horizontal),
132          e = this.Adapter.isEmptyObject(this.waypoints.vertical),
133          i = this.element == this.element.window;
134        t && e && !i && (this.adapter.off(".waypoints"), delete o[this.key]);
135      }),
136      (e.prototype.createThrottledResizeHandler = function () {
137        function t() {
138          e.handleResize(), (e.didResize = !1);
139        }
140        var e = this;
141        this.adapter.on("resize.waypoints", function () {
142          e.didResize || ((e.didResize = !0), n.requestAnimationFrame(t));
143        });
144      }),
145      (e.prototype.createThrottledScrollHandler = function () {
146        function t() {
147          e.handleScroll(), (e.didScroll = !1);
148        }
149        var e = this;
150        this.adapter.on("scroll.waypoints", function () {
151          (!e.didScroll || n.isTouch) &&
152            ((e.didScroll = !0), n.requestAnimationFrame(t));
153        });
154      }),
155      (e.prototype.handleResize = function () {
156        n.Context.refreshAll();
157      }),
158      (e.prototype.handleScroll = function () {
159        var t = {},
160          e = {
161            horizontal: {
162              newScroll: this.adapter.scrollLeft(),
163              oldScroll: this.oldScroll.x,
164              forward: "right",
165              backward: "left",
166            },
167            vertical: {
168              newScroll: this.adapter.scrollTop(),
169              oldScroll: this.oldScroll.y,
170              forward: "down",
171              backward: "up",
172            },
173          };
174        for (var i in e) {
175          var o = e[i],
176            n = o.newScroll > o.oldScroll,
177            r = n ? o.forward : o.backward;
178          for (var s in this.waypoints[i]) {
179            var a = this.waypoints[i][s];
180            if (null !== a.triggerPoint) {
181              var l = o.oldScroll < a.triggerPoint,
182                h = o.newScroll >= a.triggerPoint,
183                p = l && h,
184                u = !l && !h;
185              (p || u) && (a.queueTrigger(r), (t[a.group.id] = a.group));
186            }
187          }
188        }
189        for (var c in t) t[c].flushTriggers();
190        this.oldScroll = { x: e.horizontal.newScroll, y: e.vertical.newScroll };
191      }),
192      (e.prototype.innerHeight = function () {
193        return this.element == this.element.window
194          ? n.viewportHeight()
195          : this.adapter.innerHeight();
196      }),
197      (e.prototype.remove = function (t) {
198        delete this.waypoints[t.axis][t.key], this.checkEmpty();
199      }),
200      (e.prototype.innerWidth = function () {
201        return this.element == this.element.window
202          ? n.viewportWidth()
203          : this.adapter.innerWidth();
204      }),
205      (e.prototype.destroy = function () {
206        var t = [];
207        for (var e in this.waypoints)
208          for (var i in this.waypoints[e]) t.push(this.waypoints[e][i]);
209        for (var o = 0, n = t.length; n > o; o++) t[o].destroy();
210      }),
211      (e.prototype.refresh = function () {
212        var t,
213          e = this.element == this.element.window,
214          i = e ? void 0 : this.adapter.offset(),
215          o = {};
216        this.handleScroll(),
217          (t = {
218            horizontal: {
219              contextOffset: e ? 0 : i.left,
220              contextScroll: e ? 0 : this.oldScroll.x,
221              contextDimension: this.innerWidth(),
222              oldScroll: this.oldScroll.x,
223              forward: "right",
224              backward: "left",
225              offsetProp: "left",
226            },
227            vertical: {
228              contextOffset: e ? 0 : i.top,
229              contextScroll: e ? 0 : this.oldScroll.y,
230              contextDimension: this.innerHeight(),
231              oldScroll: this.oldScroll.y,
232              forward: "down",
233              backward: "up",
234              offsetProp: "top",
235            },
236          });
237        for (var r in t) {
238          var s = t[r];
239          for (var a in this.waypoints[r]) {
240            var l,
241              h,
242              p,
243              u,
244              c,
245              d = this.waypoints[r][a],
246              f = d.options.offset,
247              w = d.triggerPoint,
248              y = 0,
249              g = null == w;
250            d.element !== d.element.window &&
251              (y = d.adapter.offset()[s.offsetProp]),
252              "function" == typeof f
253                ? (f = f.apply(d))
254                : "string" == typeof f &&
255                  ((f = parseFloat(f)),
256                  d.options.offset.indexOf("%") > -1 &&
257                    (f = Math.ceil((s.contextDimension * f) / 100))),
258              (l = s.contextScroll - s.contextOffset),
259              (d.triggerPoint = Math.floor(y + l - f)),
260              (h = w < s.oldScroll),
261              (p = d.triggerPoint >= s.oldScroll),
262              (u = h && p),
263              (c = !h && !p),
264              !g && u
265                ? (d.queueTrigger(s.backward), (o[d.group.id] = d.group))
266                : !g && c
267                ? (d.queueTrigger(s.forward), (o[d.group.id] = d.group))
268                : g &&
269                  s.oldScroll >= d.triggerPoint &&
270                  (d.queueTrigger(s.forward), (o[d.group.id] = d.group));
271          }
272        }
273        return (
274          n.requestAnimationFrame(function () {
275            for (var t in o) o[t].flushTriggers();
276          }),
277          this
278        );
279      }),
280      (e.findOrCreateByElement = function (t) {
281        return e.findByElement(t) || new e(t);
282      }),
283      (e.refreshAll = function () {
284        for (var t in o) o[t].refresh();
285      }),
286      (e.findByElement = function (t) {
287        return o[t.waypointContextKey];
288      }),
289      (window.onload = function () {
290        r && r(), e.refreshAll();
291      }),
292      (n.requestAnimationFrame = function (e) {
293        var i =
294          window.requestAnimationFrame ||
295          window.mozRequestAnimationFrame ||
296          window.webkitRequestAnimationFrame ||
297          t;
298        i.call(window, e);
299      }),
300      (n.Context = e);
301  })(),
302  (function () {
303    "use strict";
304    function t(t, e) {
305      return t.triggerPoint - e.triggerPoint;
306    }
307    function e(t, e) {
308      return e.triggerPoint - t.triggerPoint;
309    }
310    function i(t) {
311      (this.name = t.name),
312        (this.axis = t.axis),
313        (this.id = this.name + "-" + this.axis),
314        (this.waypoints = []),
315        this.clearTriggerQueues(),
316        (o[this.axis][this.name] = this);
317    }
318    var o = { vertical: {}, horizontal: {} },
319      n = window.Waypoint;
320    (i.prototype.add = function (t) {
321      this.waypoints.push(t);
322    }),
323      (i.prototype.clearTriggerQueues = function () {
324        this.triggerQueues = { up: [], down: [], left: [], right: [] };
325      }),
326      (i.prototype.flushTriggers = function () {
327        for (var i in this.triggerQueues) {
328          var o = this.triggerQueues[i],
329            n = "up" === i || "left" === i;
330          o.sort(n ? e : t);
331          for (var r = 0, s = o.length; s > r; r += 1) {
332            var a = o[r];
333            (a.options.continuous || r === o.length - 1) && a.trigger([i]);
334          }
335        }
336        this.clearTriggerQueues();
337      }),
338      (i.prototype.next = function (e) {
339        this.waypoints.sort(t);
340        var i = n.Adapter.inArray(e, this.waypoints),
341          o = i === this.waypoints.length - 1;
342        return o ? null : this.waypoints[i + 1];
343      }),
344      (i.prototype.previous = function (e) {
345        this.waypoints.sort(t);
346        var i = n.Adapter.inArray(e, this.waypoints);
347        return i ? this.waypoints[i - 1] : null;
348      }),
349      (i.prototype.queueTrigger = function (t, e) {
350        this.triggerQueues[e].push(t);
351      }),
352      (i.prototype.remove = function (t) {
353        var e = n.Adapter.inArray(t, this.waypoints);
354        e > -1 && this.waypoints.splice(e, 1);
355      }),
356      (i.prototype.first = function () {
357        return this.waypoints[0];
358      }),
359      (i.prototype.last = function () {
360        return this.waypoints[this.waypoints.length - 1];
361      }),
362      (i.findOrCreate = function (t) {
363        return o[t.axis][t.name] || new i(t);
364      }),
365      (n.Group = i);
366  })(),
367  (function () {
368    "use strict";
369    function t(t) {
370      this.$element = e(t);
371    }
372    var e = window.jQuery,
373      i = window.Waypoint;
374    e.each(
375      [
376        "innerHeight",
377        "innerWidth",
378        "off",
379        "offset",
380        "on",
381        "outerHeight",
382        "outerWidth",
383        "scrollLeft",
384        "scrollTop",
385      ],
386      function (e, i) {
387        t.prototype[i] = function () {
388          var t = Array.prototype.slice.call(arguments);
389          return this.$element[i].apply(this.$element, t);
390        };
391      }
392    ),
393      e.each(["extend", "inArray", "isEmptyObject"], function (i, o) {
394        t[o] = e[o];
395      }),
396      i.adapters.push({ name: "jquery", Adapter: t }),
397      (i.Adapter = t);
398  })(),
399  (function () {
400    "use strict";
401    function t(t) {
402      return function () {
403        var i = [],
404          o = arguments[0];
405        return (
406          t.isFunction(arguments[0]) &&
407            ((o = t.extend({}, arguments[1])), (o.handler = arguments[0])),
408          this.each(function () {
409            var n = t.extend({}, o, { element: this });
410            "string" == typeof n.context &&
411              (n.context = t(this).closest(n.context)[0]),
412              i.push(new e(n));
413          }),
414          i
415        );
416      };
417    }
418    var e = window.Waypoint;
419    window.jQuery && (window.jQuery.fn.waypoint = t(window.jQuery)),
420      window.Zepto && (window.Zepto.fn.waypoint = t(window.Zepto));
421  })();

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.