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
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;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,x=a(this),y=this;w={initialize:function(){u="module-"+t,b=w.get.settings.apply(y,j),p=b.className,q=b.metadata,r=w.get.animationEvent(),s=w.get.animationName(),o=b.error,t=b.namespace,v="."+b.namespace,n=x.data(u)||w,m&&(m=w.invoke(k)),m===!1&&(w.verbose("Converted arguments into settings object",b),w.animate(),w.instantiate())},instantiate:function(){w.verbose("Storing instance of module",w),x.data(u,n)},destroy:function(){w.verbose("Destroying previous module for",y),x.removeData(u)},refresh:function(){w.verbose("Refreshing display type on next animation"),delete w.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()&&w.queuing!==!0?w.error(o.repeated):w.queue(b.animation),!1):void(w.can.animate?w.set.animating(b.animation):w.error(o.noAnimation,b.animation))):(w.error(o.support),!1)},reset:function(){w.debug("Resetting animation to beginning conditions"),x.off(r+v),w.restore.conditions(),w.hide(),w.remove.animating()},queue:function(a){w.debug("Queueing animation of",a),w.queuing=!0,x.one(r+v,function(){w.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.set.display(),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(p.inward)||-1!==a.search(p.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(p.animating).addClass(p.transition).addClass(a).one(r+v,w.complete),w.set.duration(b.duration),w.debug("Starting tween",a,x.attr("class"))},display:function(){var a=w.get.style(),b=w.get.displayType(),c=a+"display: "+b+" !important;";x.css("display")!==b&&(w.verbose("Setting inline visibility to",b),x.attr("style",c))},direction:function(){x.is(":visible")&&!w.is.hidden()?(w.debug("Automatically determining the direction of animation","Outward"),x.removeClass(p.inward).addClass(p.outward)):(w.debug("Automatically determining the direction of animation","Inward"),x.removeClass(p.outward).addClass(p.inward))},looping:function(){w.debug("Transition set to loop"),x.addClass(p.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(){w.is.hidden()||(x.addClass(p.transition).addClass(p.hidden),"none"!==x.css("display")&&(w.verbose("Overriding default display to hide element"),x.css("display","none")))},visible:function(){x.addClass(p.transition).addClass(p.visible)}},save:{displayType:function(a){w.displayType=a},transitionExists:function(b,c){a.fn.transition.exists[b]=c,w.verbose("Saving existence of transition",b,c)},conditions:function(){x.attr("class")||!1,x.attr("style")||"";w.cache={className:x.attr("class"),style:w.get.style()},w.verbose("Saving original attributes",w.cache)}},restore:{conditions:function(){return w.cache===d?!1:(w.cache.className?x.attr("class",w.cache.className):x.removeAttr("class"),w.cache.style&&(w.verbose("Restoring original style attribute",w.cache.style),x.attr("style",w.cache.style)),w.is.looping()&&w.remove.looping(),void w.verbose("Restoring original attributes",w.cache))}},remove:{animating:function(){x.removeClass(p.animating)},display:function(){w.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(p.hidden)},visible:function(){x.removeClass(p.visible)},looping:function(){w.debug("Transitions are no longer looping"),x.removeClass(p.looping),w.forceRepaint()},transition:function(){x.removeClass(p.visible).removeClass(p.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 w.displayType===d&&w.can.transition(),w.displayType},style:function(){var a=x.attr("style")||"";return a.replace(/display.*?;/,"")},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 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 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=x.prop("tagName"),j=b.animation,k=w.get.transitionExists(b.animation);return(k===d||w.displayType===d)&&(w.verbose("Determining whether animation exists"),c=a("<"+i+" />").addClass(h).insertAfter(x),e=c.addClass(j).removeClass(p.inward).removeClass(p.outward).addClass(p.animating).addClass(p.transition).css(s),f=c.addClass(p.inward).css(s),g=c.attr("class",h).removeAttr("style").removeClass(p.visible).show().css("display"),w.verbose("Determining final display state",g),e!=f?(w.debug("Transition exists for animation",j),k=!0):(w.debug("Static animation found",j,g),k=!1),c.remove(),w.save.displayType(g),k===d&&w.save.transitionExists(j,k)),k}},is:{animating:function(){return x.hasClass(p.animating)},inward:function(){return x.hasClass(p.inward)},outward:function(){return x.hasClass(p.outward)},looping:function(){return x.hasClass(p.looping)},occuring:function(a){return a=a||b.animation,x.hasClass(a)},visible:function(){return x.is(":visible")},hidden:function(){return"hidden"===x.css("visibility")},supported:function(){return s!==!1&&r!==!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(p.disabled)},stop:function(){w.debug("Stopping animation"),x.addClass(p.disabled)},toggle:function(){w.debug("Toggling play status"),x.toggleClass(p.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({Name:a[0],Arguments:[].slice.call(a,1)||"",Element:y,"Execution Time":d})),clearTimeout(w.performance.timer),w.performance.timer=setTimeout(w.performance.display,600)},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=n;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!==d?h:!1}},w.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:"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);
|