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.
11 lines
11 KiB
11 lines
11 KiB
/*
|
|
* # Semantic UI
|
|
* git://github.com/Semantic-Org/Semantic-UI.git#1.0
|
|
*
|
|
*
|
|
* Copyright 2014 Contributors
|
|
* Released under the MIT license
|
|
* http://opensource.org/licenses/MIT
|
|
*
|
|
*/
|
|
!function(n,i,e,t){"use strict";n.fn.transition=function(){{var a,o=n(this),s=o.selector||"",r=(new Date).getTime(),d=[],c=arguments,l=c[0],m=[].slice.call(arguments,1),u="string"==typeof l;i.requestAnimationFrame||i.mozRequestAnimationFrame||i.webkitRequestAnimationFrame||i.msRequestAnimationFrame||function(n){setTimeout(n,0)}}return o.each(function(){var i,p,f,g,v,b,y,h,w,C,T,A=n(this),x=this;T={initialize:function(){w="module-"+h,i=T.get.settings.apply(x,c),g=i.className,v=i.metadata,b=T.get.animationEvent(),y=T.get.animationName(),f=i.error,h=i.namespace,C="."+i.namespace,p=A.data(w)||T,u&&(u=T.invoke(l)),u===!1&&(T.verbose("Converted arguments into settings object",i),T.animate(),T.instantiate())},instantiate:function(){T.verbose("Storing instance of module",T),A.data(w,p)},destroy:function(){T.verbose("Destroying previous module for",x),A.removeData(w)},refresh:function(){T.verbose("Refreshing display type on next animation"),delete T.displayType},forceRepaint:function(){T.verbose("Forcing element repaint");var n=A.parent(),i=A.next();0===i.size()?A.detach().appendTo(n):A.detach().insertBefore(i)},repaint:function(){T.verbose("Repainting element");x.offsetWidth},animate:function(n){return i=n||i,T.is.supported()?(T.debug("Preparing animation",i.animation),T.is.animating()&&i.queue?(!i.allowRepeats&&T.has.direction()&&T.is.occuring()&&T.queuing!==!0?T.error(f.repeated,i.animation,A):T.queue(i.animation),!1):void(T.can.animate?T.set.animating(i.animation):T.error(f.noAnimation,i.animation))):(T.error(f.support),!1)},reset:function(){T.debug("Resetting animation to beginning conditions"),A.off(b+C),T.restore.conditions(),T.hide(),T.remove.animating()},queue:function(n){T.debug("Queueing animation of",n),T.queuing=!0,A.one(b+C,function(){T.queuing=!1,T.repaint(),T.animate.apply(this,i)})},complete:function(){T.verbose("CSS animation complete",i.animation),T.is.looping()||(T.is.outward()?(T.verbose("Animation is outward, hiding element"),T.restore.conditions(),T.remove.display(),T.hide(),n.proxy(i.onHide,this)()):T.is.inward()?(T.verbose("Animation is outward, showing element"),T.restore.conditions(),T.set.display(),T.show(),n.proxy(i.onShow,this)()):T.restore.conditions(),T.remove.duration(),T.remove.animating()),n.proxy(i.complete,this)()},has:{direction:function(n){return n=n||i.animation,-1!==n.search(g.inward)||-1!==n.search(g.outward)?(T.debug("Direction already set in animation"),!0):!1}},set:{animating:function(e){e=e||i.animation,T.is.animating()||T.save.conditions(),T.remove.direction(),A.off(".complete"),T.can.transition()&&!T.has.direction()&&T.set.direction(),T.remove.hidden(),T.set.display(),A.addClass(g.animating).addClass(g.transition).addClass(e).one(b+".complete"+C,T.complete),T.set.duration(i.duration),n.proxy(i.start,this)(),T.debug("Starting tween",e,A.attr("class"))},display:function(){var n=T.get.style(),i=T.get.displayType(),e=n+"display: "+i+" !important;";A.css("display")!==i&&(T.verbose("Setting inline visibility to",i),A.attr("style",e))},direction:function(){A.is(":visible")&&!T.is.hidden()?(T.debug("Automatically determining the direction of animation","Outward"),A.removeClass(g.inward).addClass(g.outward)):(T.debug("Automatically determining the direction of animation","Inward"),A.removeClass(g.outward).addClass(g.inward))},looping:function(){T.debug("Transition set to loop"),A.addClass(g.looping)},duration:function(n){n=n||i.duration,n="number"==typeof n?n+"ms":n,T.verbose("Setting animation duration",n),A.css({"-webkit-animation-duration":n,"-moz-animation-duration":n,"-ms-animation-duration":n,"-o-animation-duration":n,"animation-duration":n})},hidden:function(){T.is.hidden()||(A.addClass(g.transition).addClass(g.hidden),"none"!==A.css("display")&&(T.verbose("Overriding default display to hide element"),A.css("display","none")))},visible:function(){A.addClass(g.transition).addClass(g.visible)}},save:{displayType:function(n){T.displayType=n},transitionExists:function(i,e){n.fn.transition.exists[i]=e,T.verbose("Saving existence of transition",i,e)},conditions:function(){A.attr("class")||!1,A.attr("style")||"";A.removeClass(i.animation),T.remove.direction(),T.cache={className:A.attr("class"),style:T.get.style()},T.verbose("Saving original attributes",T.cache)}},restore:{conditions:function(){return T.cache===t?!1:(T.cache.className?A.attr("class",T.cache.className):A.removeAttr("class"),T.cache.style&&(T.verbose("Restoring original style attribute",T.cache.style),A.attr("style",T.cache.style)),T.is.looping()&&T.remove.looping(),void T.verbose("Restoring original attributes",T.cache))}},remove:{animating:function(){A.removeClass(g.animating)},display:function(){T.displayType!==t&&A.css("display","")},direction:function(){A.removeClass(g.inward).removeClass(g.outward)},duration:function(){A.css({"-webkit-animation-duration":"","-moz-animation-duration":"","-ms-animation-duration":"","-o-animation-duration":"","animation-duration":""})},hidden:function(){A.removeClass(g.hidden)},visible:function(){A.removeClass(g.visible)},looping:function(){T.debug("Transitions are no longer looping"),A.removeClass(g.looping),T.forceRepaint()},transition:function(){A.removeClass(g.visible).removeClass(g.hidden)}},get:{settings:function(i,e,t){return"object"==typeof i?n.extend(!0,{},n.fn.transition.settings,i):"function"==typeof t?n.extend({},n.fn.transition.settings,{animation:i,complete:t,duration:e}):"string"==typeof e||"number"==typeof e?n.extend({},n.fn.transition.settings,{animation:i,duration:e}):"object"==typeof e?n.extend({},n.fn.transition.settings,e,{animation:i}):"function"==typeof e?n.extend({},n.fn.transition.settings,{animation:i,complete:e}):n.extend({},n.fn.transition.settings,{animation:i})},displayType:function(){return T.displayType===t&&T.can.transition(),T.displayType},style:function(){var n=A.attr("style")||"";return n.replace(/display.*?;/,"")},transitionExists:function(i){return n.fn.transition.exists[i]},animationName:function(){var n,i=e.createElement("div"),a={animation:"animationName",OAnimation:"oAnimationName",MozAnimation:"mozAnimationName",WebkitAnimation:"webkitAnimationName"};for(n in a)if(i.style[n]!==t)return a[n];return!1},animationEvent:function(){var n,i=e.createElement("div"),a={animation:"animationend",OAnimation:"oAnimationEnd",MozAnimation:"mozAnimationEnd",WebkitAnimation:"webkitAnimationEnd"};for(n in a)if(i.style[n]!==t)return a[n];return!1}},can:{animate:function(){return"none"!==A.css(i.animation)?(T.debug("CSS definition found",A.css(i.animation)),!0):(T.debug("Unable to find css definition",A.attr("class")),!1)},transition:function(){var e,a,o,s,r=A.attr("class"),d=A.prop("tagName"),c=i.animation,l=T.get.transitionExists(i.animation);return(l===t||T.displayType===t)&&(T.verbose("Determining whether animation exists"),e=n("<"+d+" />").addClass(r).insertAfter(A),a=e.addClass(c).removeClass(g.inward).removeClass(g.outward).addClass(g.animating).addClass(g.transition).css(y),o=e.addClass(g.inward).css(y),s=e.attr("class",r).removeAttr("style").removeClass(g.visible).show().css("display"),T.verbose("Determining final display state",s),a!=o?(T.debug("Transition exists for animation",c),l=!0):(T.debug("Static animation found",c,s),l=!1),e.remove(),T.save.displayType(s),l===t&&T.save.transitionExists(c,l)),l}},is:{animating:function(){return A.hasClass(g.animating)},inward:function(){return A.hasClass(g.inward)},outward:function(){return A.hasClass(g.outward)},looping:function(){return A.hasClass(g.looping)},occuring:function(n){return n=n||i.animation,n=n.replace(" ","."),A.filter(n).size()>0},visible:function(){return A.is(":visible")},hidden:function(){return"hidden"===A.css("visibility")},supported:function(){return y!==!1&&b!==!1}},hide:function(){T.verbose("Hiding element"),T.remove.visible(),T.set.hidden(),T.repaint()},show:function(n){T.verbose("Showing element",n),T.remove.hidden(),T.set.visible(),T.repaint()},start:function(){T.verbose("Starting animation"),A.removeClass(g.disabled)},stop:function(){T.debug("Stopping animation"),A.addClass(g.disabled)},toggle:function(){T.debug("Toggling play status"),A.toggleClass(g.disabled)},setting:function(e,a){if(T.debug("Changing setting",e,a),n.isPlainObject(e))n.extend(!0,i,e);else{if(a===t)return i[e];i[e]=a}},internal:function(i,e){if(n.isPlainObject(i))n.extend(!0,T,i);else{if(e===t)return T[i];T[i]=e}},debug:function(){i.debug&&(i.performance?T.performance.log(arguments):(T.debug=Function.prototype.bind.call(console.info,console,i.name+":"),T.debug.apply(console,arguments)))},verbose:function(){i.verbose&&i.debug&&(i.performance?T.performance.log(arguments):(T.verbose=Function.prototype.bind.call(console.info,console,i.name+":"),T.verbose.apply(console,arguments)))},error:function(){T.error=Function.prototype.bind.call(console.error,console,i.name+":"),T.error.apply(console,arguments)},performance:{log:function(n){var e,t,a;i.performance&&(e=(new Date).getTime(),a=r||e,t=e-a,r=e,d.push({Name:n[0],Arguments:[].slice.call(n,1)||"",Element:x,"Execution Time":t})),clearTimeout(T.performance.timer),T.performance.timer=setTimeout(T.performance.display,600)},display:function(){var e=i.name+":",a=0;r=!1,clearTimeout(T.performance.timer),n.each(d,function(n,i){a+=i["Execution Time"]}),e+=" "+a+"ms",s&&(e+=" '"+s+"'"),o.size()>1&&(e+=" ("+o.size()+")"),(console.group!==t||console.table!==t)&&d.length>0&&(console.groupCollapsed(e),console.table?console.table(d):n.each(d,function(n,i){console.log(i.Name+": "+i["Execution Time"]+"ms")}),console.groupEnd()),d=[]}},invoke:function(i,e,o){var s,r,d,c=p;return e=e||m,o=x||o,"string"==typeof i&&c!==t&&(i=i.split(/[\. ]/),s=i.length-1,n.each(i,function(e,a){var o=e!=s?a+i[e+1].charAt(0).toUpperCase()+i[e+1].slice(1):i;if(n.isPlainObject(c[o])&&e!=s)c=c[o];else{if(c[o]!==t)return r=c[o],!1;if(!n.isPlainObject(c[a])||e==s)return c[a]!==t?(r=c[a],!1):!1;c=c[a]}})),n.isFunction(r)?d=r.apply(o,e):r!==t&&(d=r),n.isArray(a)?a.push(d):a!==t?a=[a,d]:d!==t&&(a=d),r!==t?r:!1}},T.initialize()}),a!==t?a:this},n.fn.transition.exists={},n.fn.transition.settings={name:"Transition",debug:!1,verbose:!0,performance:!0,namespace:"transition",start:function(){},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);
|