You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

0 lines
10 KiB

10 years ago
  1. !function(a,b,c,d){"use strict";a.fn.transition=function(){var e,f=a(this),g=f.selector||"",h=(new Date).getTime(),i=[],j=arguments,k=j[0],l=[].slice.call(arguments,1),m="string"==typeof k,n=b.requestAnimationFrame||b.mozRequestAnimationFrame||b.webkitRequestAnimationFrame||b.msRequestAnimationFrame||function(a){setTimeout(a,0)};return f.each(function(){var b,o,p,q,r,s,t,u,v,w,x=a(this),y=this;w={initialize:function(){b=w.get.settings.apply(y,j),w.verbose("Converted arguments into settings object",b),p=b.error,q=b.className,u=b.namespace,r=b.metadata,v="module-"+u,s=w.get.animationEvent(),t=w.get.animationName(),o=x.data(v)||w,m&&(m=w.invoke(k)),m===!1&&(w.animate(),w.instantiate())},instantiate:function(){w.verbose("Storing instance of module",w),x.data(v,o)},destroy:function(){w.verbose("Destroying previous module for",y),x.removeData(v)},refresh:function(){w.verbose("Refreshing display type on next animation"),delete o.displayType},forceRepaint:function(){w.verbose("Forcing element repaint");var a=x.parent(),b=x.next();0===b.size()?x.detach().appendTo(a):x.detach().insertBefore(b)},repaint:function(){w.verbose("Repainting element");y.offsetWidth},animate:function(a){return b=a||b,w.is.supported()?(w.debug("Preparing animation",b.animation),w.is.animating()&&b.queue?(!b.allowRepeats&&w.has.direction()&&w.is.occuring()&&o.queuing!==!0?w.error(p.repeated):w.queue(b.animation),!1):void(w.can.animate?w.set.animating(b.animation):w.error(p.noAnimation,b.animation))):(w.error(p.support),!1)},reset:function(){w.debug("Resetting animation to beginning conditions"),x.off(s),w.restore.conditions(),w.hide(),w.remove.animating()},queue:function(a){w.debug("Queueing animation of",a),o.queuing=!0,x.one(s,function(){o.queuing=!1,w.repaint(),w.animate.apply(this,b)})},complete:function(){w.verbose("CSS animation complete",b.animation),w.is.looping()||(w.is.outward()?(w.verbose("Animation is outward, hiding element"),w.restore.conditions(),w.remove.display(),w.hide(),a.proxy(b.onHide,this)()):w.is.inward()?(w.verbose("Animation is outward, showing element"),w.restore.conditions(),w.show(),a.proxy(b.onShow,this)()):w.restore.conditions(),w.remove.duration(),w.remove.animating()),a.proxy(b.complete,this)()},has:{direction:function(a){return a=a||b.animation,-1!==a.search(q.inward)||-1!==a.search(q.outward)?(w.debug("Direction already set in animation"),!0):!1}},set:{animating:function(a){a=a||b.animation,w.save.conditions(),w.can.transition()&&!w.has.direction()&&w.set.direction(),w.remove.hidden(),w.set.display(),x.addClass(q.animating).addClass(q.transition).addClass(a).one(s,w.complete),w.set.duration(b.duration),w.debug("Starting tween",b.animation,x.attr("class"))},display:function(){var a=x.css("style"),b=w.get.displayType(),c=a+";display: "+b+" !important;";"block"!==b&&(w.verbose("Setting final visibility to",b),x.attr("style",c))},direction:function(){x.is(":visible")?(w.debug("Automatically determining the direction of animation","Outward"),x.removeClass(q.inward).addClass(q.outward)):(w.debug("Automatically determining the direction of animation","Inward"),x.removeClass(q.outward).addClass(q.inward))},looping:function(){w.debug("Transition set to loop"),x.addClass(q.looping)},duration:function(a){a=a||b.duration,a="number"==typeof a?a+"ms":a,w.verbose("Setting animation duration",a),x.css({"-webkit-animation-duration":a,"-moz-animation-duration":a,"-ms-animation-duration":a,"-o-animation-duration":a,"animation-duration":a})},hidden:function(){x.addClass(q.transition).addClass(q.hidden),n(function(){"none"!==x.css("display")&&(w.verbose("Overriding default display to hide element"),x.css("display","none"))})},visible:function(){x.addClass(q.transition).addClass(q.visible)}},save:{displayType:function(a){o.displayType=a},transitionExists:function(b,c){a.fn.transition.exists[b]=c,w.verbose("Saving existence of transition",b,c)},conditions:function(){o.cache={className:x.attr("class"),style:x.attr("style")},w.verbose("Saving original attributes",o.cache)}},restore:{conditions:function(){return o.cache===d?!1:(o.cache.className?x.