PageSourceSearch

https://www.adamshendry.co.uk/wp-content/themes/uranus-theme/js/wow.js?ver=1

js adamshendry.co.uk collected 2026-10-03 02:06:44 UTC 9,025 bytes, 306 lines download raw bytes

1(function() {
2  var Util, WeakMap,
3    __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
4
5  Util = (function() {
6    function Util() {}
7
8    Util.prototype.extend = function(custom, defaults) {
9      var key, value;
10      for (key in custom) {
11        value = custom[key];
12        if (value != null) {
13          defaults[key] = value;
14        }
15      }
16      return defaults;
17    };
18
19    Util.prototype.isMobile = function(agent) {
20      return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(agent);
21    };
22
23    return Util;
24
25  })();
26
27  WeakMap = this.WeakMap || (WeakMap = (function() {
28    function WeakMap() {
29      this.keys = [];
30      this.values = [];
31    }
32
33    WeakMap.prototype.get = function(key) {
34      var i, item, _i, _len, _ref;
35      _ref = this.keys;
36      for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
37        item = _ref[i];
38        if (item === key) {
39          return this.values[i];
40        }
41      }
42    };
43
44    WeakMap.prototype.set = function(key, value) {
45      var i, item, _i, _len, _ref;
46      _ref = this.keys;
47      for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
48        item = _ref[i];
49        if (item === key) {
50          this.values[i] = value;
51          return;
52        }
53      }
54      this.keys.push(key);
55      return this.values.push(value);
56    };
57
58    return WeakMap;
59
60  })());
61
62  this.WOW = (function() {
63    WOW.prototype.defaults = {
64      boxClass: 'wow',
65      animateClass: 'animated',
66      offset: 0,
67      mobile: true
68    };
69
70    function WOW(options) {
71      if (options == null) {
72        options = {};
73      }
74      this.scrollCallback = __bind(this.scrollCallback, this);
75      this.scrollHandler = __bind(this.scrollHandler, this);
76      this.start = __bind(this.start, this);
77      this.scrolled = true;
78      this.config = this.util().extend(options, this.defaults);
79      this.animationNameCache = new WeakMap();
80    }
81
82    WOW.prototype.init = function() {
83      var _ref;
84      this.element = window.document.documentElement;
85      if ((_ref = document.readyState) === "interactive" || _ref === "complete") {
86        return this.start();
87      } else {
88        return document.addEventListener('DOMContentLoaded', this.start);
89      }
90    };
91
92    WOW.prototype.start = function() {
93      var box, _i, _len, _ref;
94      this.boxes = this.element.getElementsByClassName(this.config.boxClass);
95      if (this.boxes.length) {
96        if (this.disabled()) {
97          return this.resetStyle();
98        } else {
99          _ref = this.boxes;
100          for (_i = 0, _len = _ref.length; _i < _len; _i++) {
101            box = _ref[_i];
102            this.applyStyle(box, true);
103          }
104          window.addEventListener('scroll', this.scrollHandler, false);
105          window.addEventListener('resize', this.scrollHandler, false);
106          return this.interval = setInterval(this.scrollCallback, 50);
107        }
108      }
109    };
110
111    WOW.prototype.stop = function() {
112      window.removeEventListener('scroll', this.scrollHandler, false);
113      window.removeEventListener('resize', this.scrollHandler, false);
114      if (this.interval != null) {
115        return clearInterval(this.interval);
116      }
117    };
118
119    WOW.prototype.show = function(box) {
120      this.applyStyle(box);
121      return box.className = "" + box.className + " " + this.config.animateClass;
122    };
123
124    WOW.prototype.applyStyle = function(box, hidden) {
125      var delay, duration, iteration;
126      duration = box.getAttribute('data-wow-duration');
127      delay = box.getAttribute('data-wow-delay');
128      iteration = box.getAttribute('data-wow-iteration');
129      return this.animate((function(_this) {
130        return function() {
131          return _this.customStyle(box, hidden, duration, delay, iteration);
132        };
133      })(this));
134    };
135
136    WOW.prototype.animate = (function() {
137      if ('requestAnimationFrame' in window) {
138        return function(callback) {
139          return window.requestAnimationFrame(callback);
140        };
141      } else {
142        return function(callback) {
143          return callback();
144        };
145      }
146    })();
147
148    WOW.prototype.resetStyle = function() {
149      var box, _i, _len, _ref, _results;
150      _ref = this.boxes;
151      _results = [];
152      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
153        box = _ref[_i];
154        _results.push(box.setAttribute('style', 'visibility: visible;'));
vendor: 4,421 bytes, lines 155-304
155      }
156      return _results;
157    };
158
159    WOW.prototype.customStyle = function(box, hidden, duration, delay, iteration) {
160      if (hidden) {
161        this.cacheAnimationName(box);
162      }
163      box.style.visibility = hidden ? 'hidden' : 'visible';
164      if (duration) {
165        this.vendorSet(box.style, {
166          animationDuration: duration
167        });
168      }
169      if (delay) {
170        this.vendorSet(box.style, {
171          animationDelay: delay
172        });
173      }
174      if (iteration) {
175        this.vendorSet(box.style, {
176          animationIterationCount: iteration
177        });
178      }
179      this.vendorSet(box.style, {
180        animationName: hidden ? 'none' : this.cachedAnimationName(box)
181      });
182      return box;
183    };
184
185    WOW.prototype.vendors = ["moz", "webkit"];
186
187    WOW.prototype.vendorSet = function(elem, properties) {
188      var name, value, vendor, _results;
189      _results = [];
190      for (name in properties) {
191        value = properties[name];
192        elem["" + name] = value;
193        _results.push((function() {
194          var _i, _len, _ref, _results1;
195          _ref = this.vendors;
196          _results1 = [];
197          for (_i = 0, _len = _ref.length; _i < _len; _i++) {
198            vendor = _ref[_i];
199            _results1.push(elem["" + vendor + (name.charAt(0).toUpperCase()) + (name.substr(1))] = value);
200          }
201          return _results1;
202        }).call(this));
203      }
204      return _results;
205    };
206
207    WOW.prototype.vendorCSS = function(elem, property) {
208      var result, style, vendor, _i, _len, _ref;
209      style = window.getComputedStyle(elem);
210      result = style.getPropertyCSSValue(property);
211      _ref = this.vendors;
212      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
213        vendor = _ref[_i];
214        result = result || style.getPropertyCSSValue("-" + vendor + "-" + property);
215      }
216      return result;
217    };
218
219    WOW.prototype.animationName = function(box) {
220      var animationName;
221      try {
222        animationName = this.vendorCSS(box, 'animation-name').cssText;
223      } catch (_error) {
224        animationName = window.getComputedStyle(box).getPropertyValue('animation-name');
225      }
226      if (animationName === 'none') {
227        return '';
228      } else {
229        return animationName;
230      }
231    };
232
233    WOW.prototype.cacheAnimationName = function(box) {
234      return this.animationNameCache.set(box, this.animationName(box));
235    };
236
237    WOW.prototype.cachedAnimationName = function(box) {
238      return this.animationNameCache.get(box);
239    };
240
241    WOW.prototype.scrollHandler = function() {
242      return this.scrolled = true;
243    };
244
245    WOW.prototype.scrollCallback = function() {
246      var box;
247      if (this.scrolled) {
248        this.scrolled = false;
249        this.boxes = (function() {
250          var _i, _len, _ref, _results;
251          _ref = this.boxes;
252          _results = [];
253          for (_i = 0, _len = _ref.length; _i < _len; _i++) {
254            box = _ref[_i];
255            if (!(box)) {
256              continue;
257            }
258            if (this.isVisible(box)) {
259              this.show(box);
260              continue;
261            }
262            _results.push(box);
263          }
264          return _results;
265        }).call(this);
266        if (!this.boxes.length) {
267          return this.stop();
268        }
269      }
270    };
271
272    WOW.prototype.offsetTop = function(element) {
273      var top;
274      while (element.offsetTop === void 0) {
275        element = element.parentNode;
276      }
277      top = element.offsetTop;
278      while (element = element.offsetParent) {
279        top += element.offsetTop;
280      }
281      return top;
282    };
283
284    WOW.prototype.isVisible = function(box) {
285      var bottom, offset, top, viewBottom, viewTop;
286      offset = box.getAttribute('data-wow-offset') || this.config.offset;
287      viewTop = window.pageYOffset;
288      viewBottom = viewTop + this.element.clientHeight - offset;
289      top = this.offsetTop(box);
290      bottom = top + box.clientHeight;
291      return top <= viewBottom && bottom >= viewTop;
292    };
293
294    WOW.prototype.util = function() {
295      return this._util || (this._util = new Util());
296    };
297
298    WOW.prototype.disabled = function() {
299      return !this.config.mobile && this.util().isMobile(navigator.userAgent);
300    };
301
302    return WOW;
303
304  })();
305
306}).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.