PageSourceSearch

https://itcharge.ru/assets/js/waypoints.min.js

js itcharge.ru collected 2026-10-07 02:18:57 UTC 13,149 bytes, 465 lines download raw bytes

1// Generated by CoffeeScript 1.6.2
2/*
3jQuery Waypoints - v2.0.3
4Copyright (c) 2011-2013 Caleb Troughton
5Dual licensed under the MIT license and GPL license.
6https://github.com/imakewebthings/jquery-waypoints/blob/master/licenses.txt
7*/
8;(function() {
9  var t =
10      [].indexOf ||
11      function(t) {
12        for (var e = 0, n = this.length; e < n; e++) {
13          if (e in this && this[e] === t) return e
14        }
15        return -1
16      },
17    e = [].slice
18  ;(function(t, e) {
19    if (typeof define === 'function' && define.amd) {
20      return define('waypoints', ['jquery'], function(n) {
21        return e(n, t)
22      })
23    } else {
24      return e(t.jQuery, t)
25    }
26  })(this, function(n, r) {
27    var i, o, l, s, f, u, a, c, h, d, p, y, v, w, g, m
28    i = n(r)
29    c = t.call(r, 'ontouchstart') >= 0
30    s = { horizontal: {}, vertical: {} }
31    f = 1
32    a = {}
33    u = 'waypoints-context-id'
34    p = 'resize.waypoints'
35    y = 'scroll.waypoints'
36    v = 1
37    w = 'waypoints-waypoint-ids'
38    g = 'waypoint'
39    m = 'waypoints'
40    o = (function() {
41      function t(t) {
42        var e = this
43        this.$element = t
44        this.element = t[0]
45        this.didResize = false
46        this.didScroll = false
47        this.id = 'context' + f++
48        this.oldScroll = { x: t.scrollLeft(), y: t.scrollTop() }
49        this.waypoints = { horizontal: {}, vertical: {} }
50        t.data(u, this.id)
51        a[this.id] = this
52        t.bind(y, function() {
53          var t
54          if (!(e.didScroll || c)) {
55            e.didScroll = true
56            t = function() {
57              e.doScroll()
58              return (e.didScroll = false)
59            }
60            return r.setTimeout(t, n[m].settings.scrollThrottle)
61          }
62        })
63        t.bind(p, function() {
64          var t
65          if (!e.didResize) {
66            e.didResize = true
67            t = function() {
68              n[m]('refresh')
69              return (e.didResize = false)
70            }
71            return r.setTimeout(t, n[m].settings.resizeThrottle)
72          }
73        })
74      }
75      t.prototype.doScroll = function() {
76        var t,
77          e = this
78        t = {
79          horizontal: {
80            newScroll: this.$element.scrollLeft(),
81            oldScroll: this.oldScroll.x,
82            forward: 'right',
83            backward: 'left'
84          },
85          vertical: {
86            newScroll: this.$element.scrollTop(),
87            oldScroll: this.oldScroll.y,
88            forward: 'down',
89            backward: 'up'
90          }
91        }
92        if (c && (!t.vertical.oldScroll || !t.vertical.newScroll)) {
93          n[m]('refresh')
94        }
95        n.each(t, function(t, r) {
96          var i, o, l
97          l = []
98          o = r.newScroll > r.oldScroll
99          i = o ? r.forward : r.backward
100          n.each(e.waypoints[t], function(t, e) {
101            var n, i
102            if (r.oldScroll < (n = e.offset) && n <= r.newScroll) {
103              return l.push(e)
104            } else if (r.newScroll < (i = e.offset) && i <= r.oldScroll) {
105              return l.push(e)
106            }
107          })
108          l.sort(function(t, e) {
109            return t.offset - e.offset
110          })
111          if (!o) {
112            l.reverse()
113          }
114          return n.each(l, function(t, e) {
115            if (e.options.continuous || t === l.length - 1) {
116              return e.trigger([i])
117            }
118          })
119        })
120        return (this.oldScroll = { x: t.horizontal.newScroll, y: t.vertical.newScroll })
121      }
122      t.prototype.refresh = function() {
123        var t,
124          e,
125          r,
126          i = this
127        r = n.isWindow(this.element)
128        e = this.$element.offset()
129        this.doScroll()
130        t = {
131          horizontal: {
132            contextOffset: r ? 0 : e.left,
133            contextScroll: r ? 0 : this.oldScroll.x,
134            contextDimension: this.$element.width(),
135            oldScroll: this.oldScroll.x,
136            forward: 'right',
137            backward: 'left',
138            offsetProp: 'left'
139          },
140          vertical: {
141            contextOffset: r ? 0 : e.top,
142            contextScroll: r ? 0 : this.oldScroll.y,
143            contextDimension: r ? n[m]('viewportHeight') : this.$element.height(),
144            oldScroll: this.oldScroll.y,
145            forward: 'down',
146            backward: 'up',
147            offsetProp: 'top'
148          }
149        }
150        return n.each(t, function(t, e) {
151          return n.each(i.waypoints[t], function(t, r) {
152            var i, o, l, s, f
153            i = r.options.offset
154            l = r.offset
155            o = n.isWindow(r.element) ? 0 : r.$element.offset()[e.offsetProp]
156            if (n.isFunction(i)) {
157              i = i.apply(r.element)
158            } else if (typeof i === 'string') {
159              i = parseFloat(i)
160              if (r.options.offset.indexOf('%') > -1) {
161                i = Math.ceil((e.contextDimension * i) / 100)
162              }
163            }
164            r.offset = o - e.contextOffset + e.contextScroll - i
165            if ((r.options.onlyOnScroll && l != null) || !r.enabled) {
166              return
167            }
168            if (l !== null && l < (s = e.oldScroll) && s <= r.offset) {
169              return r.trigger([e.backward])
170            } else if (l !== null && l > (f = e.oldScroll) && f >= r.offset) {
171              return r.trigger([e.forward])
172            } else if (l === null && e.oldScroll >= r.offset) {
173              return r.trigger([e.forward])
174            }
175          })
176        })
177      }
178      t.prototype.checkEmpty = function() {
179        if (n.isEmptyObject(this.waypoints.horizontal) && n.isEmptyObject(this.waypoints.vertical)) {
180          this.$element.unbind([p, y].join(' '))
181          return delete a[this.id]
182        }
183      }
184      return t
185    })()
186    l = (function() {
187      function t(t, e, r) {
188        var i, o
189        r = n.extend({}, n.fn[g].defaults, r)
190        if (r.offset === 'bottom-in-view') {
191          r.offset = function() {
192            var t
193            t = n[m]('viewportHeight')
194            if (!n.isWindow(e.element)) {
195              t = e.$element.height()
196            }
197            return t - n(this).outerHeight()
198          }
199        }
200        this.$element = t
201        this.element = t[0]
202        this.axis = r.horizontal ? 'horizontal' : 'vertical'
203        this.callback = r.handler
204        this.context = e
205        this.enabled = r.enabled
206        this.id = 'waypoints' + v++
207        this.offset = null
208        this.options = r
209        e.waypoints[this.axis][this.id] = this
210        s[this.axis][this.id] = this
211        i = (o = t.data(w)) != null ? o : []
212        i.push(this.id)
213        t.data(w, i)
214      }
215      t.prototype.trigger = function(t) {
216        if (!this.enabled) {
217          return
218        }
219        if (this.callback != null) {
220          this.callback.apply(this.element, t)
221        }
222        if (this.options.triggerOnce) {
223          return this.destroy()
224        }
225      }
226      t.prototype.disable = function() {
227        return (this.enabled = false)
228      }
229      t.prototype.enable = function() {
230        this.context.refresh()
231        return (this.enabled = true)
232      }
233      t.prototype.destroy = function() {
234        delete s[this.axis][this.id]
235        delete this.context.waypoints[this.axis][this.id]
236        return this.context.checkEmpty()
237      }
238      t.getWaypointsByElement = function(t) {
239        var e, r
240        r = n(t).data(w)
241        if (!r) {
242          return []
243        }
244        e = n.extend({}, s.horizontal, s.vertical)
245        return n.map(r, function(t) {
246          return e[t]
247        })
248      }
249      return t
250    })()
251    d = {
252      init: function(t, e) {
253        var r
254        if (e == null) {
255          e = {}
256        }
257        if ((r = e.handler) == null) {
258          e.handler = t
259        }
260        this.each(function() {
261          var t, r, i, s
262          t = n(this)
263          i = (s = e.context) != null ? s : n.fn[g].defaults.context
264          if (!n.isWindow(i)) {
265            i = t.closest(i)
266          }
267          i = n(i)
268          r = a[i.data(u)]
269          if (!r) {
270            r = new o(i)
271          }
272          return new l(t, r, e)
273        })
274        n[m]('refresh')
275        return this
276      },
277      disable: function() {
278        return d._invoke(this, 'disable')
279      },
280      enable: function() {
281        return d._invoke(this, 'enable')
282      },
283      destroy: function() {
284        return d._invoke(this, 'destroy')
285      },
286      prev: function(t, e) {
287        return d._traverse.call(this, t, e, function(t, e, n) {
288          if (e > 0) {
289            return t.push(n[e - 1])
290          }
291        })
292      },
293      next: function(t, e) {
294        return d._traverse.call(this, t, e, function(t, e, n) {
295          if (e < n.length - 1) {
296            return t.push(n[e + 1])
297          }
298        })
299      },
300      _traverse: function(t, e, i) {
301        var o, l
302        if (t == null) {
303          t = 'vertical'
304        }
305        if (e == null) {
306          e = r
307        }
308        l = h.aggregate(e)
309        o = []
310        this.each(function() {
311          var e
312          e = n.inArray(this, l[t])
313          return i(o, e, l[t])
314        })
315        return this.pushStack(o)
316      },
317      _invoke: function(t, e) {
318        t.each(function() {
319          var t
320          t = l.getWaypointsByElement(this)
321          return n.each(t, function(t, n) {
322            n[e]()
323            return true
324          })
325        })
326        return this
327      }
328    }
329    n.fn[g] = function() {
330      var t, r
331      ;(r = arguments[0]), (t = 2 <= arguments.length ? e.call(arguments, 1) : [])
332      if (d[r]) {
333        return d[r].apply(this, t)
334      } else if (n.isFunction(r)) {
335        return d.init.apply(this, arguments)
336      } else if (n.isPlainObject(r)) {
337        return d.init.apply(this, [null, r])
338      } else if (!r) {
339        return n.error('jQuery Waypoints needs a callback function or handler option.')
340      } else {
341        return n.error('The ' + r + ' method does not exist in jQuery Waypoints.')
342      }
343    }
344    n.fn[g].defaults = { context: r, continuous: true, enabled: true, horizontal: false, offset: 0, triggerOnce: false }
345    h = {
346      refresh: function() {
347        return n.each(a, function(t, e) {
348          return e.refresh()
349        })
350      },
351      viewportHeight: function() {
352        var t
353        return (t = r.innerHeight) != null ? t : i.height()
354      },
355      aggregate: function(t) {
356        var e, r, i
357        e = s
358        if (t) {
359          e = (i = a[n(t).data(u)]) != null ? i.waypoints : void 0
360        }
361        if (!e) {
362          return []
363        }
364        r = { horizontal: [], vertical: [] }
365        n.each(r, function(t, i) {
366          n.each(e[t], function(t, e) {
367            return i.push(e)
368          })
369          i.sort(function(t, e) {
370            return t.offset - e.offset
371          })
372          r[t] = n.map(i, function(t) {
373            return t.element
374          })
375          return (r[t] = n.unique(r[t]))
376        })
377        return r
378      },
379      above: function(t) {
380        if (t == null) {
381          t = r
382        }
383        return h._filter(t, 'vertical', function(t, e) {
384          return e.offset <= t.oldScroll.y
385        })
386      },
387      below: function(t) {
388        if (t == null) {
389          t = r
390        }
391        return h._filter(t, 'vertical', function(t, e) {
392          return e.offset > t.oldScroll.y
393        })
394      },
395      left: function(t) {
396        if (t == null) {
397          t = r
398        }
399        return h._filter(t, 'horizontal', function(t, e) {
400          return e.offset <= t.oldScroll.x
401        })
402      },
403      right: function(t) {
404        if (t == null) {
405          t = r
406        }
407        return h._filter(t, 'horizontal', function(t, e) {
408          return e.offset > t.oldScroll.x
409        })
410      },
411      enable: function() {
412        return h._invoke('enable')
413      },
414      disable: function() {
415        return h._invoke('disable')
416      },
417      destroy: function() {
418        return h._invoke('destroy')
419      },
420      extendFn: function(t, e) {
421        return (d[t] = e)
422      },
423      _invoke: function(t) {
424        var e
425        e = n.extend({}, s.vertical, s.horizontal)
426        return n.each(e, function(e, n) {
427          n[t]()
428          return true
429        })
430      },
431      _filter: function(t, e, r) {
432        var i, o
433        i = a[n(t).data(u)]
434        if (!i) {
435          return []
436        }
437        o = []
438        n.each(i.waypoints[e], function(t, e) {
439          if (r(i, e)) {
440            return o.push(e)
441          }
442        })
443        o.sort(function(t, e) {
444          return t.offset - e.offset
445        })
446        return n.map(o, function(t) {
447          return t.element
448        })
449      }
450    }
451    n[m] = function() {
452      var t, n
453      ;(n = arguments[0]), (t = 2 <= arguments.length ? e.call(arguments, 1) : [])
454      if (h[n]) {
455        return h[n].apply(null, t)
456      } else {
457        return h.aggregate.call(null, n)
458      }
459    }
460    n[m].settings = { resizeThrottle: 100, scrollThrottle: 30 }
461    return i.load(function() {
462      return n[m]('refresh')
463    })
464  })
465}.call(this))

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.