-
Notifications
You must be signed in to change notification settings - Fork 0
/
rl-velocity.min.js
4 lines (4 loc) · 1.6 KB
/
rl-velocity.min.js
1
2
3
4
/*! rl-velocity - v0.3.2 - 2014-07-10
* https://github.com/rosslavery/rl-velocity
* Copyright (c) 2014 Ross Lavery <[email protected]>; License: MIT */
!function(a){"use strict";function b(a){return".velocity-"+a.replace(".","-")}var c=window.jQuery||window.Zepto||window;if(!c.Velocity||!c.Velocity.Utilities||!c.Velocity.RegisterUI)throw new Error("Velocity UI Pack: Velocity must be loaded first. Aborting.");c.rlVelocity=a.module("rl.velocity",["ngAnimate"]).constant("rlVelocityConfig",{duration:300}).factory("VelocityUtils",["rlVelocityConfig",function(b){return{_parseClassList:function(b){var c={};return a.forEach(b,function(a){a.indexOf("velocity-duration-")>-1&&(c.duration=a.split("velocity-duration-")[1])}),c},_createAngularAnimation:function(a){var b=this,c=a.replace("In","Out");return c.indexOf("Down")>-1?c=c.replace("Down","Up"):c.indexOf("Up")>-1&&(c=c.replace("Up","Down")),{enter:b._createVelocityAnimation(a),leave:b._createVelocityAnimation(c),move:b._createVelocityAnimation(a),beforeAddClass:b._createVelocityClassAnimation(c),removeClass:b._createVelocityClassAnimation(a)}},_createVelocityAnimation:function(d){var e=this;return function(f,g){var h=e._parseClassList(f[0].classList),i=a.extend(b,h);c.Velocity.animate(f,d,i).then(g)}},_createVelocityClassAnimation:function(d){var e=this;return function(f,g,h){var i=e._parseClassList(f[0].classList),j=a.extend(b,i);"ng-hide"===g?c.Velocity.animate(f,d,j).then(h):h()}}}}]);var d;a.forEach(c.Velocity.RegisterUI.packagedEffects,function(a,e){d=b(e),c.rlVelocity.animation(d,["VelocityUtils",function(a){return a._createAngularAnimation(e)}])})}(angular);