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 custom) { 12 value = custom[key]; 13 if (value != null) { 14 defaults[key] = value; 15 } 16 } 17 return defaults; 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 = this.element.getElementsByClassName(this.config.boxClass); 113 this.all = (function() { 114 var _i, _len, _ref, _results; 115 _ref = this.boxes; 116 _results = []; 117 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 118 box = _ref[_i]; 119 _results.push(box); 120 } 121 return _results; 122 }).call(this); 123 if (this.boxes.length) { 124 if (this.disabled()) { 125 this.resetStyle(); 126 } else { 127 _ref = this.boxes; 128 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 129 box = _ref[_i]; 130 this.applyStyle(box, true); 131 } 132 window.addEventListener('scroll', this.scrollHandler, false); 133 window.addEventListener('resize', this.scrollHandler, false); 134 this.interval = setInterval(this.scrollCallback, 50); 135 } 136 } 137 if (this.config.live) { 138 return new MutationObserver((function(_this) { 139 return function(records) { 140 var node, record, _j, _len1, _results; 141 _results = []; 142 for (_j = 0, _len1 = records.length; _j < _len1; _j++) { 143 record = records[_j]; 144 _results.push((function() { 145 var _k, _len2, _ref1, _results1; 146 _ref1 = record.addedNodes || []; 147 _results1 = []; 148 for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) { 149 node = _ref1[_k]; 150 _results1.push(this.doSync(node)); 151 } 152 return _results1; 153 }).call(_this)); 154 } 155 return _results; 156 }; 157 })(this)).observe(document.body, { 158 childList: true, 159 subtree: true 160 }); 161 } 162 }; 163 164 WOW.prototype.stop = function() { 165 this.stopped = true; 166 window.removeEventListener('scroll', this.scrollHandler, false); 167 window.removeEventListener('resize', this.scrollHandler, false); 168 if (this.interval != null) { 169 return clearInterval(this.interval); 170 } 171 }; 172 173 WOW.prototype.sync = function(element) { 174 if (MutationObserver.notSupported) { 175 return this.doSync(this.element); 176 } 177 }; 178 179 WOW.prototype.doSync = function(element) { 180 var box, _i, _len, _ref, _results; 181 if (!this.stopped) { 182 element || (element = this.element); 183 element = element.parentNode || element; 184 _ref = element.getElementsByClassName(this.config.boxClass); 185 _results = []; 186 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 187 box = _ref[_i]; 188 if (__indexOf.call(this.all, box) < 0) { 189 this.applyStyle(box, true); 190 this.boxes.push(box); 191 this.all.push(box); 192 _results.push(this.scrolled = true); 193 } else { 194 _results.push(void 0); 195 } 196 } 197 return _results; 198 } 199 }; 200 201 WOW.prototype.show = function(box) { 202 this.applyStyle(box); 203 return box.className = "" + box.className + " " + this.config.animateClass; 204 }; 205 206 WOW.prototype.applyStyle = function(box, hidden) { 207 var delay, duration, iteration; 208 duration = box.getAttribute('data-wow-duration');
vendor: 4,563 bytes, lines 209-366
209 delay = box.getAttribute('data-wow-delay'); 210 iteration = box.getAttribute('data-wow-iteration'); 211 return this.animate((function(_this) { 212 return function() { 213 return _this.customStyle(box, hidden, duration, delay, iteration); 214 }; 215 })(this)); 216 }; 217 218 WOW.prototype.animate = (function() { 219 if ('requestAnimationFrame' in window) { 220 return function(callback) { 221 return window.requestAnimationFrame(callback); 222 }; 223 } else { 224 return function(callback) { 225 return callback(); 226 }; 227 } 228 })(); 229 230 WOW.prototype.resetStyle = function() { 231 var box, _i, _len, _ref, _results; 232 _ref = this.boxes; 233 _results = []; 234 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 235 box = _ref[_i]; 236 _results.push(box.setAttribute('style', 'visibility: visible;')); 237 } 238 return _results; 239 }; 240 241 WOW.prototype.customStyle = function(box, hidden, duration, delay, iteration) { 242 if (hidden) { 243 this.cacheAnimationName(box); 244 } 245 box.style.visibility = hidden ? 'hidden' : 'visible'; 246 if (duration) { 247 this.vendorSet(box.style, { 248 animationDuration: duration 249 }); 250 } 251 if (delay) { 252 this.vendorSet(box.style, { 253 animationDelay: delay 254 }); 255 } 256 if (iteration) { 257 this.vendorSet(box.style, { 258 animationIterationCount: iteration 259 }); 260 } 261 this.vendorSet(box.style, { 262 animationName: hidden ? 'none' : this.cachedAnimationName(box) 263 }); 264 return box; 265 }; 266 267 WOW.prototype.vendors = ["moz", "webkit"]; 268 269 WOW.prototype.vendorSet = function(elem, properties) { 270 var name, value, vendor, _results; 271 _results = []; 272 for (name in properties) { 273 value = properties[name]; 274 elem["" + name] = value; 275 _results.push((function() { 276 var _i, _len, _ref, _results1; 277 _ref = this.vendors; 278 _results1 = []; 279 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 280 vendor = _ref[_i]; 281 _results1.push(elem["" + vendor + (name.charAt(0).toUpperCase()) + (name.substr(1))] = value); 282 } 283 return _results1; 284 }).call(this)); 285 } 286 return _results; 287 }; 288 289 WOW.prototype.vendorCSS = function(elem, property) { 290 var result, style, vendor, _i, _len, _ref; 291 style = window.getComputedStyle(elem); 292 result = style.getPropertyCSSValue(property); 293 _ref = this.vendors; 294 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 295 vendor = _ref[_i]; 296 result = result || style.getPropertyCSSValue("-" + vendor + "-" + property); 297 } 298 return result; 299 }; 300 301 WOW.prototype.animationName = function(box) { 302 var animationName; 303 try { 304 animationName = this.vendorCSS(box, 'animation-name').cssText; 305 } catch (_error) { 306 animationName = window.getComputedStyle(box).getPropertyValue('animation-name'); 307 } 308 if (animationName === 'none') { 309 return ''; 310 } else { 311 return animationName; 312 } 313 }; 314 315 WOW.prototype.cacheAnimationName = function(box) { 316 return this.animationNameCache.set(box, this.animationName(box)); 317 }; 318 319 WOW.prototype.cachedAnimationName = function(box) { 320 return this.animationNameCache.get(box); 321 }; 322 323 WOW.prototype.scrollHandler = function() { 324 return this.scrolled = true; 325 }; 326 327 WOW.prototype.scrollCallback = function() { 328 var box; 329 if (this.scrolled) { 330 this.scrolled = false; 331 this.boxes = (function() { 332 var _i, _len, _ref, _results; 333 _ref = this.boxes; 334 _results = []; 335 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 336 box = _ref[_i]; 337 if (!(box)) { 338 continue; 339 } 340 if (this.isVisible(box)) { 341 this.show(box); 342 continue; 343 } 344 _results.push(box); 345 } 346 return _results; 347 }).call(this); 348 if (!(this.boxes.length || this.config.live)) { 349 return this.stop(); 350 } 351 } 352 }; 353 354 WOW.prototype.offsetTop = function(element) { 355 var top; 356 while (element.offsetTop === void 0) { 357 element = element.parentNode; 358 } 359 top = element.offsetTop; 360 while (element = element.offsetParent) { 361 top += element.offsetTop; 362 } 363 return top; 364 }; 365 366 WOW.prototype.isVisible = function(box) {
367 var bottom, offset, top, viewBottom, viewTop; 368 offset = box.getAttribute('data-wow-offset') || this.config.offset; 369 viewTop = window.pageYOffset; 370 viewBottom = viewTop + this.element.clientHeight - offset; 371 top = this.offsetTop(box); 372 bottom = top + box.clientHeight; 373 return top <= viewBottom && bottom >= viewTop; 374 }; 375 376 WOW.prototype.util = function() { 377 return this._util || (this._util = new Util()); 378 }; 379 380 WOW.prototype.disabled = function() { 381 return !this.config.mobile && this.util().isMobile(navigator.userAgent); 382 }; 383 384 return WOW; 385 386 })(); 387 388}).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.