PageSourceSearch

https://different.com.mk/javascripts/wow.js

js different.com.mk collected 2026-10-09 00:34:08 UTC 5,103 bytes, 157 lines download raw bytes

1(function() {
2  var extend,
3    __slice = [].slice,
4    __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
5
6  extend = function() {
7    var args, key, object, replacement, result, value, _i, _len, _ref;
8    object = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
9    result = object || {};
10    for (_i = 0, _len = args.length; _i < _len; _i++) {
11      replacement = args[_i];
12      _ref = replacement || {};
13      for (key in _ref) {
14        value = _ref[key];
15        if (typeof result[key] === "object") {
16          result[key] = extend(result[key], value);
17        } else {
18          result[key] || (result[key] = value);
19        }
20      }
21    }
22    return result;
23  };
24
25  this.WOW = (function() {
26    WOW.prototype.defaults = {
27      boxClass: 'wow',
28      animateClass: 'animated',
29      offset: 0
30    };
31
32    function WOW(options) {
33      if (options == null) {
34        options = {};
35      }
36      this.scrollCallback = __bind(this.scrollCallback, this);
37      this.scrollHandler = __bind(this.scrollHandler, this);
38      this.start = __bind(this.start, this);
39      this.config = extend(options, this.defaults);
40      this.scrolled = true;
41    }
42
43    WOW.prototype.init = function() {
44      if (document.readyState === "complete") {
45        return this.start();
46      } else {
47        return document.addEventListener('DOMContentLoaded', this.start);
48      }
49    };
50
51    WOW.prototype.start = function() {
52      var box, _i, _len, _ref;
53      this.element = window.document.documentElement;
54      this.boxes = this.element.getElementsByClassName(this.config.boxClass);
55      if (this.boxes.length) {
56        _ref = this.boxes;
57        for (_i = 0, _len = _ref.length; _i < _len; _i++) {
58          box = _ref[_i];
59          this.applyStyle(box, true);
60        }
61        window.addEventListener('scroll', this.scrollHandler, false);
62        window.addEventListener('resize', this.scrollHandler, false);
63        return this.interval = setInterval(this.scrollCallback, 50);
64      }
65    };
66
67    WOW.prototype.stop = function() {
68      window.removeEventListener('scroll', this.scrollHandler, false);
69      window.removeEventListener('resize', this.scrollHandler, false);
70      if (this.interval != null) {
71        return clearInterval(this.interval);
72      }
73    };
74
75    WOW.prototype.show = function(box) {
76      this.applyStyle(box);
77      return box.className = "" + box.className + " " + this.config.animateClass;
78    };
79
80    WOW.prototype.applyStyle = function(box, hidden) {
81      var delay, duration, iteration;
82      duration = box.getAttribute('data-wow-duration');
83      delay = box.getAttribute('data-wow-delay');
84      iteration = box.getAttribute('data-wow-iteration');
85      return box.setAttribute('style', this.customStyle(hidden, duration, delay, iteration));
86    };
87
88    WOW.prototype.customStyle = function(hidden, duration, delay, iteration) {
89      var style;
90      style = hidden ? "visibility: hidden; -webkit-animation-name: none; -moz-animation-name: none; animation-name: none;" : "visibility: visible;";
91      if (duration) {
92        style += "-webkit-animation-duration: " + duration + "; -moz-animation-duration: " + duration + "; animation-duration: " + duration + ";";
93      }
94      if (delay) {
95        style += "-webkit-animation-delay: " + delay + "; -moz-animation-delay: " + delay + "; animation-delay: " + delay + ";";
96      }
97      if (iteration) {
98        style += "-webkit-animation-iteration-count: " + iteration + "; -moz-animation-iteration-count: " + iteration + "; animation-iteration-count: " + iteration + ";";
99      }
100      return style;
101    };
102
103    WOW.prototype.scrollHandler = function() {
104      return this.scrolled = true;
105    };
106
107    WOW.prototype.scrollCallback = function() {
108      var box;
109      if (this.scrolled) {
110        this.scrolled = false;
111        this.boxes = (function() {
112          var _i, _len, _ref, _results;
113          _ref = this.boxes;
114          _results = [];
115          for (_i = 0, _len = _ref.length; _i < _len; _i++) {
116            box = _ref[_i];
117            if (!(box)) {
118              continue;
119            }
120            if (this.isVisible(box)) {
121              this.show(box);
122              continue;
123            }
124            _results.push(box);
125          }
126          return _results;
127        }).call(this);
128        if (!this.boxes.length) {
129          return this.stop();
130        }
131      }
132    };
133
134    WOW.prototype.offsetTop = function(element) {
135      var top;
136      top = element.offsetTop;
137      while (element = element.offsetParent) {
138        top += element.offsetTop;
139      }
140      return top;
141    };
142
143    WOW.prototype.isVisible = function(box) {
144      var bottom, offset, top, viewBottom, viewTop;
145      offset = box.getAttribute('data-wow-offset') || this.config.offset;
146      viewTop = window.pageYOffset;
147      viewBottom = viewTop + this.element.clientHeight - offset;
148      top = this.offsetTop(box);
149      bottom = top + box.clientHeight;
150      return top <= viewBottom && bottom >= viewTop;
151    };
152
153    return WOW;
154
155  })();
156
157}).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.