(function(n,t){function i(t,i,r,u){var f={duration:1,animation:null,iterate:1,timing:"linear",keep:!1},e;this.prefixes=["","-moz-","-o-animation-","-webkit-"];this.element=n(t);this.bare=t;this.queue=[];this.listening=!1;e=typeof r=="function"?r:u;switch(i){case"blur":f={amount:3,duration:.5,focusAfter:null};this.options=n.extend(f,r);this._blur(e);break;case"focus":this._focus();break;case"rotate":f={degrees:15,duration:.5};this.options=n.extend(f,r);this._rotate(e);break;case"cleanse":this.cleanse();break;default:this.options=n.extend(f,i);this.init(e)}}i.prototype={init:function(t){var i=this;Object.prototype.toString.call(i.options.animation)==="[object Array]"?n.merge(i.queue,i.options.animation):i.queue.push(i.options.animation);i.cleanse();i.animate(t)},animate:function(n){var i,t,r;for(this.element.addClass("animated"),this.element.addClass(this.queue[0]),this.element.data("animo",this.queue[0]),i=this.prefixes.length;i--;)this.element.css(this.prefixes[i]+"animation-duration",this.options.duration+"s"),this.element.css(this.prefixes[i]+"animation-iteration-count",this.options.iterate),this.element.css(this.prefixes[i]+"animation-timing-function",this.options.timing);t=this;r=n;t.queue.length>1&&(r=null);this._end("AnimationEnd",function(){t.element.hasClass(t.queue[0])&&(t.options.keep||t.cleanse(),t.queue.shift(),t.queue.length&&t.animate(n))},r)},cleanse:function(){this.element.removeClass("animated");this.element.removeClass(this.queue[0]);this.element.removeClass(this.element.data("animo"));for(var n=this.prefixes.length;n--;)this.element.css(this.prefixes[n]+"animation-duration",""),this.element.css(this.prefixes[n]+"animation-iteration-count",""),this.element.css(this.prefixes[n]+"animation-timing-function",""),this.element.css(this.prefixes[n]+"transition",""),this.element.css(this.prefixes[n]+"transform",""),this.element.css(this.prefixes[n]+"filter","")},_blur:function(i){var u,f,o,r,s,e;if(this.element.is("img")){for(u="svg_"+((1+Math.random())*16777216|0).toString(16).substring(1),f="filter_"+((1+Math.random())*16777216|0).toString(16).substring(1),n("body").append('<\/filter><\/svg>'),r=this.prefixes.length;r--;)this.element.css(this.prefixes[r]+"filter","blur("+this.options.amount+"px)"),this.element.css(this.prefixes[r]+"transition",this.options.duration+"s all linear");this.element.css("filter","url(#"+f+")");this.element.data("svgid",u)}else{for(o=this.element.css("color"),r=this.prefixes.length;r--;)this.element.css(this.prefixes[r]+"transition","all "+this.options.duration+"s linear");this.element.css("text-shadow","0 0 "+this.options.amount+"px "+o);this.element.css("color","transparent")}this._end("TransitionEnd",null,i);s=this;this.options.focusAfter&&(e=t.setTimeout(function(){s._focus();e=t.clearTimeout(e)},this.options.focusAfter*1e3))},_focus:function(){var t=this.prefixes.length,i;if(this.element.is("img")){while(t--)this.element.css(this.prefixes[t]+"filter",""),this.element.css(this.prefixes[t]+"transition","");i=n("#"+this.element.data("svgid"));i.remove()}else{while(t--)this.element.css(this.prefixes[t]+"transition","");this.element.css("text-shadow","");this.element.css("color","")}},_rotate:function(n){for(var t=this.prefixes.length;t--;)this.element.css(this.prefixes[t]+"transition","all "+this.options.duration+"s linear"),this.element.css(this.prefixes[t]+"transform","rotate("+this.options.degrees+"deg)");this._end("TransitionEnd",null,n)},_end:function(n,t,i){var r=this,u=n.toLowerCase()+" webkit"+n+" o"+n+" MS"+n;this.element.bind(u,function(){r.element.unbind(u);typeof t=="function"&&t();typeof i=="function"&&i(r)})}};n.fn.animo=function(n,t,r){return this.each(function(){new i(this,n,t,r)})}})(jQuery,window,document)