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
10 KiB

10 years ago
10 years ago
10 years ago
10 years ago
  1. /*
  2. * # Semantic UI
  3. * https://github.com/Semantic-Org/Semantic-UI
  4. * http://www.semantic-ui.com/
  5. *
  6. * Copyright 2014 Contributors
  7. * Released under the MIT license
  8. * http://opensource.org/licenses/MIT
  9. *
  10. */
  11. !function(e,t,i,n){"use strict";e.fn.shape=function(a){var o,r=e(this),s=(e("body"),(new Date).getTime()),d=[],u=arguments[0],l="string"==typeof u,c=[].slice.call(arguments,1),g=t.requestAnimationFrame||t.mozRequestAnimationFrame||t.webkitRequestAnimationFrame||t.msRequestAnimationFrame||function(e){setTimeout(e,0)};return r.each(function(){var t,f,m,p=r.selector||"",v=e.extend(!0,{},e.fn.shape.settings,a),h=v.namespace,b=v.selector,x=v.error,y=v.className,S="."+h,z="module-"+h,w=e(this),C=w.find(b.sides),W=w.find(b.side),k=!1,T=this,A=w.data(z);m={initialize:function(){m.verbose("Initializing module for",T),m.set.defaultSide(),m.instantiate()},instantiate:function(){m.verbose("Storing instance of module",m),A=m,w.data(z,A)},destroy:function(){m.verbose("Destroying previous module for",T),w.removeData(z).off(S)},refresh:function(){m.verbose("Refreshing selector cache for",T),w=e(T),C=e(this).find(b.shape),W=e(this).find(b.side)},repaint:function(){m.verbose("Forcing repaint event");{var e=C.get(0)||i.createElement("div");e.offsetWidth}},animate:function(i,a){m.verbose("Animating box with properties",i),a=a||function(e){m.verbose("Executing animation callback"),e!==n&&e.stopPropagation(),m.reset(),m.set.active()},e.proxy(v.beforeChange,f[0])(),m.get.transitionEvent()?(m.verbose("Starting CSS animation"),w.addClass(y.animating),C.css(i).one(m.get.transitionEvent(),a),m.set.duration(v.duration),g(function(){w.addClass(y.animating),t.addClass(y.hidden)})):a()},queue:function(e){m.debug("Queueing animation of",e),C.one(m.get.transitionEvent(),function(){m.debug("Executing queued animation"),setTimeout(function(){w.shape(e)},0)})},reset:function(){m.verbose("Animating states reset"),w.removeClass(y.animating).attr("style","").removeAttr("style"),C.attr("style","").removeAttr("style"),W.attr("style","").removeAttr("style").removeClass(y.hidden),f.removeClass(y.animating).attr("style","").removeAttr("style")},is:{complete:function(){return W.filter("."+y.active)[0]==f[0]},animating:function(){return w.hasClass(y.animating)}},set:{defaultSide:function(){t=w.find("."+v.className.active),f=t.next(b.side).size()>0?t.next(b.side):w.find(b.side).first(),k=!1,m.verbose("Active side set to",t),m.verbose("Next side set to",f)},duration:function(e){e=e||v.duration,e="number"==typeof e?e+"ms":e,m.verbose("Setting animation duration",e),C.add(W).css({"-webkit-transition-duration":e,"-moz-transition-duration":e,"-ms-transition-duration":e,"-o-transition-duration":e,"transition-duration":e})},stageSize:function(){var e=w.clone().addClass(y.loading),t=e.find("."+v.className.active),i=k?e.find(b.side).eq(k):t.next(b.side).size()>0?t.next(b.side):e.find(b.side).first(),n={};t.removeClass(y.active),i.addClass(y.active),e.insertAfter(w),n={width:i.outerWidth(),height:i.outerHeight()},e.remove(),w.css(n),m.verbose("Resizing stage to fit new content",n)},nextSide:function(e){k=e,f=W.filter(e),k=W.index(f),0===f.size()&&(m.set.defaultSide(),m.error(x.side)),m.verbose("Next side manually set to",f)},active:function(){m.verbose("Setting new side to active",f),W.removeClass(y.active),f.addClass(y.active),e.proxy(v.onChange,f[0])(),m.set.defaultSide()}},flip:{up:function(){return!m.is.complete()||m.is.animating()||v.allowRepeats?void(m.is.animating()?m.queue("flip up"):(m.debug("Flipping up",f),m.set.stageSize(),m.stage.above(),m.animate(m.get.transform.up()))):void m.debug("Side already visible",f)},down:function(){return!m.is.complete()||m.is.animating()||v.allowRepeats?void(m.is.animating()?m.queue("flip down"):(m.debug("Flipping down",f),m.set.stageSize(),m.stage.below(),m.animate(m.get.transform.down()))):void m.debug("Side already visible",f)},left:function(){return!m.is.complete()||m.is.animating()||v.allowRepeats?void(m.is.animating()?m.queue("flip left"):(m.debug("Flipping left",f),m.set.stageSize(),m.stage.left(),m.animate(m.get.transform.left()))):void m.debug("Side already visible",f)},right:function(){return!m.is.complete()||m.is.animating()||v.allowRepeats?void(m.is.animating()?m.queue("flip right"):(m.debug("Flipping right",f),m.set.stage