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
7.7 KiB

11 years ago
  1. !function(a,b,c,d){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;b.requestAnimationFrame||b.mozRequestAnimationFrame||b.webkitRequestAnimationFrame||b.msRequestAnimationFrame||function(a){setTimeout(a,0)}}return f.each(function(){var b,n,o,p,q,r,s,t,u,v,w=a(this),x=this;v={initialize:function(){b=v.get.settings.apply(x,j),v.verbose("Converted arguments into settings object",b),o=b.error,p=b.className,t=b.namespace,q=b.metadata,u="module-"+t,r=v.get.animationEvent(),s=v.get.animationName(),n=w.data(u),n===d&&v.instantiate(),m&&(m=v.invoke(k)),m===!1&&v.animate()},instantiate:function(){v.verbose("Storing instance of module",v),n=v,w.data(u,n)},destroy:function(){v.verbose("Destroying previous module for",x),w.removeData(u)},animate:function(a){return b=a||b,v.is.supported()?(v.debug("Preparing animation",b.animation),v.is.animating()?(b.queue&&v.queue(b.animation),!1):(v.save.conditions(),v.set.duration(b.duration),v.set.animating(),v.repaint(),w.addClass(p.transition).addClass(b.animation).one(r,v.complete),!v.has.direction()&&v.can.transition()&&v.set.direction(),v.has.transitionAvailable?(v.show(),v.debug("Starting tween",b.animation,w.attr("class")),void 0):(v.restore.conditions(),v.error(o.noAnimation),!1))):(v.error(o.support),!1)},queue:function(a){v.debug("Queueing animation of",a),n.queuing=!0,w.one(r,function(){n.queuing=!1,v.animate.apply(this,b)})},complete:function(){v.verbose("CSS animation complete",b.animation),v.is.looping()||(w.hasClass(p.outward)?(v.restore.conditions(),v.hide(),a.proxy(b.onHide,this)()):w.hasClass(p.inward)?(v.restore.conditions(),v.show(),a.proxy(b.onShow,this)()):v.restore.conditions(),v.remove.animating()),a.proxy(b.complete,this)()},repaint:function(a){v.verbose("Forcing repaint event"),a=x.offsetWidth},has:{direction:function(a){return a=a||b.animation,w.hasClass(p.inward)||w.hasClass(p.outward)?!0:void 0},transitionAvailable:function(){return"none"!==w.css(s)?(v.debug("CSS definition found"),!0):(v.debug("Unable to find css definition"),!1)}},set:{animating:function(){w.addClass(p.animating)},direction:function(){w.is(":visible")?(v.debug("Automatically determining the direction of animation","Outward"),w.addClass(p.outward).removeClass(p.inward)):(v.debug("Automatically determining the direction of animation","Inward"),w.addClass(p.inward).removeClass(p.outward))},looping:function(){v.debug("Transition set to loop"),w.addClass(p.looping)},duration:function(a){a=a||b.duration,a="number"==typeof a?a+"ms":a,v.verbose("Setting animation duration",a),w.css({"-webkit-animation-duration":a,"-moz-animation-duration":a,"-ms-animation-duration":a,"-o-animation-duration":a,"animation-duration":a})}},save:{conditions:function(){v.cache={className:w.attr("class"),style:w.attr("style")},v.verbose("Saving original attributes",v.cache)}},restore:{conditions:function(){return typeof v.cache===d?(v.error(o.cache),!1):(v.cache.className?w.attr("class",v.cache.className):w.removeAttr("class"),v.cache.style?w.attr("style",v.cache.style):w.removeAttr("style"),v.is.looping()&&v.remove.looping(),v.verbose("Restoring original attributes",v.cache),void 0)}},remove:{animating:function(){w.removeClass(p.animating)},looping:function(){v.debug("Transitions are no longer looping"),w.removeClass(p.looping),v.repaint()}},get:{settings:function(b,c,d){return a.isPlainObject(b)?a.extend(!0,{},a.fn.transition.settings,b):"function"==typeof d?a.extend(!0,{},a.fn.transition.settings,{animation:b,complete:d,duration:c}):"string"==typeof c||"number"==typeof c?a.extend(!0,{},a.fn.transition.settings,{animation:b,duration:c}):"object"==typeof c?a.extend(!0,{},a.fn.transition.settings,c,{animation:b}):"function"==typeof c?a.extend(!0,{},a.fn.transition.settings,{animation:b,complete:c}):a.extend(!0,{},a.fn.transition.settings,{animation:b})},animationName:function(){var a,b=c.createElement("div"),e={animation:"animationName",OAnimation:"oAnimationName",MozAnimation:"mozAnimationName",WebkitAnimation:"webkitAni