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
|
|
* https://github.com/Semantic-Org/Semantic-UI
|
|
* http://www.semantic-ui.com/
|
|
*
|
|
* 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=[],l=arguments,m=l[0],c=[].slice.call(arguments,1),u="string"==typeof m;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,C,w,T,A=n(this),x=this;T={initialize:function(){C="module-"+h,i=T.get.settings.apply(x,l),g=i.className,v=i.metadata,b=T.get.animationEvent(),y=T.get.animationName(),f=i.error,h=i.namespace,w="."+i.namespace,p=A.data(C)||T,u&&(u=T.invoke(m)),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(C,p)},destroy:function(){T.verbose("Destroying previous module for",x),A.removeData(C)},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"),T.remove.animationEndCallback(),T.restore.conditions(),T.remove.animating()},queue:function(n){T.debug("Queueing animation of",n),T.queuing=!0,A.one(b+w,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.hide(),n.proxy(i.onHide,this)()):T.is.inward()?(T.verbose("Animation is outward, showing element"),T.restore.conditions(),T.show(),T.set.display(),n.proxy(i.onShow,this)()):T.restore.conditions(),T.remove.animation(),T.remove.animating()),n.proxy(i.onComplete,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(),T.remove.animationEndCallback(),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"+w,T.complete),T.set.duration(i.duration),n.proxy(i.onStart,this)(),T.debug("Starting tween",e,A.attr("class"))},duration:function(n,e){e=e||i.duration,e="number"==typeof e?e+"ms":e,T.verbose("Setting animation duration",e),A.css({"-webkit-animation-duration":e,"-moz-animation-duration":e,"-ms-animation-duration":e,"-o-animation-duration":e,"animation-duration":e})},display:function(){var n=T.get.style(),i=T.get.displayType(),e=n+"display: "+i+" !important;";T.refresh(),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)},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){A.data(v.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)},animation:function(){A.css({"-webkit-animation":"","-moz-animation":"","-ms-animation":"","-o-animation":"",animation:""})},animationEndCallback:function(){A.off(".complete")},display:function(){A.css("display","")},direction:function(){A.removeClass(g.inward).removeClass(g.outward)},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,onComplete: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,onComplete:e}):n.extend({},n.fn.transition.settings,{animation:i})},displayType:function(){return i.displayType?i.displayType:(A.data(v.displayType)===t&&T.can.transition(!0),A.data(v.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(e){var a,o,s,r,d,l=A.attr("class"),m=A.prop("tagName"),c=i.animation,u=T.get.transitionExists(i.animation);return(u===t||e)&&(T.verbose("Determining whether animation exists"),a=n("<"+m+" />").addClass(l).insertAfter(A),o=a.addClass(c).removeClass(g.inward).removeClass(g.outward).addClass(g.animating).addClass(g.transition).css(y),s=a.addClass(g.inward).css(y),d=a.attr("class",l).removeAttr("style").removeClass(g.hidden).removeClass(g.visible).show().css("display"),T.verbose("Determining final display state",d),o!=s?(T.debug("Transition exists for animation",c),r=!0):(T.debug("Static animation found",c,d),r=!1),a.remove(),T.save.displayType(d),u===t&&T.save.transitionExists(c,r)),u||r}},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.is.animating()&&T.reset(),T.remove.display(),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,l=p;return e=e||c,o=x||o,"string"==typeof i&&l!==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(l[o])&&e!=s)l=l[o];else{if(l[o]!==t)return r=l[o],!1;if(!n.isPlainObject(l[a])||e==s)return l[a]!==t?(r=l[a],!1):!1;l=l[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",onStart:function(){},onComplete:function(){},onShow:function(){},onHide:function(){},allowRepeats:!1,displayType:!1,animation:"fade",duration:"500ms",queue:!0,metadata:{displayType:"display"},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);
|