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
11 lines
12 KiB
/*!
|
|
* # Semantic UI 1.10.3 - Transition
|
|
* http://github.com/semantic-org/semantic-ui/
|
|
*
|
|
*
|
|
* 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(),l=[],d=arguments,m=d[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(i){var f,g,p,v,b,y,h,w,C,A,T,S=n(this),x=this;T={initialize:function(){f=T.get.settings.apply(x,d),v=f.className,p=f.error,b=f.metadata,A="."+f.namespace,C="module-"+f.namespace,g=S.data(C)||T,h=T.get.animationEndEvent(),w=T.get.animationName(),y=T.get.animationStartEvent(),u&&(u=T.invoke(m)),u===!1&&(T.verbose("Converted arguments into settings object",f),f.interval?T.delay(f.animate):T.animate(),T.instantiate())},instantiate:function(){T.verbose("Storing instance of module",T),g=T,S.data(C,g)},destroy:function(){T.verbose("Destroying previous module for",x),S.removeData(C)},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.length?S.detach().appendTo(n):S.detach().insertBefore(i)},repaint:function(){T.verbose("Repainting element");x.offsetWidth},delay:function(n){var e,a=f.reverse===!0,s="auto"==f.reverse&&T.get.direction()==v.outward;n=typeof n!==t?n:f.interval,e=a||s?(o.length-i)*f.interval:i*f.interval,T.debug("Delaying animation by",e),setTimeout(T.animate,e)},animate:function(n){if(f=n||f,!T.is.supported())return T.error(p.support),!1;if(T.debug("Preparing animation",f.animation),T.is.animating()){if(f.queue)return!f.allowRepeats&&T.has.direction()&&T.is.occurring()&&T.queuing!==!0?T.debug("Animation is currently occurring, preventing queueing same animation",f.animation):T.queue(f.animation),!1;if(!f.allowRepeats&&T.is.occurring())return T.debug("Animation is already occurring, will not execute repeated animation",f.animation),!1}T.can.animate()?T.set.animating(f.animation):T.error(p.noAnimation,f.animation,x)},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(h+A,function(){T.queuing=!1,T.repaint(),T.animate.apply(this,f)})},complete:function(){T.verbose("CSS animation complete",f.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(),f.onHide.call(this)):T.is.inward()?(T.verbose("Animation is outward, showing element"),T.restore.conditions(),T.show(),T.set.display(),f.onShow.call(this)):T.restore.conditions(),T.remove.animation(),T.remove.animating()),f.onComplete.call(this)},has:{direction:function(i){var e=!1;return i=i||f.animation,"string"==typeof i&&(i=i.split(" "),n.each(i,function(n,i){(i===v.inward||i===v.outward)&&(e=!0)})),e},inlineDisplay:function(){var i=S.attr("style")||"";return n.isArray(i.match(/display.*?;/,""))}},set:{animating:function(n){n=n||f.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(v.animating+" "+v.transition+" "+n).addClass(n).one(h+".complete"+A,T.complete),f.useFailSafe&&T.add.failSafe(),T.set.duration(f.duration),f.onStart.call(this),T.debug("Starting tween",n,S.attr("class"))},duration:function(n,i){i=i||f.duration,i="number"==typeof i?i+"ms":i,T.verbose("Setting animation duration",i),(i||0===i)&&S.css({"-webkit-animation-duration":i,"-moz-animation-duration":i,"-ms-animation-duration":i,"-o-animation-duration":i,"animation-duration":i})},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(v.inward).addClass(v.outward)):(T.debug("Automatically determining the direction of animation","Inward"),S.removeClass(v.outward).addClass(v.inward))},looping:function(){T.debug("Transition set to loop"),S.addClass(v.looping)},hidden:function(){T.is.hidden()||S.addClass(v.transition).addClass(v.hidden),"none"!==S.css("display")&&(T.verbose("Overriding default display to hide element"),S.css("display","none"))},visible:function(){S.addClass(v.transition).addClass(v.visible)}},save:{displayType:function(n){S.data(b.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(f.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(function(){S.trigger(h)},n+f.failSafeDelay),T.verbose("Adding fail safe timer",T.timer)}},remove:{animating:function(){S.removeClass(v.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(v.inward).removeClass(v.outward)},failSafe:function(){T.verbose("Removing fail safe timer",T.timer),T.timer&&clearTimeout(T.timer)},hidden:function(){S.removeClass(v.hidden)},visible:function(){S.removeClass(v.visible)},looping:function(){T.debug("Transitions are no longer looping"),S.removeClass(v.looping),T.forceRepaint()},transition:function(){S.removeClass(v.visible).removeClass(v.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})},direction:function(i){return i=i||f.animation,"string"==typeof i&&(i=i.split(" "),n.each(i,function(n,i){return i===v.inward?v.inward:i===v.outward?v.outward:void 0})),T.can.transition()?S.is(":visible")&&!T.is.hidden()?v.outward:v.inward:"static"},duration:function(n){return n=n||f.duration,n===!1&&(n=S.css("animation-duration")||0),"string"==typeof n?n.indexOf("ms")>-1?parseFloat(n):1e3*parseFloat(n):n},displayType:function(){return f.displayType?f.displayType:(S.data(b.displayType)===t&&T.can.transition(!0),S.data(b.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(i){var e,a,o,s,r,l=S.attr("class"),d=S.prop("tagName"),m=f.animation,c=T.get.transitionExists(m);if(c===t||i){if(T.verbose("Determining whether animation exists"),e=n("<"+d+" />").addClass(l).insertAfter(S),a=e.addClass(m).removeClass(v.inward).removeClass(v.outward).addClass(v.animating).addClass(v.transition).css(w),o=e.addClass(v.inward).css(w),r=e.attr("class",l).removeAttr("style").removeClass(v.hidden).removeClass(v.visible).show().css("display"),T.verbose("Determining final display state",r),e.remove(),a!=o)T.debug("Direction exists for animation",m),s=!0;else{if("none"==a||!a)return void T.debug("No animation defined in css",m);T.debug("Static animation found",m,r),s=!1}T.save.displayType(r),T.save.transitionExists(m,s)}return c!==t?c:s},animate:function(){return T.can.transition()!==t}},is:{animating:function(){return S.hasClass(v.animating)},inward:function(){return S.hasClass(v.inward)},outward:function(){return S.hasClass(v.outward)},looping:function(){return S.hasClass(v.looping)},occurring:function(n){return n=n||f.animation,n="."+n.replace(" ","."),S.filter(n).length>0},visible:function(){return S.is(":visible")},hidden:function(){return"hidden"===S.css("visibility")},supported:function(){return w!==!1&&h!==!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(v.disabled)},stop:function(){T.debug("Stopping animation"),S.addClass(v.disabled)},toggle:function(){T.debug("Toggling play status"),S.toggleClass(v.disabled)},setting:function(i,e){if(T.debug("Changing setting",i,e),n.isPlainObject(i))n.extend(!0,f,i);else{if(e===t)return f[i];f[i]=e}},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(){f.debug&&(f.performance?T.performance.log(arguments):(T.debug=Function.prototype.bind.call(console.info,console,f.name+":"),T.debug.apply(console,arguments)))},verbose:function(){f.verbose&&f.debug&&(f.performance?T.performance.log(arguments):(T.verbose=Function.prototype.bind.call(console.info,console,f.name+":"),T.verbose.apply(console,arguments)))},error:function(){T.error=Function.prototype.bind.call(console.error,console,f.name+":"),T.error.apply(console,arguments)},performance:{log:function(n){var i,e,t;f.performance&&(i=(new Date).getTime(),t=r||i,e=i-t,r=i,l.push({Name:n[0],Arguments:[].slice.call(n,1)||"",Element:x,"Execution Time":e})),clearTimeout(T.performance.timer),T.performance.timer=setTimeout(T.performance.display,600)},display:function(){var i=f.name+":",e=0;r=!1,clearTimeout(T.performance.timer),n.each(l,function(n,i){e+=i["Execution Time"]}),i+=" "+e+"ms",s&&(i+=" '"+s+"'"),o.length>1&&(i+=" ("+o.length+")"),(console.group!==t||console.table!==t)&&l.length>0&&(console.groupCollapsed(i),console.table?console.table(l):n.each(l,function(n,i){console.log(i.Name+": "+i["Execution Time"]+"ms")}),console.groupEnd()),l=[]}},invoke:function(i,e,o){var s,r,l,d=g;return e=e||c,o=x||o,"string"==typeof i&&d!==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(d[o])&&e!=s)d=d[o];else{if(d[o]!==t)return r=d[o],!1;if(!n.isPlainObject(d[a])||e==s)return d[a]!==t?(r=d[a],!1):!1;d=d[a]}})),n.isFunction(r)?l=r.apply(o,e):r!==t&&(l=r),n.isArray(a)?a.push(l):a!==t?a=[a,l]:l!==t&&(a=l),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",interval:0,reverse:"auto",onStart:function(){},onComplete:function(){},onShow:function(){},onHide:function(){},useFailSafe:!0,failSafeDelay:100,allowRepeats:!1,displayType:!1,animation:"fade",duration:!1,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);
|