PageSourceSearch

http://ctunestore.com/js/wow.js

js ctunestore.com collected 2026-10-02 01:26:51 UTC 11,953 bytes, 402 lines download raw bytes

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