nemesiscodex/openfonacide

View on GitHub
static/components/transition.min.js

Summary

Maintainability
A
0 mins
Test Coverage
/*!
 * # Semantic UI 1.12.3 - Transition
 * http://github.com/semantic-org/semantic-ui/
 *
 *
 * Copyright 2014 Contributors
 * Released under the MIT license
 * http://opensource.org/licenses/MIT
 *
 */
!function(n,e,i,t){"use strict";n.fn.transition=function(){{var a,o=n(this),s=o.selector||"",r=(new Date).getTime(),l=[],u=arguments,m=u[0],c=[].slice.call(arguments,1),d="string"==typeof m;e.requestAnimationFrame||e.mozRequestAnimationFrame||e.webkitRequestAnimationFrame||e.msRequestAnimationFrame||function(n){setTimeout(n,0)}}return o.each(function(e){var f,p,g,v,b,y,h,w,C,A,T,S=n(this),x=this;T={initialize:function(){f=T.get.settings.apply(x,u),v=f.className,g=f.error,b=f.metadata,A="."+f.namespace,C="module-"+f.namespace,p=S.data(C)||T,h=T.get.animationEndEvent(),w=T.get.animationName(),y=T.get.animationStartEvent(),d&&(d=T.invoke(m)),d===!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),p=T,S.data(C,p)},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(),e=S.next();0===e.length?S.detach().appendTo(n):S.detach().insertBefore(e)},repaint:function(){T.verbose("Repainting element");x.offsetWidth},delay:function(n){var i,a=f.reverse===!0,s="auto"==f.reverse&&T.get.direction()==v.outward;n=typeof n!==t?n:f.interval,i=a||s?(o.length-e)*f.interval:e*f.interval,T.debug("Delaying animation by",i),setTimeout(T.animate,i)},animate:function(n){if(f=n||f,!T.is.supported())return T.error(g.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.debug("New animation started, completing previous early",f.animation),T.complete()}T.can.animate()?T.set.animating(f.animation):T.error(g.noAnimation,f.animation,x)},reset:function(){T.debug("Resetting animation to beginning conditions"),T.remove.animationCallbacks(),T.restore.conditions(),T.remove.animating()},queue:function(n){T.debug("Queueing animation of",n),T.queuing=!0,S.one(h+".queue"+A,function(){T.queuing=!1,T.repaint(),T.animate.apply(this,f)})},complete:function(n){T.debug("Animation complete",f.animation),T.remove.completeCallback(),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(),f.onShow.call(this)):T.restore.conditions(),T.remove.animation(),T.remove.animating()),f.onComplete.call(this)},has:{direction:function(e){var i=!1;return e=e||f.animation,"string"==typeof e&&(e=e.split(" "),n.each(e,function(n,e){(e===v.inward||e===v.outward)&&(i=!0)})),i},inlineDisplay:function(){var e=S.attr("style")||"";return n.isArray(e.match(/display.*?;/,""))}},set:{animating:function(n){n=n||f.animation,T.is.animating()||T.save.conditions(),T.remove.direction(),T.remove.completeCallback(),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,e){e=e||f.duration,e="number"==typeof e?e+"ms":e,(e||0===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(),e=T.get.displayType(),i=n+"display: "+e+" !important;";S.css("display",""),T.refresh(),S.css("display")!==e&&(T.verbose("Setting inline visibility to",e),S.attr("style",i))},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(e,i){n.fn.transition.exists[e]=i,T.verbose("Saving existence of transition",e,i)},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.verbose("Clearing style attribute"),S.removeAttr("style")),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:""})},animationCallbacks:function(){T.remove.queueCallback(),T.remove.completeCallback()},queueCallback:function(){S.off(".queue"+A)},completeCallback:function(){S.off(".complete"+A)},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"),T.is.looping()&&(T.reset(),S.removeClass(v.looping))},transition:function(){S.removeClass(v.visible).removeClass(v.hidden)}},get:{settings:function(e,i,t){return"object"==typeof e?n.extend(!0,{},n.fn.transition.settings,e):"function"==typeof t?n.extend({},n.fn.transition.settings,{animation:e,onComplete:t,duration:i}):"string"==typeof i||"number"==typeof i?n.extend({},n.fn.transition.settings,{animation:e,duration:i}):"object"==typeof i?n.extend({},n.fn.transition.settings,i,{animation:e}):"function"==typeof i?n.extend({},n.fn.transition.settings,{animation:e,onComplete:i}):n.extend({},n.fn.transition.settings,{animation:e})},direction:function(e){return e=e||f.animation,"string"==typeof e&&(e=e.split(" "),n.each(e,function(n,e){return e===v.inward?v.inward:e===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(e){return n.fn.transition.exists[e]},animationName:function(){var n,e=i.createElement("div"),a={animation:"animationName",OAnimation:"oAnimationName",MozAnimation:"mozAnimationName",WebkitAnimation:"webkitAnimationName"};for(n in a)if(e.style[n]!==t)return a[n];return!1},animationStartEvent:function(){var n,e=i.createElement("div"),a={animation:"animationstart",OAnimation:"oAnimationStart",MozAnimation:"mozAnimationStart",WebkitAnimation:"webkitAnimationStart"};for(n in a)if(e.style[n]!==t)return a[n];return!1},animationEndEvent:function(){var n,e=i.createElement("div"),a={animation:"animationend",OAnimation:"oAnimationEnd",MozAnimation:"mozAnimationEnd",WebkitAnimation:"webkitAnimationEnd"};for(n in a)if(e.style[n]!==t)return a[n];return!1}},can:{transition:function(e){var i,a,o,s,r,l=S.attr("class"),u=S.prop("tagName"),m=f.animation,c=T.get.transitionExists(m);if(c===t||e){if(T.verbose("Determining whether animation exists"),i=n("<"+u+" />").addClass(l).insertAfter(S),a=i.addClass(m).removeClass(v.inward).removeClass(v.outward).addClass(v.animating).addClass(v.transition).css(w),o=i.addClass(v.inward).css(w),r=i.attr("class",l).removeAttr("style").removeClass(v.hidden).removeClass(v.visible).show().css("display"),T.verbose("Determining final display state",r),T.save.displayType(r),i.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.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.set.display(),T.repaint()},toggle:function(){T.is.visible()?T.hide():T.show()},stop:function(){T.debug("Stopping current animation"),S.trigger(h)},stopAll:function(){T.debug("Stopping all animation"),T.remove.queueCallback(),S.trigger(h)},clear:{queue:function(){T.debug("Clearing animation queue"),T.remove.queueCallback()}},enable:function(){T.verbose("Starting animation"),S.removeClass(v.disabled)},disable:function(){T.debug("Stopping animation"),S.addClass(v.disabled)},setting:function(e,i){if(T.debug("Changing setting",e,i),n.isPlainObject(e))n.extend(!0,f,e);else{if(i===t)return f[e];f[e]=i}},internal:function(e,i){if(n.isPlainObject(e))n.extend(!0,T,e);else{if(i===t)return T[e];T[e]=i}},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 e,i,t;f.performance&&(e=(new Date).getTime(),t=r||e,i=e-t,r=e,l.push({Name:n[0],Arguments:[].slice.call(n,1)||"",Element:x,"Execution Time":i})),clearTimeout(T.performance.timer),T.performance.timer=setTimeout(T.performance.display,100)},display:function(){var e=f.name+":",i=0;r=!1,clearTimeout(T.performance.timer),n.each(l,function(n,e){i+=e["Execution Time"]}),e+=" "+i+"ms",s&&(e+=" '"+s+"'"),o.length>1&&(e+=" ("+o.length+")"),(console.group!==t||console.table!==t)&&l.length>0&&(console.groupCollapsed(e),console.table?console.table(l):n.each(l,function(n,e){console.log(e.Name+": "+e["Execution Time"]+"ms")}),console.groupEnd()),l=[]}},invoke:function(e,i,o){var s,r,l,u=p;return i=i||c,o=x||o,"string"==typeof e&&u!==t&&(e=e.split(/[\. ]/),s=e.length-1,n.each(e,function(i,a){var o=i!=s?a+e[i+1].charAt(0).toUpperCase()+e[i+1].slice(1):e;if(n.isPlainObject(u[o])&&i!=s)u=u[o];else{if(u[o]!==t)return r=u[o],!1;if(!n.isPlainObject(u[a])||i==s)return u[a]!==t?(r=u[a],!1):!1;u=u[a]}})),n.isFunction(r)?l=r.apply(o,i):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);