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