summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/vendor
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/javascripts/vendor')
-rw-r--r--public/assets/javascripts/vendor/canvasutilities.js145
-rwxr-xr-xpublic/assets/javascripts/vendor/chardinjs.min.js2
-rw-r--r--public/assets/javascripts/vendor/froogaloop.js287
-rw-r--r--public/assets/javascripts/vendor/polyfill.js10
-rw-r--r--public/assets/javascripts/vendor/wow.js452
5 files changed, 895 insertions, 1 deletions
diff --git a/public/assets/javascripts/vendor/canvasutilities.js b/public/assets/javascripts/vendor/canvasutilities.js
new file mode 100644
index 0000000..011ebb0
--- /dev/null
+++ b/public/assets/javascripts/vendor/canvasutilities.js
@@ -0,0 +1,145 @@
+var drawArrow = function(ctx, x1, y1, x2, y2, style, which, angle, d) {
+ 'use strict';
+ // Ceason pointed to a problem when x1 or y1 were a string, and concatenation
+ // would happen instead of addition
+ if (typeof(x1) == 'string') x1 = parseInt(x1);
+ if (typeof(y1) == 'string') y1 = parseInt(y1);
+ if (typeof(x2) == 'string') x2 = parseInt(x2);
+ if (typeof(y2) == 'string') y2 = parseInt(y2);
+ style = typeof(style) != 'undefined' ? style : 3;
+ which = typeof(which) != 'undefined' ? which : 1; // end point gets arrow
+ angle = typeof(angle) != 'undefined' ? angle : Math.PI / 8;
+ d = typeof(d) != 'undefined' ? d : 10;
+ // default to using drawHead to draw the head, but if the style
+ // argument is a function, use it instead
+ var toDrawHead = typeof(style) != 'function' ? drawHead : style;
+
+ // For ends with arrow we actually want to stop before we get to the arrow
+ // so that wide lines won't put a flat end on the arrow.
+ //
+ var dist = Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
+ var ratio = (dist - d / 3) / dist;
+ var tox, toy, fromx, fromy;
+ if (which & 1) {
+ tox = Math.round(x1 + (x2 - x1) * ratio);
+ toy = Math.round(y1 + (y2 - y1) * ratio);
+ } else {
+ tox = x2;
+ toy = y2;
+ }
+ if (which & 2) {
+ fromx = x1 + (x2 - x1) * (1 - ratio);
+ fromy = y1 + (y2 - y1) * (1 - ratio);
+ } else {
+ fromx = x1;
+ fromy = y1;
+ }
+
+ // Draw the shaft of the arrow
+ ctx.beginPath();
+ ctx.moveTo(fromx, fromy);
+ ctx.lineTo(tox, toy);
+ ctx.stroke();
+
+ // calculate the angle of the line
+ var lineangle = Math.atan2(y2 - y1, x2 - x1);
+ // h is the line length of a side of the arrow head
+ var h = Math.abs(d / Math.cos(angle));
+
+ if (which & 1) { // handle far end arrow head
+ var angle1 = lineangle + Math.PI + angle;
+ var topx = x2 + Math.cos(angle1) * h;
+ var topy = y2 + Math.sin(angle1) * h;
+ var angle2 = lineangle + Math.PI - angle;
+ var botx = x2 + Math.cos(angle2) * h;
+ var boty = y2 + Math.sin(angle2) * h;
+ toDrawHead(ctx, topx, topy, x2, y2, botx, boty, style);
+ }
+ if (which & 2) { // handle near end arrow head
+ var angle1 = lineangle + angle;
+ var topx = x1 + Math.cos(angle1) * h;
+ var topy = y1 + Math.sin(angle1) * h;
+ var angle2 = lineangle - angle;
+ var botx = x1 + Math.cos(angle2) * h;
+ var boty = y1 + Math.sin(angle2) * h;
+ toDrawHead(ctx, topx, topy, x1, y1, botx, boty, style);
+ }
+}
+
+var drawHead = function(ctx, x0, y0, x1, y1, x2, y2, style) {
+ 'use strict';
+ if (typeof(x0) == 'string') x0 = parseInt(x0);
+ if (typeof(y0) == 'string') y0 = parseInt(y0);
+ if (typeof(x1) == 'string') x1 = parseInt(x1);
+ if (typeof(y1) == 'string') y1 = parseInt(y1);
+ if (typeof(x2) == 'string') x2 = parseInt(x2);
+ if (typeof(y2) == 'string') y2 = parseInt(y2);
+ var radius = 3;
+ var twoPI = 2 * Math.PI;
+
+ // all cases do this.
+ ctx.save();
+ ctx.beginPath();
+ ctx.moveTo(x0, y0);
+ ctx.lineTo(x1, y1);
+ ctx.lineTo(x2, y2);
+ switch (style) {
+ case 0:
+ // curved filled, add the bottom as an arcTo curve and fill
+ var backdist = Math.sqrt(((x2 - x0) * (x2 - x0)) + ((y2 - y0) * (y2 - y0)));
+ ctx.arcTo(x1, y1, x0, y0, .55 * backdist);
+ ctx.fill();
+ break;
+ case 1:
+ // straight filled, add the bottom as a line and fill.
+ ctx.beginPath();
+ ctx.moveTo(x0, y0);
+ ctx.lineTo(x1, y1);
+ ctx.lineTo(x2, y2);
+ ctx.lineTo(x0, y0);
+ ctx.fill();
+ break;
+ case 2:
+ // unfilled head, just stroke.
+ ctx.stroke();
+ break;
+ case 3:
+ //filled head, add the bottom as a quadraticCurveTo curve and fill
+ var cpx = (x0 + x1 + x2) / 3;
+ var cpy = (y0 + y1 + y2) / 3;
+ ctx.quadraticCurveTo(cpx, cpy, x0, y0);
+ ctx.fill();
+ break;
+ case 4:
+ //filled head, add the bottom as a bezierCurveTo curve and fill
+ var cp1x, cp1y, cp2x, cp2y, backdist;
+ var shiftamt = 5;
+ if (x2 == x0) {
+ // Avoid a divide by zero if x2==x0
+ backdist = y2 - y0;
+ cp1x = (x1 + x0) / 2;
+ cp2x = (x1 + x0) / 2;
+ cp1y = y1 + backdist / shiftamt;
+ cp2y = y1 - backdist / shiftamt;
+ } else {
+ backdist = Math.sqrt(((x2 - x0) * (x2 - x0)) + ((y2 - y0) * (y2 - y0)));
+ var xback = (x0 + x2) / 2;
+ var yback = (y0 + y2) / 2;
+ var xmid = (xback + x1) / 2;
+ var ymid = (yback + y1) / 2;
+
+ var m = (y2 - y0) / (x2 - x0);
+ var dx = (backdist / (2 * Math.sqrt(m * m + 1))) / shiftamt;
+ var dy = m * dx;
+ cp1x = xmid - dx;
+ cp1y = ymid - dy;
+ cp2x = xmid + dx;
+ cp2y = ymid + dy;
+ }
+
+ ctx.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x0, y0);
+ ctx.fill();
+ break;
+ }
+ ctx.restore();
+}
diff --git a/public/assets/javascripts/vendor/chardinjs.min.js b/public/assets/javascripts/vendor/chardinjs.min.js
new file mode 100755
index 0000000..56cd7b7
--- /dev/null
+++ b/public/assets/javascripts/vendor/chardinjs.min.js
@@ -0,0 +1,2 @@
+// Generated by CoffeeScript 1.6.2
+(function(){var e=[].slice;(function(t,n){var r;return r=function(){function e(e){var r=this;this.$el=t(e),t(n).resize(function(){return r.refresh()})}return e.prototype.start=function(){var e,t,n,r;if(this._overlay_visible())return!1;this._add_overlay_layer(),r=this.$el.find("*[data-intro]:visible");for(t=0,n=r.length;t<n;t++)e=r[t],this._show_element(e);return this.$el.trigger("chardinJs:start")},e.prototype.toggle=function(){return this._overlay_visible()?this.stop():this.start()},e.prototype.refresh=function(){var e,t,n,r,i;if(this._overlay_visible()){r=this.$el.find("*[data-intro]:visible"),i=[];for(t=0,n=r.length;t<n;t++)e=r[t],i.push(this._position_helper_layer(e));return i}return this},e.prototype.stop=function(){return this.$el.find(".chardinjs-overlay").fadeOut(function(){return t(this).remove()}),this.$el.find(".chardinjs-helper-layer").remove(),this.$el.find(".chardinjs-show-element").removeClass("chardinjs-show-element"),this.$el.find(".chardinjs-relative-position").removeClass("chardinjs-relative-position"),n.removeEventListener?n.removeEventListener("keydown",this._onKeyDown,!0):document.detachEvent&&document.detachEvent("onkeydown",this._onKeyDown),this.$el.trigger("chardinJs:stop")},e.prototype._overlay_visible=function(){return this.$el.find(".chardinjs-overlay").length!==0},e.prototype._add_overlay_layer=function(){var e,t,n,r=this;return this._overlay_visible()?!1:(t=document.createElement("div"),n="",t.className="chardinjs-overlay",this.$el.prop("tagName")==="BODY"?(n+="top: 0;bottom: 0; left: 0;right: 0;position: fixed;",t.setAttribute("style",n)):(e=this._get_offset(this.$el.get()[0]),e&&(n+="width: "+e.width+"px; height:"+e.height+"px; top:"+e.top+"px;left: "+e.left+"px;",t.setAttribute("style",n))),this.$el.get()[0].appendChild(t),t.onclick=function(){return r.stop()},setTimeout(function(){return n+="opacity: .8;opacity: .8;-ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=80)';filter: alpha(opacity=80);",t.setAttribute("style",n)},10))},e.prototype._get_position=function(e){return e.getAttribute("data-position")||"bottom"},e.prototype._place_tooltip=function(e){var n,r,i,s,o,u,a;u=t(e).data("tooltip_layer"),a=this._get_offset(u),u.style.top=null,u.style.right=null,u.style.bottom=null,u.style.left=null;switch(this._get_position(e)){case"top":case"bottom":i=this._get_offset(e),o=i.width,r=t(u).width(),u.style.left=""+(o/2-a.width/2)+"px";break;case"left":case"right":i=this._get_offset(e),s=i.height,n=t(u).height(),u.style.top=""+(s/2-a.height/2)+"px"}switch(this._get_position(e)){case"left":return u.style.left="-"+(a.width-34)+"px";case"right":return u.style.right="-"+(a.width-34)+"px";case"bottom":return u.style.bottom="-"+a.height+"px";case"top":return u.style.top="-"+a.height+"px"}},e.prototype._position_helper_layer=function(e){var n,r;return r=t(e).data("helper_layer"),n=this._get_offset(e),r.setAttribute("style","width: "+n.width+"px; height:"+n.height+"px; top:"+n.top+"px; left: "+n.left+"px;")},e.prototype._show_element=function(e){var n,r,i,s;r=this._get_offset(e),i=document.createElement("div"),s=document.createElement("div"),t(e).data("helper_layer",i).data("tooltip_layer",s),e.id&&i.setAttribute("data-id",e.id),i.className="chardinjs-helper-layer chardinjs-"+this._get_position(e),this._position_helper_layer(e),this.$el.get()[0].appendChild(i),s.className="chardinjs-tooltip chardinjs-"+this._get_position(e),s.innerHTML="<div class='chardinjs-tooltiptext'>"+e.getAttribute("data-intro")+"</div>",i.appendChild(s),this._place_tooltip(e),e.className+=" chardinjs-show-element",n="",e.currentStyle?n=e.currentStyle.position:document.defaultView&&document.defaultView.getComputedStyle&&(n=document.defaultView.getComputedStyle(e,null).getPropertyValue("position")),n=n.toLowerCase();if(n!=="absolute"&&n!=="relative")return e.className+=" chardinjs-relative-position"},e.prototype._get_offset=function(e){var t,n,r;t={width:e.offsetWidth,height:e.offsetHeight},n=0,r=0;while(e&&!isNaN(e.offsetLeft)&&!isNaN(e.offsetTop))n+=e.offsetLeft,r+=e.offsetTop,e=e.offsetParent;return t.top=r,t.left=n,t},e}(),t.fn.extend({chardinJs:function(){var n,i,s,o;return o=arguments[0],i=2<=arguments.length?e.call(arguments,1):[],n=t(this[0]),s=n.data("chardinJs"),s||n.data("chardinJs",s=new r(this,o)),typeof o=="string"&&s[o].apply(s,i),s}})})(window.jQuery,window)}).call(this); \ No newline at end of file
diff --git a/public/assets/javascripts/vendor/froogaloop.js b/public/assets/javascripts/vendor/froogaloop.js
new file mode 100644
index 0000000..c9330e6
--- /dev/null
+++ b/public/assets/javascripts/vendor/froogaloop.js
@@ -0,0 +1,287 @@
+// Init style shamelessly stolen from jQuery http://jquery.com
+var Froogaloop = (function(){
+ // Define a local copy of Froogaloop
+ function Froogaloop(iframe) {
+ // The Froogaloop object is actually just the init constructor
+ return new Froogaloop.fn.init(iframe);
+ }
+
+ var eventCallbacks = {},
+ hasWindowEvent = false,
+ isReady = false,
+ slice = Array.prototype.slice,
+ playerDomain = '';
+
+ Froogaloop.fn = Froogaloop.prototype = {
+ element: null,
+
+ init: function(iframe) {
+ if (typeof iframe === "string") {
+ iframe = document.getElementById(iframe);
+ }
+
+ this.element = iframe;
+
+ // Register message event listeners
+ playerDomain = getDomainFromUrl(this.element.getAttribute('src'));
+
+ return this;
+ },
+
+ /*
+ * Calls a function to act upon the player.
+ *
+ * @param {string} method The name of the Javascript API method to call. Eg: 'play'.
+ * @param {Array|Function} valueOrCallback params Array of parameters to pass when calling an API method
+ * or callback function when the method returns a value.
+ */
+ api: function(method, valueOrCallback) {
+ if (!this.element || !method) {
+ return false;
+ }
+
+ var self = this,
+ element = self.element,
+ target_id = element.id !== '' ? element.id : null,
+ params = !isFunction(valueOrCallback) ? valueOrCallback : null,
+ callback = isFunction(valueOrCallback) ? valueOrCallback : null;
+
+ // Store the callback for get functions
+ if (callback) {
+ storeCallback(method, callback, target_id);
+ }
+
+ postMessage(method, params, element);
+ return self;
+ },
+
+ /*
+ * Registers an event listener and a callback function that gets called when the event fires.
+ *
+ * @param eventName (String): Name of the event to listen for.
+ * @param callback (Function): Function that should be called when the event fires.
+ */
+ addEvent: function(eventName, callback) {
+ if (!this.element) {
+ return false;
+ }
+
+ var self = this,
+ element = self.element,
+ target_id = element.id !== '' ? element.id : null;
+
+ storeCallback(eventName, callback, target_id);
+
+ // The ready event is not registered via postMessage. It fires regardless.
+ if (eventName != 'ready') {
+ postMessage('addEventListener', eventName, element);
+ }
+ else if (eventName == 'ready' && isReady) {
+ callback.call(null, target_id);
+ }
+
+ return self;
+ },
+
+ /*
+ * Unregisters an event listener that gets called when the event fires.
+ *
+ * @param eventName (String): Name of the event to stop listening for.
+ */
+ removeEvent: function(eventName) {
+ if (!this.element) {
+ return false;
+ }
+
+ var self = this,
+ element = self.element,
+ target_id = element.id !== '' ? element.id : null,
+ removed = removeCallback(eventName, target_id);
+
+ // The ready event is not registered
+ if (eventName != 'ready' && removed) {
+ postMessage('removeEventListener', eventName, element);
+ }
+ }
+ };
+
+ /**
+ * Handles posting a message to the parent window.
+ *
+ * @param method (String): name of the method to call inside the player. For api calls
+ * this is the name of the api method (api_play or api_pause) while for events this method
+ * is api_addEventListener.
+ * @param params (Object or Array): List of parameters to submit to the method. Can be either
+ * a single param or an array list of parameters.
+ * @param target (HTMLElement): Target iframe to post the message to.
+ */
+ function postMessage(method, params, target) {
+ if (!target.contentWindow.postMessage) {
+ return false;
+ }
+
+ var url = target.getAttribute('src').split('?')[0],
+ data = JSON.stringify({
+ method: method,
+ value: params
+ });
+
+ if (url.substr(0, 2) === '//') {
+ url = window.location.protocol + url;
+ }
+
+ target.contentWindow.postMessage(data, url);
+ }
+
+ /**
+ * Event that fires whenever the window receives a message from its parent
+ * via window.postMessage.
+ */
+ function onMessageReceived(event) {
+ var data, method;
+
+ try {
+ data = JSON.parse(event.data);
+ method = data.event || data.method;
+ }
+ catch(e) {
+ //fail silently... like a ninja!
+ }
+
+ if (method == 'ready' && !isReady) {
+ isReady = true;
+ }
+
+ // Handles messages from moogaloop only
+ if (event.origin != playerDomain) {
+ return false;
+ }
+
+ var value = data.value,
+ eventData = data.data,
+ target_id = target_id === '' ? null : data.player_id,
+
+ callback = getCallback(method, target_id),
+ params = [];
+
+ if (!callback) {
+ return false;
+ }
+
+ if (value !== undefined) {
+ params.push(value);
+ }
+
+ if (eventData) {
+ params.push(eventData);
+ }
+
+ if (target_id) {
+ params.push(target_id);
+ }
+
+ return params.length > 0 ? callback.apply(null, params) : callback.call();
+ }
+
+
+ /**
+ * Stores submitted callbacks for each iframe being tracked and each
+ * event for that iframe.
+ *
+ * @param eventName (String): Name of the event. Eg. api_onPlay
+ * @param callback (Function): Function that should get executed when the
+ * event is fired.
+ * @param target_id (String) [Optional]: If handling more than one iframe then
+ * it stores the different callbacks for different iframes based on the iframe's
+ * id.
+ */
+ function storeCallback(eventName, callback, target_id) {
+ if (target_id) {
+ if (!eventCallbacks[target_id]) {
+ eventCallbacks[target_id] = {};
+ }
+ eventCallbacks[target_id][eventName] = callback;
+ }
+ else {
+ eventCallbacks[eventName] = callback;
+ }
+ }
+
+ /**
+ * Retrieves stored callbacks.
+ */
+ function getCallback(eventName, target_id) {
+ if (target_id) {
+ return eventCallbacks[target_id][eventName];
+ }
+ else {
+ return eventCallbacks[eventName];
+ }
+ }
+
+ function removeCallback(eventName, target_id) {
+ if (target_id && eventCallbacks[target_id]) {
+ if (!eventCallbacks[target_id][eventName]) {
+ return false;
+ }
+ eventCallbacks[target_id][eventName] = null;
+ }
+ else {
+ if (!eventCallbacks[eventName]) {
+ return false;
+ }
+ eventCallbacks[eventName] = null;
+ }
+
+ return true;
+ }
+
+ /**
+ * Returns a domain's root domain.
+ * Eg. returns http://vimeo.com when http://vimeo.com/channels is sbumitted
+ *
+ * @param url (String): Url to test against.
+ * @return url (String): Root domain of submitted url
+ */
+ function getDomainFromUrl(url) {
+ if (url.substr(0, 2) === '//') {
+ url = window.location.protocol + url;
+ }
+
+ var url_pieces = url.split('/'),
+ domain_str = '';
+
+ for(var i = 0, length = url_pieces.length; i < length; i++) {
+ if(i<3) {domain_str += url_pieces[i];}
+ else {break;}
+ if(i<2) {domain_str += '/';}
+ }
+
+ return domain_str;
+ }
+
+ function isFunction(obj) {
+ return !!(obj && obj.constructor && obj.call && obj.apply);
+ }
+
+ function isArray(obj) {
+ return toString.call(obj) === '[object Array]';
+ }
+
+ // Give the init function the Froogaloop prototype for later instantiation
+ Froogaloop.fn.init.prototype = Froogaloop.fn;
+
+ // Listens for the message event.
+ // W3C
+ if (window.addEventListener) {
+ window.addEventListener('message', onMessageReceived, false);
+ }
+ // IE
+ else {
+ window.attachEvent('onmessage', onMessageReceived);
+ }
+
+ // Expose froogaloop to the global object
+ return (window.Froogaloop = window.$f = Froogaloop);
+
+})(); \ No newline at end of file
diff --git a/public/assets/javascripts/vendor/polyfill.js b/public/assets/javascripts/vendor/polyfill.js
index f97e438..2139618 100644
--- a/public/assets/javascripts/vendor/polyfill.js
+++ b/public/assets/javascripts/vendor/polyfill.js
@@ -48,10 +48,18 @@ function has3d(){
} else if ( browser.webkit ) {
browser.safari = true;
}
- $.browser = browser;
+ if (window.$) $.browser = browser;
return browser;
})( navigator.userAgent );
+// Naive useragent detection pattern
+var is_iphone = (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))
+var is_ipad = (navigator.userAgent.match(/iPad/i))
+var is_android = (navigator.userAgent.match(/Android/i))
+var is_mobile = is_iphone || is_ipad || is_android
+var is_desktop = ! is_mobile;
+var app_devicePixelRatio = is_mobile ? devicePixelRatio : 1;
+
// rAF shim
(function() {
diff --git a/public/assets/javascripts/vendor/wow.js b/public/assets/javascripts/vendor/wow.js
new file mode 100644
index 0000000..83ca71b
--- /dev/null
+++ b/public/assets/javascripts/vendor/wow.js
@@ -0,0 +1,452 @@
+(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.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, _i, _len, _ref;
+ _ref = this.keys;
+ for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
+ item = _ref[i];
+ if (item === key) {
+ return this.values[i];
+ }
+ }
+ };
+
+ WeakMap.prototype.set = function(key, value) {
+ var i, item, _i, _len, _ref;
+ _ref = this.keys;
+ for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
+ 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(_, char) {
+ return char.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
+ };
+
+ 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);
+ this.animationNameCache = new WeakMap();
+ }
+
+ 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, _i, _len, _ref;
+ this.stopped = false;
+ this.boxes = (function() {
+ var _i, _len, _ref, _results;
+ _ref = this.element.querySelectorAll("." + this.config.boxClass);
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ box = _ref[_i];
+ _results.push(box);
+ }
+ return _results;
+ }).call(this);
+ this.all = (function() {
+ var _i, _len, _ref, _results;
+ _ref = this.boxes;
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ box = _ref[_i];
+ _results.push(box);
+ }
+ return _results;
+ }).call(this);
+ if (this.boxes.length) {
+ if (this.disabled()) {
+ this.resetStyle();
+ } else {
+ _ref = this.boxes;
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ box = _ref[_i];
+ this.applyStyle(box, true);
+ }
+ this.util().addEvent(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(_this) {
+ return function(records) {
+ var node, record, _j, _len1, _results;
+ _results = [];
+ for (_j = 0, _len1 = records.length; _j < _len1; _j++) {
+ record = records[_j];
+ _results.push((function() {
+ var _k, _len2, _ref1, _results1;
+ _ref1 = record.addedNodes || [];
+ _results1 = [];
+ for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {
+ node = _ref1[_k];
+ _results1.push(this.doSync(node));
+ }
+ return _results1;
+ }).call(_this));
+ }
+ return _results;
+ };
+ })(this)).observe(document.body, {
+ childList: true,
+ subtree: true
+ });
+ }
+ };
+
+ WOW.prototype.stop = function() {
+ this.stopped = true;
+ this.util().removeEvent(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, _i, _len, _ref, _results;
+ if (!this.stopped) {
+ if (element == null) {
+ element = this.element;
+ }
+ if (element.nodeType !== 1) {
+ return;
+ }
+ element = element.parentNode || element;
+ _ref = element.querySelectorAll("." + this.config.boxClass);
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ box = _ref[_i];
+ if (__indexOf.call(this.all, box) < 0) {
+ this.applyStyle(box, true);
+ this.boxes.push(box);
+ this.all.push(box);
+ _results.push(this.scrolled = true);
+ } else {
+ _results.push(void 0);
+ }
+ }
+ return _results;
+ }
+ };
+
+ 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 this.animate((function(_this) {
+ return function() {
+ return _this.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, _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(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, value, vendor, _results;
+ _results = [];
+ for (name in properties) {
+ value = properties[name];
+ elem["" + name] = value;
+ _results.push((function() {
+ var _i, _len, _ref, _results1;
+ _ref = this.vendors;
+ _results1 = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ vendor = _ref[_i];
+ _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 result, style, vendor, _i, _len, _ref;
+ style = getComputedStyle(elem);
+ result = style.getPropertyCSSValue(property);
+ _ref = this.vendors;
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ vendor = _ref[_i];
+ result = result || style.getPropertyCSSValue("-" + vendor + "-" + property);
+ }
+ return result;
+ };
+
+ WOW.prototype.animationName = function(box) {
+ var animationName;
+ 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 _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 || 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 = 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._util != null ? this._util : this._util = new Util();
+ };
+
+ WOW.prototype.disabled = function() {
+ return !this.config.mobile && this.util().isMobile(navigator.userAgent);
+ };
+
+ return WOW;
+
+ })();
+
+}).call(this);