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