PageSourceSearch

https://www.thinksns.com/themes/zhiyicx/Public/assets/js/RevealAnimation.js

js thinksns.com collected 2026-10-04 05:02:44 UTC 24,145 bytes, 852 lines download raw bytes

1/*!
2Waypoints - 4.0.1
3Copyright 2011-2016 Caleb Troughton
4Licensed under the MIT license.
5https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
6*/
7(function() {
8  'use strict'
9
10  var keyCounter = 0
11  var allWaypoints = {}
12
13  /* http://imakewebthings.com/waypoints/api/waypoint */
14  function Waypoint(options) {
15    if (!options) {
16      throw new Error('No options passed to Waypoint constructor')
17    }
18    if (!options.element) {
19      throw new Error('No element option passed to Waypoint constructor')
20    }
21    if (!options.handler) {
22      throw new Error('No handler option passed to Waypoint constructor')
23    }
24
25    this.key = 'waypoint-' + keyCounter
26    this.options = Waypoint.Adapter.extend({}, Waypoint.defaults, options)
27    this.element = this.options.element
28    this.adapter = new Waypoint.Adapter(this.element)
29    this.callback = options.handler
30    this.axis = this.options.horizontal ? 'horizontal' : 'vertical'
31    this.enabled = this.options.enabled
32    this.triggerPoint = null
33    this.group = Waypoint.Group.findOrCreate({
34      name: this.options.group,
35      axis: this.axis
36    })
37    this.context = Waypoint.Context.findOrCreateByElement(this.options.context)
38
39    if (Waypoint.offsetAliases[this.options.offset]) {
40      this.options.offset = Waypoint.offsetAliases[this.options.offset]
41    }
42    this.group.add(this)
43    this.context.add(this)
44    allWaypoints[this.key] = this
45    keyCounter += 1
46  }
47
48  /* Private */
49  Waypoint.prototype.queueTrigger = function(direction) {
50    this.group.queueTrigger(this, direction)
51  }
52
53  /* Private */
54  Waypoint.prototype.trigger = function(args) {
55    if (!this.enabled) {
56      return
57    }
58    if (this.callback) {
59      this.callback.apply(this, args)
60    }
61  }
62
63  /* Public */
64  /* http://imakewebthings.com/waypoints/api/destroy */
65  Waypoint.prototype.destroy = function() {
66    this.context.remove(this)
67    this.group.remove(this)
68    delete allWaypoints[this.key]
69  }
70
71  /* Public */
72  /* http://imakewebthings.com/waypoints/api/disable */
73  Waypoint.prototype.disable = function() {
74    this.enabled = false
75    return this
76  }
77
78  /* Public */
79  /* http://imakewebthings.com/waypoints/api/enable */
80  Waypoint.prototype.enable = function() {
81    this.context.refresh()
82    this.enabled = true
83    return this
84  }
85
86  /* Public */
87  /* http://imakewebthings.com/waypoints/api/next */
88  Waypoint.prototype.next = function() {
89    return this.group.next(this)
90  }
91
92  /* Public */
93  /* http://imakewebthings.com/waypoints/api/previous */
94  Waypoint.prototype.previous = function() {
95    return this.group.previous(this)
96  }
97
98  /* Private */
99  Waypoint.invokeAll = function(method) {
100    var allWaypointsArray = []
101    for (var waypointKey in allWaypoints) {
102      allWaypointsArray.push(allWaypoints[waypointKey])
103    }
104    for (var i = 0, end = allWaypointsArray.length; i < end; i++) {
105      allWaypointsArray[i][method]()
106    }
107  }
108
109  /* Public */
110  /* http://imakewebthings.com/waypoints/api/destroy-all */
111  Waypoint.destroyAll = function() {
112    Waypoint.invokeAll('destroy')
113  }
114
115  /* Public */
116  /* http://imakewebthings.com/waypoints/api/disable-all */
117  Waypoint.disableAll = function() {
118    Waypoint.invokeAll('disable')
119  }
120
121  /* Public */
122  /* http://imakewebthings.com/waypoints/api/enable-all */
123  Waypoint.enableAll = function() {
124    Waypoint.Context.refreshAll()
125    for (var waypointKey in allWaypoints) {
126      allWaypoints[waypointKey].enabled = true
127    }
128    return this
129  }
130
131  /* Public */
132  /* http://imakewebthings.com/waypoints/api/refresh-all */
133  Waypoint.refreshAll = function() {
134    Waypoint.Context.refreshAll()
135  }
136
137  /* Public */
138  /* http://imakewebthings.com/waypoints/api/viewport-height */
139  Waypoint.viewportHeight = function() {
140    return window.innerHeight || document.documentElement.clientHeight
141  }
142
143  /* Public */
144  /* http://imakewebthings.com/waypoints/api/viewport-width */
145  Waypoint.viewportWidth = function() {
146    return document.documentElement.clientWidth
147  }
148
149  Waypoint.adapters = []
150
151  Waypoint.defaults = {
152    context: window,
153    continuous: true,
154    enabled: true,
155    group: 'default',
156    horizontal: false,
157    offset: 0
158  }
159
160  Waypoint.offsetAliases = {
161    'bottom-in-view': function() {
162      return this.context.innerHeight() - this.adapter.outerHeight()
163    },
164    'right-in-view': function() {
165      return this.context.innerWidth() - this.adapter.outerWidth()
166    }
167  }
168
169  window.Waypoint = Waypoint
170}());
171(function() {
172  'use strict'
173
174  function requestAnimationFrameShim(callback) {
175    window.setTimeout(callback, 1000 / 60)
176  }
177
178  var keyCounter = 0
179  var contexts = {}
180  var Waypoint = window.Waypoint
181  var oldWindowLoad = window.onload
182
183  /* http://imakewebthings.com/waypoints/api/context */
184  function Context(element) {
185    this.element = element
186    this.Adapter = Waypoint.Adapter
187    this.adapter = new this.Adapter(element)
188    this.key = 'waypoint-context-' + keyCounter
189    this.didScroll = false
190    this.didResize = false
191    this.oldScroll = {
192      x: this.adapter.scrollLeft(),
193      y: this.adapter.scrollTop()
194    }
195    this.waypoints = {
196      vertical: {},
197      horizontal: {}
198    }
199
200    element.waypointContextKey = this.key
201    contexts[element.waypointContextKey] = this
202    keyCounter += 1
203    if (!Waypoint.windowContext) {
204      Waypoint.windowContext = true
205      Waypoint.windowContext = new Context(window)
206    }
207
208    this.createThrottledScrollHandler()
209    this.createThrottledResizeHandler()
210  }
211
212  /* Private */
213  Context.prototype.add = function(waypoint) {
214    var axis = waypoint.options.horizontal ? 'horizontal' : 'vertical'
215    this.waypoints[axis][waypoint.key] = waypoint
216    this.refresh()
217  }
218
219  /* Private */
220  Context.prototype.checkEmpty = function() {
221    var horizontalEmpty = this.Adapter.isEmptyObject(this.waypoints.horizontal)
222    var verticalEmpty = this.Adapter.isEmptyObject(this.waypoints.vertical)
223    var isWindow = this.element == this.element.window
224    if (horizontalEmpty && verticalEmpty && !isWindow) {
225      this.adapter.off('.waypoints')
226      delete contexts[this.key]
227    }
228  }
229
230  /* Private */
231  Context.prototype.createThrottledResizeHandler = function() {
232    var self = this
233
234    function resizeHandler() {
235      self.handleResize()
236      self.didResize = false
237    }
238
239    this.adapter.on('resize.waypoints', function() {
240      if (!self.didResize) {
241        self.didResize = true
242        Waypoint.requestAnimationFrame(resizeHandler)
243      }
244    })
245  }
246
247  /* Private */
248  Context.prototype.createThrottledScrollHandler = function() {
249    var self = this
250
251    function scrollHandler() {
252      self.handleScroll()
253      self.didScroll = false
254    }
255
256    this.adapter.on('scroll.waypoints', function() {
257      if (!self.didScroll || Waypoint.isTouch) {
258        self.didScroll = true
259        Waypoint.requestAnimationFrame(scrollHandler)
260      }
261    })
262  }
263
264  /* Private */
265  Context.prototype.handleResize = function() {
266    Waypoint.Context.refreshAll()
267  }
268
269  /* Private */
270  Context.prototype.handleScroll = function() {
271    var triggeredGroups = {}
272    var axes = {
273      horizontal: {
274        newScroll: this.adapter.scrollLeft(),
275        oldScroll: this.oldScroll.x,
276        forward: 'right',
277        backward: 'left'
278      },
279      vertical: {
280        newScroll: this.adapter.scrollTop(),
281        oldScroll: this.oldScroll.y,
282        forward: 'down',
283        backward: 'up'
284      }
285    }
286
287    for (var axisKey in axes) {
288      var axis = axes[axisKey]
289      var isForward = axis.newScroll > axis.oldScroll
290      var direction = isForward ? axis.forward : axis.backward
291
292      for (var waypointKey in this.waypoints[axisKey]) {
293        var waypoint = this.waypoints[axisKey][waypointKey]
294        if (waypoint.triggerPoint === null) {
295          continue
296        }
297        var wasBeforeTriggerPoint = axis.oldScroll < waypoint.triggerPoint
298        var nowAfterTriggerPoint = axis.newScroll >= waypoint.triggerPoint
299        var crossedForward = wasBeforeTriggerPoint && nowAfterTriggerPoint
300        var crossedBackward = !wasBeforeTriggerPoint && !nowAfterTriggerPoint
301        if (crossedForward || crossedBackward) {
302          waypoint.queueTrigger(direction)
303          triggeredGroups[waypoint.group.id] = waypoint.group
304        }
305      }
306    }
307
308    for (var groupKey in triggeredGroups) {
309      triggeredGroups[groupKey].flushTriggers()
310    }
311
312    this.oldScroll = {
313      x: axes.horizontal.newScroll,
314      y: axes.vertical.newScroll
315    }
316  }
317
318  /* Private */
319  Context.prototype.innerHeight = function() {
320    /*eslint-disable eqeqeq */
321    if (this.element == this.element.window) {
322      return Waypoint.viewportHeight()
323    }
324    /*eslint-enable eqeqeq */
325    return this.adapter.innerHeight()
326  }
327
328  /* Private */
329  Context.prototype.remove = function(waypoint) {
330    delete this.waypoints[waypoint.axis][waypoint.key]
331    this.checkEmpty()
332  }
333
334  /* Private */
335  Context.prototype.innerWidth = function() {
336    /*eslint-disable eqeqeq */
337    if (this.element == this.element.window) {
338      return Waypoint.viewportWidth()
339    }
340    /*eslint-enable eqeqeq */
341    return this.adapter.innerWidth()
342  }
343
344  /* Public */
345  /* http://imakewebthings.com/waypoints/api/context-destroy */
346  Context.prototype.destroy = function() {
347    var allWaypoints = []
348    for (var axis in this.waypoints) {
349      for (var waypointKey in this.waypoints[axis]) {
350        allWaypoints.push(this.waypoints[axis][waypointKey])
351      }
352    }
353    for (var i = 0, end = allWaypoints.length; i < end; i++) {
354      allWaypoints[i].destroy()
355    }
356  }
357
358  /* Public */
359  /* http://imakewebthings.com/waypoints/api/context-refresh */
360  Context.prototype.refresh = function() {
361    /*eslint-disable eqeqeq */
362    var isWindow = this.element == this.element.window
363      /*eslint-enable eqeqeq */
364    var contextOffset = isWindow ? undefined : this.adapter.offset()
365    var triggeredGroups = {}
366    var axes
367
368    this.handleScroll()
369    axes = {
370      horizontal: {
371        contextOffset: isWindow ? 0 : contextOffset.left,
372        contextScroll: isWindow ? 0 : this.oldScroll.x,
373        contextDimension: this.innerWidth(),
374        oldScroll: this.oldScroll.x,
375        forward: 'right',
376        backward: 'left',
377        offsetProp: 'left'
378      },
379      vertical: {
380        contextOffset: isWindow ? 0 : contextOffset.top,
381        contextScroll: isWindow ? 0 : this.oldScroll.y,
382        contextDimension: this.innerHeight(),
383        oldScroll: this.oldScroll.y,
384        forward: 'down',
385        backward: 'up',
386        offsetProp: 'top'
387      }
388    }
389
390    for (var axisKey in axes) {
391      var axis = axes[axisKey]
392      for (var waypointKey in this.waypoints[axisKey]) {
393        var waypoint = this.waypoints[axisKey][waypointKey]
394        var adjustment = waypoint.options.offset
395        var oldTriggerPoint = waypoint.triggerPoint
396        var elementOffset = 0
397        var freshWaypoint = oldTriggerPoint == null
398        var contextModifier, wasBeforeScroll, nowAfterScroll
399        var triggeredBackward, triggeredForward
400
401        if (waypoint.element !== waypoint.element.window) {
402          elementOffset = waypoint.adapter.offset()[axis.offsetProp]
403        }
404
405        if (typeof adjustment === 'function') {
406          adjustment = adjustment.apply(waypoint)
407        } else if (typeof adjustment === 'string') {
408          adjustment = parseFloat(adjustment)
409          if (waypoint.options.offset.indexOf('%') > -1) {
410            adjustment = Math.ceil(axis.contextDimension * adjustment / 100)
411          }
412        }
413
414        contextModifier = axis.contextScroll - axis.contextOffset
415        waypoint.triggerPoint = Math.floor(elementOffset + contextModifier - adjustment)
416        wasBeforeScroll = oldTriggerPoint < axis.oldScroll
417        nowAfterScroll = waypoint.triggerPoint >= axis.oldScroll
418        triggeredBackward = wasBeforeScroll && nowAfterScroll
419        triggeredForward = !wasBeforeScroll && !nowAfterScroll
420
421        if (!freshWaypoint && triggeredBackward) {
422          waypoint.queueTrigger(axis.backward)
423          triggeredGroups[waypoint.group.id] = waypoint.group
424        } else if (!freshWaypoint && triggeredForward) {
425          waypoint.queueTrigger(axis.forward)
426          triggeredGroups[waypoint.group.id] = waypoint.group
427        } else if (freshWaypoint && axis.oldScroll >= waypoint.triggerPoint) {
428          waypoint.queueTrigger(axis.forward)
429          triggeredGroups[waypoint.group.id] = waypoint.group
430        }
431      }
432    }
433
434    Waypoint.requestAnimationFrame(function() {
435      for (var groupKey in triggeredGroups) {
436        triggeredGroups[groupKey].flushTriggers()
437      }
438    })
439
440    return this
441  }
442
443  /* Private */
444  Context.findOrCreateByElement = function(element) {
445    return Context.findByElement(element) || new Context(element)
446  }
447
448  /* Private */
449  Context.refreshAll = function() {
450    for (var contextId in contexts) {
451      contexts[contextId].refresh()
452    }
453  }
454
455  /* Public */
456  /* http://imakewebthings.com/waypoints/api/context-find-by-element */
457  Context.findByElement = function(element) {
458    return contexts[element.waypointContextKey]
459  }
460
461  window.onload = function() {
462    if (oldWindowLoad) {
463      oldWindowLoad()
464    }
465    Context.refreshAll()
466  }
467
468
469  Waypoint.requestAnimationFrame = function(callback) {
470    var requestFn = window.requestAnimationFrame ||
471      window.mozRequestAnimationFrame ||
472      window.webkitRequestAnimationFrame ||
473      requestAnimationFrameShim
474    requestFn.call(window, callback)
475  }
476  Waypoint.Context = Context
477}());
478(function() {
479  'use strict'
480
481  function byTriggerPoint(a, b) {
482    return a.triggerPoint - b.triggerPoint
483  }
484
485  function byReverseTriggerPoint(a, b) {
486    return b.triggerPoint - a.triggerPoint
487  }
488
489  var groups = {
490    vertical: {},
491    horizontal: {}
492  }
493  var Waypoint = window.Waypoint
494
495  /* http://imakewebthings.com/waypoints/api/group */
496  function Group(options) {
497    this.name = options.name
498    this.axis = options.axis
499    this.id = this.name + '-' + this.axis
500    this.waypoints = []
501    this.clearTriggerQueues()
502    groups[this.axis][this.name] = this
503  }
504
505  /* Private */
506  Group.prototype.add = function(waypoint) {
507    this.waypoints.push(waypoint)
508  }
509
510  /* Private */
511  Group.prototype.clearTriggerQueues = function() {
512    this.triggerQueues = {
513      up: [],
514      down: [],
515      left: [],
516      right: []
517    }
518  }
519
520  /* Private */
521  Group.prototype.flushTriggers = function() {
522    for (var direction in this.triggerQueues) {
523      var waypoints = this.triggerQueues[direction]
524      var reverse = direction === 'up' || direction === 'left'
525      waypoints.sort(reverse ? byReverseTriggerPoint : byTriggerPoint)
526      for (var i = 0, end = waypoints.length; i < end; i += 1) {
527        var waypoint = waypoints[i]
528        if (waypoint.options.continuous || i === waypoints.length - 1) {
529          waypoint.trigger([direction])
530        }
531      }
532    }
533    this.clearTriggerQueues()
534  }
535
536  /* Private */
537  Group.prototype.next = function(waypoint) {
538    this.waypoints.sort(byTriggerPoint)
539    var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)
540    var isLast = index === this.waypoints.length - 1
541    return isLast ? null : this.waypoints[index + 1]
542  }
543
544  /* Private */
545  Group.prototype.previous = function(waypoint) {
546    this.waypoints.sort(byTriggerPoint)
547    var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)
548    return index ? this.waypoints[index - 1] : null
549  }
550
551  /* Private */
552  Group.prototype.queueTrigger = function(waypoint, direction) {
553    this.triggerQueues[direction].push(waypoint)
554  }
555
556  /* Private */
557  Group.prototype.remove = function(waypoint) {
558    var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)
559    if (index > -1) {
560      this.waypoints.splice(index, 1)
561    }
562  }
563
564  /* Public */
565  /* http://imakewebthings.com/waypoints/api/first */
566  Group.prototype.first = function() {
567    return this.waypoints[0]
568  }
569
570  /* Public */
571  /* http://imakewebthings.com/waypoints/api/last */
572  Group.prototype.last = function() {
573    return this.waypoints[this.waypoints.length - 1]
574  }
575
576  /* Private */
577  Group.findOrCreate = function(options) {
578    return groups[options.axis][options.name] || new Group(options)
579  }
580
581  Waypoint.Group = Group
582}());
583(function() {
584  'use strict'
585
586  var $ = window.jQuery
587  var Waypoint = window.Waypoint
588
589  function JQueryAdapter(element) {
590    this.$element = $(element)
591  }
592
593  $.each([
594    'innerHeight',
595    'innerWidth',
596    'off',
597    'offset',
598    'on',
599    'outerHeight',
600    'outerWidth',
601    'scrollLeft',
602    'scrollTop'
603  ], function(i, method) {
604    JQueryAdapter.prototype[method] = function() {
605      var args = Array.prototype.slice.call(arguments)
606      return this.$element[method].apply(this.$element, args)
607    }
608  })
609
610  $.each([
611    'extend',
612    'inArray',
613    'isEmptyObject'
614  ], function(i, method) {
615    JQueryAdapter[method] = $[method]
616  })
617
618  Waypoint.adapters.push({
619    name: 'jquery',
620    Adapter: JQueryAdapter
621  })
622  Waypoint.Adapter = JQueryAdapter
623}());
624(function() {
625  'use strict'
626
627  var Waypoint = window.Waypoint
628
629  function createExtension(framework) {
630    return function() {
631      var waypoints = []
632      var overrides = arguments[0]
633
634      if (framework.isFunction(arguments[0])) {
635        overrides = framework.extend({}, arguments[1])
636        overrides.handler = arguments[0]
637      }
638
639      this.each(function() {
640        var options = framework.extend({}, overrides, {
641          element: this
642        })
643        if (typeof options.context === 'string') {
644          options.context = framework(this).closest(options.context)[0]
645        }
646        waypoints.push(new Waypoint(options))
647      })
648
649      return waypoints
650    }
651  }
652
653  if (window.jQuery) {
654    window.jQuery.fn.waypoint = createExtension(window.jQuery)
655  }
656  if (window.Zepto) {
657    window.Zepto.fn.waypoint = createExtension(window.Zepto)
658  }
659}());
660
661
662// 动画效果
663window.RevealAnimation = (function(window, Waypoint, $) {
664  'use strict';
665  var self;
666
667  function RevealAnimation(config) {
668    self = this;
669    self.animations = {};
670    self.elements = [];
671    self.index = 1;
672    self.initialConfig = self.config = $.extend({}, self.defaults, config);
673    if (window.isMobile && !self.config.mobile || !self._isSupported()) {
674      self.destroy();
675      return;
676    }
677    setTimeout(function() {
678      self.init();
679    }, 100);
680  }
681  RevealAnimation.prototype = {
682    defaults: {
683      mobile: true,
684      repeat: true,
685      resultClass: 'zy-anim-result',
686      classPrefix: 'animated ',
687      animationMarker: '.zy-having-animation',
688      animationDataAttr: 'zy-animation'
689    },
690    init: function(config) {
691      var index,
692        animation,
693        $elems = $(self.config.animationMarker);
694      self.config = $.extend({}, self.initialConfig, config);
695      $.each($elems, function(i, el) {
696        if (self.elements.indexOf(el) === -1) {
697          index = self.index++;
698          animation = self.animations[index] = {
699            element: el
700          };
701          animation.animationFrame = null;
702          if (self.config.repeat) {
703            animation.reset = self._createResetWaypoint(el);
704          } else {
705            animation.reset = null;
706          }
707          self.elements.push(el);
708        } else {
709          animation = self._getAnimationByElement(el);
710          if (animation.waypoint) {
711            animation.waypoint.destroy();
712          }
713          self._stopRuningAnimation(animation);
714        }
715        animation.animationClass = self._createAnimationClass(el);
716        animation.waypoint = self._createWaypoint(el);
717        animation.seen = false;
718      });
719      self.pageLoadTimeout = window.setTimeout(function() {
720        Waypoint.refreshAll();
721      }, 3000);
722      if (!window.addEventListener) {
723        return;
724      }
725      window.addEventListener('load', function() {
726        if (self.pageLoadTimeout) {
727          window.clearTimeout(self.pageLoadTimeout);
728        }
729        Waypoint.refreshAll();
730      });
731    },
732    animate: function(animation) {
733      if (!animation || animation.seen || !animation.animationClass) {
734        return false;
735      }
736      var $el = $(animation.element);
737      self._stopRuningAnimation(animation);
738      $el.removeClass(self.config.resultClass);
739      $el.addClass(animation.animationClass);
740      animation.animationFrame = window.requestAnimationFrame(function() {
741        $el.addClass(self.config.resultClass);
742        $el.on('animationend webkitAnimationEnd oAnimationEnd oanimationend MSAnimationEnd', function(e) {
743          if ($el.is(e.target)) {
744            $el.removeClass(self.config.resultClass + ' ' + animation.animationClass);
745            animation.animationFrame = null;
746            $el.off('animationend webkitAnimationEnd oAnimationEnd oanimationend MSAnimationEnd');
747          }
748        });
749      });
750      animation.seen = true;
751      return true;
752    },
753    destroy: function() {
754      if (!self.animations) {
755        return;
756      }
757      for (var i in self.animations) {
758        if (self.animations.hasOwnProperty(i)) {
759          var animation = self.animations[i];
760          if (animation.waypoint) {
761            animation.waypoint.destroy();
762          }
763          if (animation.reset) {
764            animation.reset.destroy();
765          }
766          var $el = $(animation.element);
767          $el.removeClass(animation.animationClass);
768        }
769      }
770      self.waypoints = null;
771      self.elements = [];
772      self.animations = {};
773    },
774    _isSupported: function() {
775      var sensor = document.createElement('sensor'),
776        cssPrefixTransition = [
777          'webkit',
778          'Moz',
779          'O',
780          'transition'
781        ],
782        tests = (cssPrefixTransition.join('Transition,')).split(',');
783      for (var i = 0; i < tests.length; i++) {
784        if (tests[i] in sensor.style) {
785          return true;
786        }
787      }
788      return false;
789    },
790    _createAnimationClass: function(element) {
791      var animationString = element.getAttribute('data-' + self.config.animationDataAttr),
792        animationClass = '';
793      if (animationString) {
794        var animations = animationString.split(' ');
795        element.removeAttribute('data-' + self.config.animationDataAttr);
796        animations.forEach(function(animation) {
797          animationClass += (' ' + self.config.classPrefix + animation);
798        });
799      }
800      $(element).addClass(animationClass);
801      return animationClass.trim();
802    },
803    _createWaypoint: function(element) {
804      return new Waypoint({
805        element: element,
806        handler: function(direction) {
807          var animation = self._getAnimationByElement(this.element);
808          if (direction === 'down' && !animation.seen) {
809            if (!self.animate(animation) || !self.config.repeat) {
810              this.destroy();
811            }
812          }
813        },
814        offset: '90%'
815      });
816    },
817    _createResetWaypoint: function(element) {
818      return new Waypoint({
819        element: element,
820        handler: function(direction) {
821          if (direction === 'up') {
822            var animation = self._getAnimationByElement(this.element);
823            if (animation.seen) {
824              self._stopRuningAnimation(animation);
825              $(this.element).addClass(animation.animationClass);
826              animation.seen = false;
827            }
828          }
829        },
830        offset: '100%'
831      });
832    },
833    _getAnimationByElement: function(element) {
834      for (var i in self.animations) {
835        if (self.animations[i].element === element) {
836          return self.animations[i];
837        }
838      }
839      return false;
840    },
841    _stopRuningAnimation: function(animation) {
842      if (animation.animationFrame) {
843        var $el = $(animation.element);
844        $el.removeClass(self.config.resultClass + ' ' + animation.animationClass);
845        $el.off('animationend webkitAnimationEnd oAnimationEnd oanimationend MSAnimationEnd');
846        window.cancelAnimationFrame(animation);
847        animation.animationFrame = null;
848      }
849    }
850  };
851  return RevealAnimation;
852})(window, window.Waypoint, window.jQuery);

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.