PageSourceSearch

https://www.shinyei-shc.co.jp/js/wow.js

js shinyei-shc.co.jp collected 2026-10-05 08:42:56 UTC 15,271 bytes, 511 lines download raw bytes

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