1(function() { 2 var Util, 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 this.WOW = (function() { 28 WOW.prototype.defaults = { 29 boxClass: 'wow', 30 animateClass: 'animated', 31 offset: 0, 32 mobile: true 33 }; 34 35 function WOW(options) { 36 if (options == null) { 37 options = {}; 38 } 39 this.scrollCallback = __bind(this.scrollCallback, this); 40 this.scrollHandler = __bind(this.scrollHandler, this); 41 this.start = __bind(this.start, this); 42 this.scrolled = true; 43 this.config = this.util().extend(options, this.defaults); 44 } 45 46 WOW.prototype.init = function() { 47 var _ref; 48 this.element = window.document.documentElement; 49 if ((_ref = document.readyState) === "interactive" || _ref === "complete") { 50 return this.start(); 51 } else { 52 return document.addEventListener('DOMContentLoaded', this.start); 53 } 54 }; 55 56 WOW.prototype.start = function() { 57 var box, _i, _len, _ref; 58 this.boxes = this.element.getElementsByClassName(this.config.boxClass); 59 if (this.boxes.length) { 60 if (this.disabled()) { 61 return this.resetStyle(); 62 } else { 63 _ref = this.boxes; 64 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 65 box = _ref[_i]; 66 this.applyStyle(box, true); 67 } 68 window.addEventListener('scroll', this.scrollHandler, false); 69 window.addEventListener('resize', this.scrollHandler, false); 70 return this.interval = setInterval(this.scrollCallback, 50); 71 } 72 } 73 }; 74 75 WOW.prototype.stop = function() { 76 window.removeEventListener('scroll', this.scrollHandler, false); 77 window.removeEventListener('resize', this.scrollHandler, false); 78 if (this.interval != null) { 79 return clearInterval(this.interval); 80 } 81 }; 82 83 WOW.prototype.show = function(box) { 84 this.applyStyle(box); 85 return box.className = "" + box.className + " " + this.config.animateClass; 86 }; 87 88 WOW.prototype.applyStyle = function(box, hidden) { 89 var delay, duration, iteration; 90 duration = box.getAttribute('data-wow-duration'); 91 delay = box.getAttribute('data-wow-delay'); 92 iteration = box.getAttribute('data-wow-iteration'); 93 return box.setAttribute('style', this.customStyle(hidden, duration, delay, iteration)); 94 }; 95 96 WOW.prototype.resetStyle = function() { 97 var box, _i, _len, _ref, _results; 98 _ref = this.boxes; 99 _results = []; 100 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 101 box = _ref[_i]; 102 _results.push(box.setAttribute('style', 'visibility: visible;')); 103 } 104 return _results; 105 }; 106 107 WOW.prototype.customStyle = function(hidden, duration, delay, iteration) { 108 var style; 109 style = hidden ? "visibility: hidden; -webkit-animation-name: none; -moz-animation-name: none; animation-name: none;" : "visibility: visible;"; 110 if (duration) { 111 style += "-webkit-animation-duration: " + duration + "; -moz-animation-duration: " + duration + "; animation-duration: " + duration + ";"; 112 } 113 if (delay) { 114 style += "-webkit-animation-delay: " + delay + "; -moz-animation-delay: " + delay + "; animation-delay: " + delay + ";"; 115 } 116 if (iteration) { 117 style += "-webkit-animation-iteration-count: " + iteration + "; -moz-animation-iteration-count: " + iteration + "; animation-iteration-count: " + iteration + ";"; 118 } 119 return style; 120 }; 121 122 WOW.prototype.scrollHandler = function() { 123 return this.scrolled = true; 124 }; 125 126 WOW.prototype.scrollCallback = function() { 127 var box; 128 if (this.scrolled) { 129 this.scrolled = false;
130 this.boxes = (function() { 131 var _i, _len, _ref, _results; 132 _ref = this.boxes; 133 _results = []; 134 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 135 box = _ref[_i]; 136 if (!(box)) { 137 continue; 138 } 139 if (this.isVisible(box)) { 140 this.show(box); 141 continue; 142 } 143 _results.push(box); 144 } 145 return _results; 146 }).call(this); 147 if (!this.boxes.length) { 148 return this.stop(); 149 } 150 } 151 }; 152 153 WOW.prototype.offsetTop = function(element) { 154 var top; 155 top = element.offsetTop; 156 while (element = element.offsetParent) { 157 top += element.offsetTop; 158 } 159 return top; 160 }; 161 162 WOW.prototype.isVisible = function(box) { 163 var bottom, offset, top, viewBottom, viewTop; 164 offset = box.getAttribute('data-wow-offset') || this.config.offset; 165 viewTop = window.pageYOffset; 166 viewBottom = viewTop + this.element.clientHeight - offset; 167 top = this.offsetTop(box); 168 bottom = top + box.clientHeight; 169 return top <= viewBottom && bottom >= viewTop; 170 }; 171 172 WOW.prototype.util = function() { 173 return this._util || (this._util = new Util()); 174 }; 175 176 WOW.prototype.disabled = function() { 177 return !this.config.mobile && this.util().isMobile(navigator.userAgent); 178 }; 179 180 return WOW; 181 182 })(); 183 184}).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.