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
12 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,f,p,g,v,b,y,h,C,w,A,T,S=n(this),x=this;T={initialize:function(){w="module-"+C,i=T.get.settings.apply(x,l),g=i.className,v=i.metadata,b=T.get.animationStartEvent(),y=T.get.animationEndEvent(),h=T.get.animationName(),p=i.error,C=i.namespace,A="."+i.namespace,f=S.data(w)||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),S.data(w,f)},destroy:function(){T.verbose("Destroying previous module for",x),S.removeData(w)},refresh:function(){T.verbose("Refreshing display type on next animation"),delete T.displayType},forceRepaint:function(){T.verbose("Forcing element repaint");var n=S.parent(),i=S.next();0===i.size()?S.detach().appendTo(n):S.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(p.repeated,i.animation,S):T.queue(i.animation),!1):void(T.can.animate()?T.set.animating(i.animation):T.error(p.noAnimation,i.animation,x))):(T.error(p.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,S.one(y+A,function(){T.queuing=!1,T.repaint(),T.animate.apply(this,i)})},complete:function(){T.verbose("CSS animation complete",i.animation),T.remove.animationEndCallback(),T.remove.failSafe(),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},inlineDisplay:function(){var i=S.attr("style")||"";return n.isArray(i.match(/display.*?;/,""))}},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(),S.addClass(g.animating).addClass(g.transition).addClass(e).one(y+".complete"+A,T.complete),i.useFailSafe&&T.add.failSafe(),T.set.duration(i.duration),n.proxy(i.onStart,this)(),T.debug("Starting tween",e,S.attr("class"))},duration:function(n,e){e=e||i.duration,e="number"==typeof e?e+"ms":e,T.verbose("Setting animation duration",e),S.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;";S.css("display",""),T.refresh(),S.css("display")!==i&&(T.verbose("Setting inline visibility to",i),S.attr("style",e))},direction:function(){S.is(":visible")&&!T.is.hidden()?(T.debug("Automatically determining the direction of animation","Outward"),S.removeClass(g.inward).addClass(g.outward)):(T.debug("Automatically determining the direction of animation","Inward"),S.removeClass(g.outward).addClass(g.inward))},looping:function(){T.debug("Transition set to loop"),S.addClass(g.looping)},hidden:function(){T.is.hidden()||(S.addClass(g.transition).addClass(g.hidden),"none"!==S.css("display")&&(T.verbose("Overriding default display to hide element"),S.css("display","none")))},visible:function(){S.addClass(g.transition).addClass(g.visible)}},save:{displayType:function(n){S.data(v.displayType,n)},transitionExists:function(i,e){n.fn.transition.exists[i]=e,T.verbose("Saving existence of transition",i,e)},conditions:function(){S.attr("class")||!1,S.attr("style")||"";S.removeClass(i.animation),T.remove.direction(),T.cache={className:S.attr("class"),style:T.get.style()},T.verbose("Saving original attributes",T.cache)}},restore:{conditions:function(){return T.cache===t?!1:(T.cache.className?S.attr("class",T.cache.className):S.removeAttr("class"),T.cache.style&&(T.verbose("Restoring original style attribute",T.cache.style),S.attr("style",T.cache.style)),T.is.looping()&&T.remove.looping(),void T.verbose("Restoring original attributes",T.cache))}},add:{failSafe:function(){var n=T.get.duration();T.timer=setTimeout(T.complete,n+100),T.verbose("Adding fail safe timer",T.timer)}},remove:{animating:function(){S.removeClass(g.animating)},animation:function(){S.css({"-webkit-animation":"","-moz-animation":"","-ms-animation":"","-o-animation":"",animation:""})},animationEndCallback:function(){S.off(".complete")},display:function(){S.css("display","")},direction:function(){S.removeClass(g.inward).removeClass(g.outward)},failSafe:function(){T.verbose("Removing fail safe timer",T.timer),T.timer&&clearTimeout(T.timer)},hidden:function(){S.removeClass(g.hidden)},visible:function(){S.removeClass(g.visible)},looping:function(){T.debug("Transitions are no longer looping"),S.removeClass(g.looping),T.forceRepaint()},transition:function(){S.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})},duration:function(n){return n=n||i.duration,"string"==typeof i.duration?n.indexOf("ms")>-1?parseFloat(n):1e3*parseFloat(n):n},displayType:function(){return i.displayType?i.displayType:(S.data(v.displayType)===t&&T.can.transition(!0),S.data(v.displayType))},style:function(){var n=S.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},animationStartEvent:function(){var n,i=e.createElement("div"),a={animation:"animationstart",OAnimation:"oAnimationStart",MozAnimation:"mozAnimationStart",WebkitAnimation:"webkitAnimationStart"};for(n in a)if(i.style[n]!==t)return a[n];return!1},animationEndEvent: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:{transition:function(e){var a,o,s,r,d,l=S.attr("class"),m=S.prop("tagName"),c=i.animation,u=T.get.transitionExists(c);if(u===t||e){if(T.verbose("Determining whether animation exists"),a=n("<"+m+" />").addClass(l).insertAfter(S),o=a.addClass(c).removeClass(g.inward).removeClass(g.outward).addClass(g.animating).addClass(g.transition).css(h),s=a.addClass(g.inward).css(h),d=a.attr("class",l).removeAttr("style").removeClass(g.hidden).removeClass(g.visible).show().css("display"),T.verbose("Determining final display state",d),a.remove(),o!=s)T.debug("Direction exists for animation",c),r=!0;else{if("none"==o||!o)return void T.debug("No animation defined in css",c);T.debug("Static animation found",c,d),r=!1}T.save.displayType(d),T.save.transitionExists(c,r)}return u!==t?u:r},animate:function(){return T.can.transition()!==t}},is:{animating:function(){return S.hasClass(g.animating)},inward:function(){return S.hasClass(g.inward)},outward:function(){return S.hasClass(g.outward)},looping:function(){return S.hasClass(g.looping)},occuring:function(n){return n=n||i.animation,n=n.replace(" ","."),S.filter(n).size()>0},visible:function(){return S.is(":visible")},hidden:function(){return"hidden"===S.css("visibility")},supported:function(){return h!==!1&&y!==!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"),S.removeClass(g.disabled)},stop:function(){T.debug("Stopping animation"),S.addClass(g.disabled)},toggle:function(){T.debug("Toggling play status"),S.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=f;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(){},useFailSafe:!1,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);