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.
 
 
 

1 lines
9.7 KiB

!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)||v,m&&(m=v.invoke(k)),m===!1&&v.animate(),v.instantiate()},instantiate:function(){v.verbose("Storing instance of module",v),w.data(u,n)},destroy:function(){v.verbose("Destroying previous module for",x),w.removeData(u)},refresh:function(){v.verbose("Refreshing display type on next animation"),delete n.displayType},forceRepaint:function(){v.verbose("Forcing element repaint");var a=w.parent(),b=w.next();0===b.size()?w.detach().appendTo(a):w.detach().insertBefore(b)},repaint:function(){v.verbose("Repainting element");x.offsetWidth},animate:function(a){return b=a||b,v.is.supported()?(v.debug("Preparing animation",b.animation),v.is.animating()&&b.queue?(!b.allowRepeats&&v.has.direction()&&v.is.occuring()&&n.queuing!==!0?v.error(o.repeated):v.queue(b.animation),!1):(v.can.animate?v.set.animating(b.animation):v.error(o.noAnimation,b.animation),void 0)):(v.error(o.support),!1)},reset:function(){v.debug("Resetting animation to beginning conditions"),v.restore.conditions(),v.hide(),v.remove.animating()},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()||(v.is.outward()?(v.verbose("Animation is outward, hiding element"),v.restore.conditions(),v.remove.display(),v.hide(),a.proxy(b.onHide,this)()):v.is.inward()?(v.verbose("Animation is outward, showing element"),v.restore.conditions(),v.show(),a.proxy(b.onShow,this)()):v.restore.conditions(),v.remove.duration(),v.remove.animating()),a.proxy(b.complete,this)()},has:{direction:function(a){return a=a||b.animation,-1!==a.search(p.inward)||-1!==a.search(p.outward)?(v.debug("Direction already set in animation"),!0):!1}},set:{animating:function(a){a=a||b.animation,v.save.conditions(),v.can.transition()&&!v.has.direction()&&v.set.direction(),v.remove.hidden(),v.set.display(),w.addClass(p.animating).addClass(p.transition).addClass(a).one(r,v.complete),v.set.duration(b.duration),v.debug("Starting tween",b.animation,w.attr("class"))},display:function(){var a=v.get.displayType();"block"!==a&&(v.verbose("Setting final visibility to",a),w.css({display:a}))},direction:function(){w.is(":visible")?(v.debug("Automatically determining the direction of animation","Outward"),w.removeClass(p.inward).addClass(p.outward)):(v.debug("Automatically determining the direction of animation","Inward"),w.removeClass(p.outward).addClass(p.inward))},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})},hidden:function(){w.addClass(p.transition).addClass(p.hidden)},visible:function(){w.addClass(p.transition).addClass(p.visible)}},save:{displayType:function(a){n.displayType=a},transitionExists:function(b,c){a.fn.transition.exists[b]=c,v.verbose("Saving existence of transition",b,c)},conditions:function(){n.cache={className:w.attr("class"),style:w.attr("style")},v.verbose("Saving original attributes",n.cache)}},restore:{conditions:function(){return n.cache===d?!1:(n.cache.className?w.attr("class",n.cache.className):w.removeAttr("class"),n.cache.style?w.attr("style",n.cache.style):"block"===v.get.displayType()&&w.removeAttr("style"),v.is.looping()&&v.remove.looping(),v.verbose("Restoring original attributes",n.cache),void 0)}},remove:{animating:function(){w.removeClass(p.animating)},display:function(){n.displayType!==d&&w.css("display","")},duration:function(){w.css({"-webkit-animation-duration":"","-moz-animation-duration":"","-ms-animation-duration":"","-o-animation-duration":"","animation-duration":""})},hidden:function(){w.removeClass(p.hidden)},visible:function(){w.removeClass(p.visible)},looping:function(){v.debug("Transitions are no longer looping"),w.removeClass(p.looping),v.forceRepaint()}},get:{settings:function(b,c,d){return"object"==typeof b?a.extend(!0,{},a.fn.transition.settings,b):"function"==typeof d?a.extend({},a.fn.transition.settings,{animation:b,complete:d,duration:c}):"string"==typeof c||"number"==typeof c?a.extend({},a.fn.transition.settings,{animation:b,duration:c}):"object"==typeof c?a.extend({},a.fn.transition.settings,c,{animation:b}):"function"==typeof c?a.extend({},a.fn.transition.settings,{animation:b,complete:c}):a.extend({},a.fn.transition.settings,{animation:b})},displayType:function(){return n.displayType===d&&v.can.transition(),n.displayType},transitionExists:function(b){return a.fn.transition.exists[b]},animationName:function(){var a,b=c.createElement("div"),e={animation:"animationName",OAnimation:"oAnimationName",MozAnimation:"mozAnimationName",WebkitAnimation:"webkitAnimationName"};for(a in e)if(b.style[a]!==d)return v.verbose("Determined animation vendor name property",e[a]),e[a];return!1},animationEvent:function(){var a,b=c.createElement("div"),e={animation:"animationend",OAnimation:"oAnimationEnd",MozAnimation:"mozAnimationEnd",WebkitAnimation:"webkitAnimationEnd"};for(a in e)if(b.style[a]!==d)return v.verbose("Determined animation vendor end event",e[a]),e[a];return!1}},can:{animate:function(){return"none"!==w.css(b.animation)?(v.debug("CSS definition found",w.css(b.animation)),!0):(v.debug("Unable to find css definition",w.attr("class")),!1)},transition:function(){var c,e,f,g,h=w.attr("class"),i=b.animation,j=v.get.transitionExists(b.animation);return(j===d||n.displayType===d)&&(v.verbose("Determining whether animation exists"),c=a("<div>").addClass(h).appendTo(a("body")),e=c.removeClass(p.inward).removeClass(p.outward).addClass(p.animating).addClass(p.transition).addClass(i).css(s),f=c.addClass(p.inward).css(s),g=c.attr("class",h).show().css("display"),v.verbose("Determining final display state",g),e!=f?(v.debug("Transition exists for animation",i),j=!0):(v.debug("Static animation found",i,g),j=!1),c.remove(),v.save.displayType(g),v.save.transitionExists(i,j)),j}},is:{animating:function(){return w.hasClass(p.animating)},inward:function(){return w.hasClass(p.inward)},outward:function(){return w.hasClass(p.outward)},looping:function(){return w.hasClass(p.looping)},occuring:function(a){return a=a||b.animation,w.hasClass(a)},visible:function(){return w.is(":visible")},supported:function(){return s!==!1&&r!==!1}},hide:function(){v.verbose("Hiding element"),v.remove.visible(),v.set.hidden(),v.repaint()},show:function(a){v.verbose("Showing element",a),v.remove.hidden(),v.set.visible(),v.repaint()},start:function(){v.verbose("Starting animation"),w.removeClass(p.disabled)},stop:function(){v.debug("Stopping animation"),w.addClass(p.disabled)},toggle:function(){v.debug("Toggling play status"),w.toggleClass(p.disabled)},setting:function(c,e){if(a.isPlainObject(c))a.extend(!0,b,c);else{if(e===d)return b[c];b[c]=e}},internal:function(b,c){if(a.isPlainObject(b))a.extend(!0,v,b);else{if(c===d)return v[b];v[b]=c}},debug:function(){b.debug&&(b.performance?v.performance.log(arguments):(v.debug=Function.prototype.bind.call(console.info,console,b.name+":"),v.debug.apply(console,arguments)))},verbose:function(){b.verbose&&b.debug&&(b.performance?v.performance.log(arguments):(v.verbose=Function.prototype.bind.call(console.info,console,b.name+":"),v.verbose.apply(console,arguments)))},error:function(){v.error=Function.prototype.bind.call(console.error,console,b.name+":"),v.error.apply(console,arguments)},performance:{log:function(a){var c,d,e;b.performance&&(c=(new Date).getTime(),e=h||c,d=c-e,h=c,i.push({Element:x,Name:a[0],Arguments:[].slice.call(a,1)||"","Execution Time":d})),clearTimeout(v.performance.timer),v.performance.timer=setTimeout(v.performance.display,100)},display:function(){var c=b.name+":",e=0;h=!1,clearTimeout(v.performance.timer),a.each(i,function(a,b){e+=b["Execution Time"]}),c+=" "+e+"ms",g&&(c+=" '"+g+"'"),f.size()>1&&(c+=" ("+f.size()+")"),(console.group!==d||console.table!==d)&&i.length>0&&(console.groupCollapsed(c),console.table?console.table(i):a.each(i,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),i=[]}},invoke:function(b,c,f){var g,h,i,j=n;return c=c||l,f=x||f,"string"==typeof b&&j!==d&&(b=b.split(/[\. ]/),g=b.length-1,a.each(b,function(c,e){var f=c!=g?e+b[c+1].charAt(0).toUpperCase()+b[c+1].slice(1):b;if(a.isPlainObject(j[f])&&c!=g)j=j[f];else{if(j[f]!==d)return h=j[f],!1;if(!a.isPlainObject(j[e])||c==g)return j[e]!==d?(h=j[e],!1):!1;j=j[e]}})),a.isFunction(h)?i=h.apply(f,c):h!==d&&(i=h),a.isArray(e)?e.push(i):e!==d?e=[e,i]:i!==d&&(e=i),h||!1}},v.initialize()}),e!==d?e:this},a.fn.transition.exists={},a.fn.transition.settings={name:"Transition",debug:!1,verbose:!0,performance:!0,namespace:"transition",complete:function(){},onShow:function(){},onHide:function(){},allowRepeats:!1,animation:"fade",duration:"700ms",queue:!0,className:{animating:"animating",disabled:"disabled",hidden:"hidden",inward:"in",loading:"loading",looping:"looping",outward:"out",transition:"ui transition",visible:"visible"},error:{noAnimation:"There is no css animation matching the one you specified.",repeated:"That animation is already occurring, cancelling repeated animation",method:"The method you called is not defined",support:"This browser does not support CSS animations"}}}(jQuery,window,document);