(function() { var mutationobserver, util, weakmap, getcomputedstyle, getcomputedstylerx, bind = function(fn, me) { return function() { return fn.apply(me, arguments) } }, 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 }; util = (function() { function util() {} util.prototype.extend = function(custom, defaults) { var key, value; for (key in defaults) { value = defaults[key]; if (custom[key] == null) { custom[key] = value } } return custom }; util.prototype.ismobile = function(agent) { return /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(agent) }; util.prototype.createevent = function(event, bubble, cancel, detail) { var customevent; if (bubble == null) { bubble = false } if (cancel == null) { cancel = false } if (detail == null) { detail = null } if (document.createevent != null) { customevent = document.createevent('customevent'); customevent.initcustomevent(event, bubble, cancel, detail) } else if (document.createeventobject != null) { customevent = document.createeventobject(); customevent.eventtype = event } else { customevent.eventname = event } return customevent }; util.prototype.emitevent = function(elem, event) { if (elem.dispatchevent != null) { return elem.dispatchevent(event) } else if (event in (elem != null)) { return elem[event]() } else if (("on" + event) in (elem != null)) { return elem["on" + event]() } }; util.prototype.addevent = function(elem, event, fn) { if (elem.addeventlistener != null) { return elem.addeventlistener(event, fn, false) } else if (elem.attachevent != null) { return elem.attachevent("on" + event, fn) } else { return elem[event] = fn } }; util.prototype.removeevent = function(elem, event, fn) { if (elem.removeeventlistener != null) { return elem.removeeventlistener(event, fn, false) } else if (elem.detachevent != null) { return elem.detachevent("on" + event, fn) } else { return delete elem[event] } }; util.prototype.innerheight = function() { if ('innerheight' in window) { return window.innerheight } else { return document.documentelement.clientheight } }; return util })(); weakmap = this.weakmap || this.mozweakmap || (weakmap = (function() { function weakmap() { this.keys = []; this.values = [] } weakmap.prototype.get = function(key) { var i, item, j, len, ref; ref = this.keys; for (i = j = 0, len = ref.length; j < len; i = ++j) { item = ref[i]; if (item === key) { return this.values[i] } } }; weakmap.prototype.set = function(key, value) { var i, item, j, len, ref; ref = this.keys; for (i = j = 0, len = ref.length; j < len; i = ++j) { item = ref[i]; if (item === key) { this.values[i] = value; return } } this.keys.push(key); return this.values.push(value) }; return weakmap })()); mutationobserver = this.mutationobserver || this.webkitmutationobserver || this.mozmutationobserver || (mutationobserver = (function() { function mutationobserver() { if (typeof console !== "undefined" && console !== null) { console.warn('mutationobserver is not supported by your browser.') } if (typeof console !== "undefined" && console !== null) { console.warn('wow.js cannot detect dom mutations, please call .sync() after loading new content.') } } mutationobserver.notsupported = true; mutationobserver.prototype.observe = function() {}; return mutationobserver })()); getcomputedstyle = this.getcomputedstyle || function(el, pseudo) { this.getpropertyvalue = function(prop) { var ref; if (prop === 'float') { prop = 'stylefloat' } if (getcomputedstylerx.test(prop)) { prop.replace(getcomputedstylerx, function(_, _2) { return _2.touppercase() }) } return ((ref = el.currentstyle) != null ? ref[prop] : void 0) || null }; return this }; getcomputedstylerx = /(\-([a-z]){1})/g; this.wow = (function() { wow.prototype.defaults = { boxclass: 'wow', animateclass: 'animated', offset: 0, mobile: true, live: true, callback: null, scrollcontainer: null }; function wow(options) { if (options == null) { options = {} } this.scrollcallback = bind(this.scrollcallback, this); this.scrollhandler = bind(this.scrollhandler, this); this.resetanimation = bind(this.resetanimation, this); this.start = bind(this.start, this); this.scrolled = true; this.config = this.util().extend(options, this.defaults); if (options.scrollcontainer != null) { this.config.scrollcontainer = document.queryselector(options.scrollcontainer) } this.animationnamecache = new weakmap(); this.wowevent = this.util().createevent(this.config.boxclass) } wow.prototype.init = function() { var ref; this.element = window.document.documentelement; if ((ref = document.readystate) === "interactive" || ref === "complete") { this.start() } else { this.util().addevent(document, 'domcontentloaded', this.start) } return this.finished = [] }; wow.prototype.start = function() { var box, j, len, ref; this.stopped = false; this.boxes = (function() { var j, len, ref, results; ref = this.element.queryselectorall("." + this.config.boxclass); results = []; for (j = 0, len = ref.length; j < len; j++) { box = ref[j]; results.push(box) } return results }).call(this); this.all = (function() { var j, len, ref, results; ref = this.boxes; results = []; for (j = 0, len = ref.length; j < len; j++) { box = ref[j]; results.push(box) } return results }).call(this); if (this.boxes.length) { if (this.disabled()) { this.resetstyle() } else { ref = this.boxes; for (j = 0, len = ref.length; j < len; j++) { box = ref[j]; this.applystyle(box, true) } } } if (!this.disabled()) { this.util().addevent(this.config.scrollcontainer || window, 'scroll', this.scrollhandler); this.util().addevent(window, 'resize', this.scrollhandler); this.interval = setinterval(this.scrollcallback, 50) } if (this.config.live) { return new mutationobserver((function(_0) { return function(records) { var k, len1, node, record, results; results = []; for (k = 0, len1 = records.length; k < len1; k++) { record = records[k]; results.push((function() { var l, len2, ref1, results1; ref1 = record.addednodes || []; results1 = []; for (l = 0, len2 = ref1.length; l < len2; l++) { node = ref1[l]; results1.push(this.dosync(node)) } return results1 }).call(_0)) } return results } })(this)).observe(document.body, { childlist: true, subtree: true }) } }; wow.prototype.stop = function() { this.stopped = true; this.util().removeevent(this.config.scrollcontainer || window, 'scroll', this.scrollhandler); this.util().removeevent(window, 'resize', this.scrollhandler); if (this.interval != null) { return clearinterval(this.interval) } }; wow.prototype.sync = function(element) { if (mutationobserver.notsupported) { return this.dosync(this.element) } }; wow.prototype.dosync = function(element) { var box, j, len, ref, results; if (element == null) { element = this.element } if (element.nodetype !== 1) { return } element = element.parentnode || element; ref = element.queryselectorall("." + this.config.boxclass); results = []; for (j = 0, len = ref.length; j < len; j++) { box = ref[j]; if (indexof.call(this.all, box) < 0) { this.boxes.push(box); this.all.push(box); if (this.stopped || this.disabled()) { this.resetstyle() } else { this.applystyle(box, true) } results.push(this.scrolled = true) } else { results.push(void 0) } } return results }; wow.prototype.show = function(box) { this.applystyle(box); if (box.classname.indexof(this.config.animateclass) < 0) box.classname = box.classname + " " + this.config.animateclass; if (this.config.callback != null) { this.config.callback(box) } this.util().emitevent(box, this.wowevent); this.util().addevent(box, 'animationend', this.resetanimation); this.util().addevent(box, 'oanimationend', this.resetanimation); this.util().addevent(box, 'webkitanimationend', this.resetanimation); this.util().addevent(box, 'msanimationend', this.resetanimation); return box }; wow.prototype.applystyle = function(box, hidden) { var delay, duration, iteration; duration = box.getattribute('data-wow-duration'); delay = box.getattribute('data-wow-delay'); iteration = box.getattribute('data-wow-iteration'); return this.animate((function(_0) { return function() { return _0.customstyle(box, hidden, duration, delay, iteration) } })(this)) }; wow.prototype.animate = (function() { if ('requestanimationframe' in window) { return function(callback) { return window.requestanimationframe(callback) } } else { return function(callback) { return callback() } } })(); wow.prototype.resetstyle = function() { var box, j, len, ref, results; ref = this.boxes; results = []; for (j = 0, len = ref.length; j < len; j++) { box = ref[j]; results.push(box.style.visibility = 'visible') } return results }; wow.prototype.resetanimation = function(event) { var target; if (event.type.tolowercase().indexof('animationend') >= 0) { target = event.target || event.srcelement; return target.classname = target.classname.replace(this.config.animateclass, '').trim() } }; wow.prototype.customstyle = function(box, hidden, duration, delay, iteration) { if (hidden) { this.cacheanimationname(box) } box.style.visibility = hidden ? 'hidden': 'visible'; if (duration) { this.vendorset(box.style, { animationduration: duration }) } if (delay) { this.vendorset(box.style, { animationdelay: delay }) } if (iteration) { this.vendorset(box.style, { animationiterationcount: iteration }) } this.vendorset(box.style, { animationname: hidden ? 'none': this.cachedanimationname(box) }); return box }; wow.prototype.vendors = ["moz", "webkit"]; wow.prototype.vendorset = function(elem, properties) { var name, results, value, vendor; results = []; for (name in properties) { value = properties[name]; elem["" + name] = value; results.push((function() { var j, len, ref, results1; ref = this.vendors; results1 = []; for (j = 0, len = ref.length; j < len; j++) { vendor = ref[j]; results1.push(elem["" + vendor + (name.charat(0).touppercase()) + (name.substr(1))] = value) } return results1 }).call(this)) } return results }; wow.prototype.vendorcss = function(elem, property) { var j, len, ref, result, style, vendor; style = getcomputedstyle(elem); result = style.getpropertycssvalue(property); ref = this.vendors; for (j = 0, len = ref.length; j < len; j++) { vendor = ref[j]; result = result || style.getpropertycssvalue("-" + vendor + "-" + property) } return result }; wow.prototype.animationname = function(box) { var animationname, error; try { animationname = this.vendorcss(box, 'animation-name').csstext } catch(error) { animationname = getcomputedstyle(box).getpropertyvalue('animation-name') } if (animationname === 'none') { return '' } else { return animationname } }; wow.prototype.cacheanimationname = function(box) { return this.animationnamecache.set(box, this.animationname(box)) }; wow.prototype.cachedanimationname = function(box) { return this.animationnamecache.get(box) }; wow.prototype.scrollhandler = function() { return this.scrolled = true }; wow.prototype.scrollcallback = function() { var box; if (this.scrolled) { this.scrolled = false; this.boxes = (function() { var j, len, ref, results; ref = this.boxes; results = []; for (j = 0, len = ref.length; j < len; j++) { box = ref[j]; if (! (box)) { continue } if (this.isvisible(box)) { this.show(box) } else { this.vendorset(box.style, { animationname: 'inherit', visibility: 'hidden' }) } results.push(box) } return results }).call(this); if (! (this.boxes.length || this.config.live)) { return this.stop() } } }; wow.prototype.offsettop = function(element) { var top; while (element.offsettop === void 0) { element = element.parentnode } top = element.offsettop; while (element = element.offsetparent) { top += element.offsettop } return top }; wow.prototype.isvisible = function(box) { var bottom, offset, top, viewbottom, viewtop; offset = box.getattribute('data-wow-offset') || this.config.offset; viewtop = (this.config.scrollcontainer && this.config.scrollcontainer.scrolltop) || window.pageyoffset; viewbottom = viewtop + math.min(this.element.clientheight, this.util().innerheight()) - offset; top = this.offsettop(box); bottom = top + box.clientheight; return top <= viewbottom && bottom >= viewtop }; wow.prototype.util = function() { return this._1 != null ? this._1: this._1 = new util() }; wow.prototype.disabled = function() { return ! this.config.mobile && this.util().ismobile(navigator.useragent) }; return wow })() }).call(this);