(function() { var util, __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; util = (function() { function util() {} util.prototype.extend = function(custom, defaults) { var key, value; for (key in custom) { value = custom[key]; if (value != null) { defaults[key] = value; } } return defaults; }; util.prototype.ismobile = function(agent) { return /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(agent); }; return util; })(); this.wow = (function() { wow.prototype.defaults = { boxclass: 'wow', animateclass: 'animated', offset: 0, mobile: true }; function wow(options) { if (options == null) { options = {}; } this.scrollcallback = __bind(this.scrollcallback, this); this.scrollhandler = __bind(this.scrollhandler, this); this.start = __bind(this.start, this); this.scrolled = true; this.config = this.util().extend(options, this.defaults); } wow.prototype.init = function() { var _ref; this.element = window.document.documentelement; this.boxes = this.element.getelementsbyclassname(this.config.boxclass); if (this.boxes.length) { if (this.disabled()) { return this.resetstyle(); } else { if ((_ref = document.readystate) === "interactive" || _ref === "complete") { return this.start(); } else { return document.addeventlistener('domcontentloaded', this.start); } } } }; wow.prototype.start = function() { var box, _i, _len, _ref; _ref = this.boxes; for (_i = 0, _len = _ref.length; _i < _len; _i++) { box = _ref[_i]; this.applystyle(box, true); } window.addeventlistener('scroll', this.scrollhandler, false); window.addeventlistener('resize', this.scrollhandler, false); return this.interval = setinterval(this.scrollcallback, 50); }; wow.prototype.stop = function() { window.removeeventlistener('scroll', this.scrollhandler, false); window.removeeventlistener('resize', this.scrollhandler, false); if (this.interval != null) { return clearinterval(this.interval); } }; wow.prototype.show = function(box) { this.applystyle(box); return box.classname = "" + box.classname + " " + this.config.animateclass; }; 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 box.setattribute('style', this.customstyle(hidden, duration, delay, iteration)); }; wow.prototype.resetstyle = function() { var box, _i, _len, _ref, _results; _ref = this.boxes; _results = []; for (_i = 0, _len = _ref.length; _i < _len; _i++) { box = _ref[_i]; _results.push(box.setattribute('style', 'visibility: visible;')); } return _results; }; wow.prototype.customstyle = function(hidden, duration, delay, iteration) { var style; style = hidden ? "visibility: hidden; -webkit-animation-name: none; -moz-animation-name: none; animation-name: none;" : "visibility: visible;"; if (duration) { style += "-webkit-animation-duration: " + duration + "; -moz-animation-duration: " + duration + "; animation-duration: " + duration + ";"; } if (delay) { style += "-webkit-animation-delay: " + delay + "; -moz-animation-delay: " + delay + "; animation-delay: " + delay + ";"; } if (iteration) { style += "-webkit-animation-iteration-count: " + iteration + "; -moz-animation-iteration-count: " + iteration + "; animation-iteration-count: " + iteration + ";"; } return style; }; wow.prototype.scrollhandler = function() { return this.scrolled = true; }; wow.prototype.scrollcallback = function() { var box; if (this.scrolled) { this.scrolled = false; this.boxes = (function() { var _i, _len, _ref, _results; _ref = this.boxes; _results = []; for (_i = 0, _len = _ref.length; _i < _len; _i++) { box = _ref[_i]; if (!(box)) { continue; } if (this.isvisible(box)) { this.show(box); continue; } _results.push(box); } return _results; }).call(this); if (!this.boxes.length) { return this.stop(); } } }; wow.prototype.offsettop = function(element) { var top; 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 = window.pageyoffset; viewbottom = viewtop + this.element.clientheight - offset; top = this.offsettop(box); bottom = top + box.clientheight; return top <= viewbottom && bottom >= viewtop; }; wow.prototype.util = function() { return this._util || (this._util = new util()); }; wow.prototype.disabled = function() { return this.config.mobile === false && this.util().ismobile(navigator.useragent); }; return wow; })(); }).call(this);