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