PageSourceSearch

https://www.mhlconsortium.org/js/wow.js

js mhlconsortium.org collected 2026-09-24 19:06:25 UTC 13,494 bytes, 452 lines download raw bytes

vendor: 13,494 bytes, lines 1-452
1(function() {
2  var MutationObserver, Util, WeakMap, getComputedStyle, getComputedStyleRX,
3    __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
4    __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
5
6  Util = (function() {
7    function Util() {}
8
9    Util.prototype.extend = function(custom, defaults) {
10      var key, value;
11      for (key in defaults) {
12        value = defaults[key];
13        if (custom[key] == null) {
14          custom[key] = value;
15        }
16      }
17      return custom;
18    };
19
20    Util.prototype.isMobile = function(agent) {
21      return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(agent);
22    };
23
24    Util.prototype.addEvent = function(elem, event, fn) {
25      if (elem.addEventListener != null) {
26        return elem.addEventListener(event, fn, false);
27      } else if (elem.attachEvent != null) {
28        return elem.attachEvent("on" + event, fn);
29      } else {
30        return elem[event] = fn;
31      }
32    };
33
34    Util.prototype.removeEvent = function(elem, event, fn) {
35      if (elem.removeEventListener != null) {
36        return elem.removeEventListener(event, fn, false);
37      } else if (elem.detachEvent != null) {
38        return elem.detachEvent("on" + event, fn);
39      } else {
40        return delete elem[event];
41      }
42    };
43
44    Util.prototype.innerHeight = function() {
45      if ('innerHeight' in window) {
46        return window.innerHeight;
47      } else {
48        return document.documentElement.clientHeight;
49      }
50    };
51
52    return Util;
53
54  })();
55
56  WeakMap = this.WeakMap || this.MozWeakMap || (WeakMap = (function() {
57    function WeakMap() {
58      this.keys = [];
59      this.values = [];
60    }
61
62    WeakMap.prototype.get = function(key) {
63      var i, item, _i, _len, _ref;
64      _ref = this.keys;
65      for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
66        item = _ref[i];
67        if (item === key) {
68          return this.values[i];
69        }
70      }
71    };
72
73    WeakMap.prototype.set = function(key, value) {
74      var i, item, _i, _len, _ref;
75      _ref = this.keys;
76      for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
77        item = _ref[i];
78        if (item === key) {
79          this.values[i] = value;
80          return;
81        }
82      }
83      this.keys.push(key);
84      return this.values.push(value);
85    };
86
87    return WeakMap;
88
89  })());
90
91  MutationObserver = this.MutationObserver || this.WebkitMutationObserver || this.MozMutationObserver || (MutationObserver = (function() {
92    function MutationObserver() {
93      if (typeof console !== "undefined" && console !== null) {
94        console.warn('MutationObserver is not supported by your browser.');
95      }
96      if (typeof console !== "undefined" && console !== null) {
97        console.warn('WOW.js cannot detect dom mutations, please call .sync() after loading new content.');
98      }
99    }
100
101    MutationObserver.notSupported = true;
102
103    MutationObserver.prototype.observe = function() {};
104
105    return MutationObserver;
106
107  })());
108
109  getComputedStyle = this.getComputedStyle || function(el, pseudo) {
110    this.getPropertyValue = function(prop) {
111      var _ref;
112      if (prop === 'float') {
113        prop = 'styleFloat';
114      }
115      if (getComputedStyleRX.test(prop)) {
116        prop.replace(getComputedStyleRX, function(_, char) {
117          return char.toUpperCase();
118        });
119      }
120      return ((_ref = el.currentStyle) != null ? _ref[prop] : void 0) || null;
121    };
122    return this;
123  };
124
125  getComputedStyleRX = /(\-([a-z]){1})/g;
126
127  this.WOW = (function() {
128    WOW.prototype.defaults = {
129      boxClass: 'wow',
130      animateClass: 'animated',
131      offset: 0,
132      mobile: true,
133      live: true
134    };
135
136    function WOW(options) {
137      if (options == null) {
138        options = {};
139      }
140      this.scrollCallback = __bind(this.scrollCallback, this);
141      this.scrollHandler = __bind(this.scrollHandler, this);
142      this.start = __bind(this.start, this);
143      this.scrolled = true;
144      this.config = this.util().extend(options, this.defaults);
145      this.animationNameCache = new WeakMap();
146    }
147
148    WOW.prototype.init = function() {
149      var _ref;
150      this.element = window.document.documentElement;
151      if ((_ref = document.readyState) === "interactive" || _ref === "complete") {
152        this.start();
153      } else {
154        this.util().addEvent(document, 'DOMContentLoaded', this.start);
155      }
156      return this.finished = [];
157    };
158
159    WOW.prototype.start = function() {
160      var box, _i, _len, _ref;
161      this.stopped = false;
162      this.boxes = (function() {
163        var _i, _len, _ref, _results;
164        _ref = this.element.querySelectorAll("." + this.config.boxClass);
165        _results = [];
166        for (_i = 0, _len = _ref.length; _i < _len; _i++) {
167          box = _ref[_i];
168          _results.push(box);
169        }
170        return _results;
171      }).call(this);
172      this.all = (function() {
173        var _i, _len, _ref, _results;
174        _ref = this.boxes;
175        _results = [];
176        for (_i = 0, _len = _ref.length; _i < _len; _i++) {
177          box = _ref[_i];
178          _results.push(box);
179        }
180        return _results;
181      }).call(this);
182      if (this.boxes.length) {
183        if (this.disabled()) {
184          this.resetStyle();
185        } else {
186          _ref = this.boxes;
187          for (_i = 0, _len = _ref.length; _i < _len; _i++) {
188            box = _ref[_i];
189            this.applyStyle(box, true);
190          }
191          this.util().addEvent(window, 'scroll', this.scrollHandler);
192          this.util().addEvent(window, 'resize', this.scrollHandler);
193          this.interval = setInterval(this.scrollCallback, 50);
194        }
195      }
196      if (this.config.live) {
197        return new MutationObserver((function(_this) {
198          return function(records) {
199            var node, record, _j, _len1, _results;
200            _results = [];
201            for (_j = 0, _len1 = records.length; _j < _len1; _j++) {
202              record = records[_j];
203              _results.push((function() {
204                var _k, _len2, _ref1, _results1;
205                _ref1 = record.addedNodes || [];
206                _results1 = [];
207                for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {
208                  node = _ref1[_k];
209                  _results1.push(this.doSync(node));
210                }
211                return _results1;
212              }).call(_this));
213            }
214            return _results;
215          };
216        })(this)).observe(document.body, {
217          childList: true,
218          subtree: true
219        });
220      }
221    };
222
223    WOW.prototype.stop = function() {
224      this.stopped = true;
225      this.util().removeEvent(window, 'scroll', this.scrollHandler);
226      this.util().removeEvent(window, 'resize', this.scrollHandler);
227      if (this.interval != null) {
228        return clearInterval(this.interval);
229      }
230    };
231
232    WOW.prototype.sync = function(element) {
233      if (MutationObserver.notSupported) {
234        return this.doSync(this.element);
235      }
236    };
237
238    WOW.prototype.doSync = function(element) {
239      var box, _i, _len, _ref, _results;
240      if (!this.stopped) {
241        if (element == null) {
242          element = this.element;
243        }
244        if (element.nodeType !== 1) {
245          return;
246        }
247        element = element.parentNode || element;
248        _ref = element.querySelectorAll("." + this.config.boxClass);
249        _results = [];
250        for (_i = 0, _len = _ref.length; _i < _len; _i++) {
251          box = _ref[_i];
252          if (__indexOf.call(this.all, box) < 0) {
253            this.applyStyle(box, true);
254            this.boxes.push(box);
255            this.all.push(box);
256            _results.push(this.scrolled = true);
257          } else {
258            _results.push(void 0);
259          }
260        }
261        return _results;
262      }
263    };
264
265    WOW.prototype.show = function(box) {
266      this.applyStyle(box);
267      return box.className = "" + box.className + " " + this.config.animateClass;
268    };
269
270    WOW.prototype.applyStyle = function(box, hidden) {
271      var delay, duration, iteration;
272      duration = box.getAttribute('data-wow-duration');
273      delay = box.getAttribute('data-wow-delay');
274      iteration = box.getAttribute('data-wow-iteration');
275      return this.animate((function(_this) {
276        return function() {
277          return _this.customStyle(box, hidden, duration, delay, iteration);
278        };
279      })(this));
280    };
281
282    WOW.prototype.animate = (function() {
283      if ('requestAnimationFrame' in window) {
284        return function(callback) {
285          return window.requestAnimationFrame(callback);
286        };
287      } else {
288        return function(callback) {
289          return callback();
290        };
291      }
292    })();
293
294    WOW.prototype.resetStyle = function() {
295      var box, _i, _len, _ref, _results;
296      _ref = this.boxes;
297      _results = [];
298      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
299        box = _ref[_i];
300        _results.push(box.setAttribute('style', 'visibility: visible;'));
301      }
302      return _results;
303    };
304
305    WOW.prototype.customStyle = function(box, hidden, duration, delay, iteration) {
306      if (hidden) {
307        this.cacheAnimationName(box);
308      }
309      box.style.visibility = hidden ? 'hidden' : 'visible';
310      if (duration) {
311        this.vendorSet(box.style, {
312          animationDuration: duration
313        });
314      }
315      if (delay) {
316        this.vendorSet(box.style, {
317          animationDelay: delay
318        });
319      }
320      if (iteration) {
321        this.vendorSet(box.style, {
322          animationIterationCount: iteration
323        });
324      }
325      this.vendorSet(box.style, {
326        animationName: hidden ? 'none' : this.cachedAnimationName(box)
327      });
328      return box;
329    };
330
331    WOW.prototype.vendors = ["moz", "webkit"];
332
333    WOW.prototype.vendorSet = function(elem, properties) {
334      var name, value, vendor, _results;
335      _results = [];
336      for (name in properties) {
337        value = properties[name];
338        elem["" + name] = value;
339        _results.push((function() {
340          var _i, _len, _ref, _results1;
341          _ref = this.vendors;
342          _results1 = [];
343          for (_i = 0, _len = _ref.length; _i < _len; _i++) {
344            vendor = _ref[_i];
345            _results1.push(elem["" + vendor + (name.charAt(0).toUpperCase()) + (name.substr(1))] = value);
346          }
347          return _results1;
348        }).call(this));
349      }
350      return _results;
351    };
352
353    WOW.prototype.vendorCSS = function(elem, property) {
354      var result, style, vendor, _i, _len, _ref;
355      style = getComputedStyle(elem);
356      result = style.getPropertyCSSValue(property);
357      _ref = this.vendors;
358      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
359        vendor = _ref[_i];
360        result = result || style.getPropertyCSSValue("-" + vendor + "-" + property);
361      }
362      return result;
363    };
364
365    WOW.prototype.animationName = function(box) {
366      var animationName;
367      try {
368        animationName = this.vendorCSS(box, 'animation-name').cssText;
369      } catch (_error) {
370        animationName = getComputedStyle(box).getPropertyValue('animation-name');
371      }
372      if (animationName === 'none') {
373        return '';
374      } else {
375        return animationName;
376      }
377    };
378
379    WOW.prototype.cacheAnimationName = function(box) {
380      return this.animationNameCache.set(box, this.animationName(box));
381    };
382
383    WOW.prototype.cachedAnimationName = function(box) {
384      return this.animationNameCache.get(box);
385    };
386
387    WOW.prototype.scrollHandler = function() {
388      return this.scrolled = true;
389    };
390
391    WOW.prototype.scrollCallback = function() {
392      var box;
393      if (this.scrolled) {
394        this.scrolled = false;
395        this.boxes = (function() {
396          var _i, _len, _ref, _results;
397          _ref = this.boxes;
398          _results = [];
399          for (_i = 0, _len = _ref.length; _i < _len; _i++) {
400            box = _ref[_i];
401            if (!(box)) {
402              continue;
403            }
404            if (this.isVisible(box)) {
405              this.show(box);
406              continue;
407            }
408            _results.push(box);
409          }
410          return _results;
411        }).call(this);
412        if (!(this.boxes.length || this.config.live)) {
413          return this.stop();
414        }
415      }
416    };
417
418    WOW.prototype.offsetTop = function(element) {
419      var top;
420      while (element.offsetTop === void 0) {
421        element = element.parentNode;
422      }
423      top = element.offsetTop;
424      while (element = element.offsetParent) {
425        top += element.offsetTop;
426      }
427      return top;
428    };
429
430    WOW.prototype.isVisible = function(box) {
431      var bottom, offset, top, viewBottom, viewTop;
432      offset = box.getAttribute('data-wow-offset') || this.config.offset;
433      viewTop = window.pageYOffset;
434      viewBottom = viewTop + Math.min(this.element.clientHeight, this.util().innerHeight()) - offset;
435      top = this.offsetTop(box);
436      bottom = top + box.clientHeight;
437      return top <= viewBottom && bottom >= viewTop;
438    };
439
440    WOW.prototype.util = function() {
441      return this._util != null ? this._util : this._util = new Util();
442    };
443
444    WOW.prototype.disabled = function() {
445      return !this.config.mobile && this.util().isMobile(navigator.userAgent);
446    };
447
448    return WOW;
449
450  })();
451
452}).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.