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.

10 lines
12 KiB

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
  1. /*!
  2. * # Semantic UI 2.0.0 - Transition
  3. * http://github.com/semantic-org/semantic-ui/
  4. *
  5. *
  6. * Copyright 2015 Contributors
  7. * Released under the MIT license
  8. * http://opensource.org/licenses/MIT
  9. *
  10. */
  11. !function(n,i,e,t){"use strict";n.fn.transition=function(){{var a,o=n(this),r=o.selector||"",s=(new Date).getTime(),l=[],u=arguments,d=u[0],c=[].slice.call(arguments,1),m="string"==typeof d;i.requestAnimationFrame||i.mozRequestAnimationFrame||i.webkitRequestAnimationFrame||i.msRequestAnimationFrame||function(n){setTimeout(n,0)}}return o.each(function(i){var f,p,g,v,b,y,h,w,C,A=n(this),T=this;C={initialize:function(){f=C.get.settings.apply(T,u),v=f.className,g=f.error,b=f.metadata,w="."+f.namespace,h="module-"+f.namespace,p=A.data(h)||C,y=C.get.animationEndEvent(),m&&(m=C.invoke(d)),m===!1&&(C.verbose("Converted arguments into settings object",f),f.interval?C.delay(f.animate):C.animate(),C.instantiate())},instantiate:function(){C.verbose("Storing instance of module",C),p=C,A.data(h,p)},destroy:function(){C.verbose("Destroying previous module for",T),A.removeData(h)},refresh:function(){C.verbose("Refreshing display type on next animation"),delete C.displayType},forceRepaint:function(){C.verbose("Forcing element repaint");var n=A.parent(),i=A.next();0===i.length?A.detach().appendTo(n):A.detach().insertBefore(i)},repaint:function(){C.verbose("Repainting element");T.offsetWidth},delay:function(n){var e,a,r=C.get.animationDirection();r||(r=C.can.transition()?C.get.direction():"static"),n=n!==t?n:f.interval,e="auto"==f.reverse&&r==v.outward,a=e||1==f.reverse?(o.length-i)*f.interval:i*f.interval,C.debug("Delaying animation by",a),setTimeout(C.animate,a)},animate:function(n){if(f=n||f,!C.is.supported())return C.error(g.support),!1;if(C.debug("Preparing animation",f.animation),C.is.animating()){if(f.queue)return!f.allowRepeats&&C.has.direction()&&C.is.occurring()&&C.queuing!==!0?C.debug("Animation is currently occurring, preventing queueing same animation",f.animation):C.queue(f.animation),!1;if(!f.allowRepeats&&C.is.occurring())return C.debug("Animation is already occurring, will not execute repeated animation",f.animation),!1;C.debug("New animation started, completing previous early",f.animation),p.complete()}C.can.animate()?C.set.animating(f.animation):C.error(g.noAnimation,f.animation,T)},reset:function(){C.debug("Resetting animation to beginning conditions"),C.remove.animationCallbacks(),C.restore.conditions(),C.remove.animating()},queue:function(n){C.debug("Queueing animation of",n),C.queuing=!0,A.one(y+".queue"+w,function(){C.queuing=!1,C.repaint(),C.animate.apply(this,f)})},complete:function(n){C.debug("Animation complete",f.animation),C.remove.completeCallback(),C.remove.failSafe(),C.is.looping()||(C.is.outward()?(C.verbose("Animation is outward, hiding element"),C.restore.conditions(),C.hide(),f.onHide.call(this)):C.is.inward()?(C.verbose("Animation is outward, showing element"),C.restore.conditions(),C.show(),f.onShow.call(this)):(C.restore.conditions(),C.show()),C.remove.animation(),C.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=A.attr("style")||"";return n.isArray(i.match(/display.*?;/,""))}},set:{animating:function(n){var i;C.remove.completeCallback(),n=n||f.animation,i=C.get.animationClass(n),C.save.animation(i),C.set.display(),C.remove.hidden(),C.remove.direction(),A.addClass(i).one(y+".complete"+w,C.complete),f.useFailSafe&&C.add.failSafe(),C.set.duration(f.duration),f.onStart.call(this),C.debug("Starting tween",n)},duration:function(n,i){i=i||f.duration,i="number"==typeof i?i+"ms":i,(i||0===i)&&(C.verbose("Setting animation duration",i),A.css({"animation-duration":i}))},display:function(){var n=C.get.style(),i=C.get.displayType(),e=n+"display: "+i+" !important;";A.css("display")!==i&&(C.verbose("Setting inline visibility to",i),A.attr("style",e))},direction:function(n){n=n||C.get.direction(),n==v.inward?C.set.inward():C.set.outward()},looping:function(){C.debug("Transition set to loop"),A.addClass(v.looping)},hidden:function(){C.is.hidden()||A.addClass(v.transition).addClass(v.hidden),"none"!==A.css("display")&&(C.verbose