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

!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.attr("class",o.cache.className):x.removeAttr("class"),o.cache.style?x.attr("style",o.cache.style):"block"===w.get.displayType()&&x.removeAttr("style"),w.is.looping()&&w.remove.looping(),void w.verbose("Restoring original attributes",o.cache))}},remove:{animating:function(){x.removeClass(q.animating)},display:function(){o.displayType!==d&&x.css("display","")},duration:function(){x.css({"-webkit-animation-duration":"","-moz-animation-duration":"","-ms-animation-duration":"","-o-animation-duration":"","animation-duration":""})},hidden:function(){x.removeClass(q.hidden)},visible:function(){x.removeClass(q.visible)},looping:function(){w.debug("Transitions are no longer looping"),x.removeClass(q.looping),w.forceRepaint()},transition:function(){x.removeClass(q.visible).removeClass(q.hidden)}},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 o.displayType===d&&w.can.transition(),o.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 w.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 w.verbose("Determined animation vendor end event",e[a]),e[a];return!1}},can:{animate:function(){return"none"!==x.css(b.animation)?(w.debug("CSS definition found",x.css(b.animation)),!0):(w.debug("Unable to find css definition",x.attr("class")),!1)},transition:function(){var c,e,f,g,h=x.attr("class"),i=b.animation,j=w.get.transitionExists(b.animation);return(j===d||o.displayType===d)&&(w.verbose("Determining whether animation exists"),c=a("<div>").addClass(h).appendTo(a("body")),e=c.removeClass(q.inward).removeClass(q.outward).addClass(q.animating).addClass(q.transition).addClass(i).css(t),f=c.addClass(q.inward).css(t),g=c.attr("class",h).show().css("display"),w.verbose("Determining final display state",g),e!=f?(w.debug("Transition exists for animation",i),j=!0):(w.debug("Static animation found",i,g),j=!1),c.remove(),w.save.displayType(g),w.save.transitionExists(i,j)),j}},is:{animating:function(){return x.hasClass(q.animating)},inward:function(){return x.hasClass(q.inward)},outward:function(){return x.hasClass(q.outward)},looping:function(){return x.hasClass(q.looping)},occuring:function(a){return a=a||b.animation,x.hasClass(a)},visible:function(){return x.is(":visible")},supported:function(){return t!==!1&&s!==!1}},hide:function(){w.verbose("Hiding element"),w.remove.visible(),w.set.hidden(),w.repaint()},show:function(a){w.verbose("Showing element",a),w.remove.hidden(),w.set.visible(),w.repaint()},start:function(){w.verbose("Starting animation"),x.removeClass(q.disabled)},stop:function(){w.debug("Stopping animation"),x.addClass(q.disabled)},toggle:function(){w.debug("Toggling play status"),x.toggleClass(q.disabled)},setting:function(c,e){if(w.debug("Changing setting",c,e),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,w,b);else{if(c===d)return w[b];w[b]=c}},debug:function(){b.debug&&(b.performance?w.performance.log(arguments):(w.debug=Function.prototype.bind.call(console.info,console,b.name+":"),w.debug.apply(console,arguments)))},verbose:function(){b.verbose&&b.debug&&(b.performance?w.performance.log(arguments):(w.verbose=Function.prototype.bind.call(console.info,console,b.name+":"),w.verbose.apply(console,arguments)))},error:function(){w.error=Function.prototype.bind.call(console.error,console,b.name+":"),w.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:y,Name:a[0],Arguments:[].slice.call(a,1)||"","Execution Time":d})),clearTimeout(w.performance.timer),w.performance.timer=setTimeout(w.performance.display,100)},display:function(){var c=b.name+":",e=0;h=!1,clearTimeout(w.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=o;return c=c||l,f=y||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}},w.initialize()}),e!==d?e:this},a.fn.transition.exists={},a.fn.transition.settings={name:"Transition",debug:!1,verbose:!1,performance:!1,namespace:"transition",complete:function(){},onShow:function(){},onHide:function(){},allowRepeats:!1,animation:"fade",duration:"500ms",queue:!0,className:{animating:"animating",disabled:"disabled",hidden:"hidden",inward:"in",loading:"loading",looping:"looping",outward:"out",transition:"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);