This repository has been archived by the owner on Feb 21, 2018. It is now read-only.
forked from madrobby/emile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
emile.min.js
5 lines (5 loc) · 3.52 KB
/
emile.min.js
1
2
3
4
5
/*!
* emile.js (c) 2009 - 2011 Thomas Fuchs
* Licensed under the terms of the MIT license.
*/
!function(a){function B(a,b){a=typeof a=="string"?document.getElementById(a):a,b=A(b);var c={duration:b.duration,easing:b.easing,after:b.after,slot:b.slot};delete b.duration,delete b.easing,delete b.after,delete b.slot;for(var e=d.length;c.slot&&e--;){var g=d[e];g.e==a&&g.s==c.slot&&clearInterval(d.splice(e,1)[0].i)}if(f&&typeof c.easing!="function")return z(a,b,c);var j=r(b,function(a,b){a=s(a);return q(a)in i&&h.test(b)?[a,b+"px"]:[a,b]});y(a,j,c)}function A(a){var b={};for(var c in a)b[c]=a[c],c=="after"&&delete a[c];return b}function z(a,b,c){var d=[],e=c.duration||1e3,g=c.easing||"ease-out";e=e+"ms",c.after&&a.addEventListener(m,function j(){c.after(a),a.removeEventListener(m,j,!0)},!0),setTimeout(function(){var c;for(c in b)b.hasOwnProperty(c)&&d.push(s(c)+" "+e+" "+g);d=d.join(","),a.style[f+"Transition"]=d;for(c in b){var j=q(c)in i&&h.test(b[c])?b[c]+"px":b[c];try{b.hasOwnProperty(c)&&(a.style[q(c)]=j)}catch(k){}}},10)}function y(a,b,c){c=c||{};var e=x(b),f=a.currentStyle?a.currentStyle:getComputedStyle(a,null),g={},h=+(new Date),i,j=c.duration||200,k=h+j,l,m={e:a,i:null,s:c.slot},n=c.easing||function(a){return-Math.cos(a*Math.PI)/2+.5};for(i in e)g[i]=w(f[i]);l=setInterval(function(){var b=+(new Date),f,i=b>k?1:(b-h)/j;for(f in e)try{a.style[f]=e[f].f(g[f].v,e[f].v,n(i))+e[f].u}catch(o){}if(b>k){clearInterval(l),c.after&&c.after(a);for(var p=d.length;p--;)d[p]===m&&delete d.splice(p,1)}},10),m.i=l,d.push(m)}function x(a){var c,d={},e=l.length,f;b.innerHTML='<div style="'+a+'"></div>',c=b.childNodes[0].style;while(e--)(f=c[l[e]])&&(d[l[e]]=w(f));return d}function w(a){var b=parseFloat(a),c=a?a.replace(/^[\-\d\.]+/,""):a;return isNaN(b)?{v:c,f:v,u:""}:{v:b,f:t,u:c}}function v(a,b,c){var d=2,e,f,g,h=[],i=[];while((e=3)&&(f=arguments[d-1])&&d--)if(u(f,0)=="r"){f=f.match(/\d+/g);while(e--)h.push(~~f[e])}else{f.length==4&&(f="#"+u(f,1)+u(f,1)+u(f,2)+u(f,2)+u(f,3)+u(f,3));while(e--)h.push(parseInt(u(f,1+e*2,2),16))}while(e--)g=~~(h[e+3]+(h[e]-h[e+3])*c),i.push(g<0?0:g>255?255:g);return"rgb("+i.join(",")+")"}function u(a,b,c){return a.substr(b,c||1)}function t(a,b,c){return(a+(b-a)*c).toFixed(3)}function s(a){if(a.toUpperCase()===a)return a;return a.replace(/([a-zA-Z0-9])([A-Z])/g,function(a,b,c){return b+"-"+c}).toLowerCase()}function r(a,b){return p(a,function(a,c){var d=b?b(c,a):[c,a];return d[0]+":"+d[1]+";"}).join("")}function q(a){return a.replace(/-(.)/g,function(a,b){return b.toUpperCase()})}function p(a,b,c){var d=[],e;for(e in a)d.push(b.call(c,a[e],e,a));return d}var b=document.createElement("div"),c=["webkit","Moz","O"],d=[],e=3,f,g,h=/^-?\d+(\.\d+)?$/,i={},j="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color fontWeight lineHeight opacity outlineColor zIndex",k="top bottom left right backgroundPositionX backgroundPositionY borderWidth borderBottomWidth borderLeftWidth borderRightWidth borderTopWidth borderSpacing borderRadius marginBottom marginLeft marginRight marginTop width height maxHeight maxWidth minHeight minWidth paddingBottom paddingLeft paddingRight paddingTop fontSize wordSpacing textIndent letterSpacing outlineWidth outlineOffset",l=(j+" "+k).split(" ");while(e--)g=c[e],b.style.cssText="-"+g.toLowerCase()+"-transition-property:opacity;",typeof b.style[g+"TransitionProperty"]!="undefined"&&(f=g);var m=/^w/.test(f)?"webkitTransitionEnd":"transitionend";for(var n=k.split(" "),o=n.length;o--;)i[n[o]]=1;var C=a.emile;B.noConflict=function(){a.emile=C;return this},a.emile=B}(this)