-
Notifications
You must be signed in to change notification settings - Fork 9
/
cssanimevent.min.js
4 lines (4 loc) · 1.88 KB
/
cssanimevent.min.js
1
2
3
4
(function(v,q,h){function d(){function a(b){for(var a=Object.keys(b);a.length;){var d=a.shift();if(q.style[d]!==h)return b[d]}}if(!r){r=!0;if(f=a({animation:["animationstart","animationiteration","animationend"],webkitAnimation:["webkitAnimationStart","webkitAnimationIteration","webkitAnimationEnd"]}))k=f[0],l=f[1],f=f[2];e=a({transition:"transitionend",webkitTransition:"webkitTransitionEnd"})}}function m(a,b,c){a.addEventListener(b,c,!1);return!0}function n(a,b,c){a.removeEventListener(b,c,!1);return!0}
function t(a,b){var c=b.picohCSSAnimID;return c!==h&&g[a][c]!==h?c:!1}function p(a,b,c){c=c||t(a,b);!1!==c&&(delete g[a][c],delete b.picohCSSAnimID,b.className=(" "+b.className+" ").replace(" cssanimactive "," ").trim())}function u(a,b,c,d,f){if(!a)return setTimeout(function(){d(c,f)});g[b]||(g[b]={},m(q,a,function(a){if(a.target){a=a.target;var c=t(b,a);if(!1!==c){var d=g[b][c];p(b,a,c);d[0](a,d[1])}}}));p(b,c);for(var e;!e||g[b][e];)for(e="";3>e.length;)e+=String.fromCharCode(Math.floor(25*Math.random())+
97);c.picohCSSAnimID=e;g[b][e]=[d,f];c.className=c.className.trim()+" cssanimactive"}var r,k,l,f,e,g=[h,h];v.CSSAnimEvent={animationSupport:function(){d();return!!f},transitionSupport:function(){d();return!!e},addAnimationStart:function(a,b){d();return k?m(a,k,b):!1},removeAnimationStart:function(a,b){d();return k?n(a,k,b):!1},addAnimationIteration:function(a,b){d();return l?m(a,l,b):!1},removeAnimationIteration:function(a,b){d();return l?n(a,l,b):!1},addAnimationEnd:function(a,b){d();return f?m(a,
f,b):!1},removeAnimationEnd:function(a,b){d();return f?n(a,f,b):!1},addTransitionEnd:function(a,b){d();return e?m(a,e,b):!1},removeTransitionEnd:function(a,b){d();return e?n(a,e,b):!1},onAnimationEnd:function(a,b,c){d();u(f,0,a,b,c)},cancelAnimationEnd:function(a){p(0,a)},onTransitionEnd:function(a,b,c){d();u(e,1,a,b,c)},cancelTransitionEnd:function(a){p(1,a)}}})(window,document.documentElement);