10 lines
11 KiB
JavaScript
10 lines
11 KiB
JavaScript
|
/*!
|
||
|
* # Semantic UI 2.2.7 - Shape
|
||
|
* http://github.com/semantic-org/semantic-ui/
|
||
|
*
|
||
|
*
|
||
|
* Released under the MIT license
|
||
|
* http://opensource.org/licenses/MIT
|
||
|
*
|
||
|
*/
|
||
|
!function(e,t,i,n){"use strict";t="undefined"!=typeof t&&t.Math==Math?t:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),e.fn.shape=function(a){var o,r=e(this),s=(e("body"),(new Date).getTime()),d=[],l=arguments[0],u="string"==typeof l,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||"",h=e.isPlainObject(a)?e.extend(!0,{},e.fn.shape.settings,a):e.extend({},e.fn.shape.settings),v=h.namespace,b=h.selector,x=h.error,y=h.className,S="."+v,w="module-"+v,C=e(this),z=C.find(b.sides),W=C.find(b.side),F=!1,H=this,T=C.data(w);m={initialize:function(){m.verbose("Initializing module for",H),m.set.defaultSide(),m.instantiate()},instantiate:function(){m.verbose("Storing instance of module",m),T=m,C.data(w,T)},destroy:function(){m.verbose("Destroying previous module for",H),C.removeData(w).off(S)},refresh:function(){m.verbose("Refreshing selector cache for",H),C=e(H),z=e(this).find(b.shape),W=e(this).find(b.side)},repaint:function(){m.verbose("Forcing repaint event");var e=z[0]||i.createElement("div");e.offsetWidth},animate:function(e,i){m.verbose("Animating box with properties",e),i=i||function(e){m.verbose("Executing animation callback"),e!==n&&e.stopPropagation(),m.reset(),m.set.active()},h.beforeChange.call(f[0]),m.get.transitionEvent()?(m.verbose("Starting CSS animation"),C.addClass(y.animating),z.css(e).one(m.get.transitionEvent(),i),m.set.duration(h.duration),g(function(){C.addClass(y.animating),t.addClass(y.hidden)})):i()},queue:function(e){m.debug("Queueing animation of",e),z.one(m.get.transitionEvent(),function(){m.debug("Executing queued animation"),setTimeout(function(){C.shape(e)},0)})},reset:function(){m.verbose("Animating states reset"),C.removeClass(y.animating).attr("style","").removeAttr("style"),z.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 C.hasClass(y.animating)}},set:{defaultSide:function(){t=C.find("."+h.className.active),f=t.next(b.side).length>0?t.next(b.side):C.find(b.side).first(),F=!1,m.verbose("Active side set to",t),m.verbose("Next side set to",f)},duration:function(e){e=e||h.duration,e="number"==typeof e?e+"ms":e,m.verbose("Setting animation duration",e),(h.duration||0===h.duration)&&z.add(W).css({"-webkit-transition-duration":e,"-moz-transition-duration":e,"-ms-transition-duration":e,"-o-transition-duration":e,"transition-duration":e})},currentStageSize:function(){var e=C.find("."+h.className.active),t=e.outerWidth(!0),i=e.outerHeight(!0);C.css({width:t,height:i})},stageSize:function(){var e=C.clone().addClass(y.loading),t=e.find("."+h.className.active),i=F?e.find(b.side).eq(F):t.next(b.side).length>0?t.next(b.side):e.find(b.side).first(),n="next"==h.width?i.outerWidth(!0):"initial"==h.width?C.width():h.width,a="next"==h.height?i.outerHeight(!0):"initial"==h.height?C.height():h.height;t.removeClass(y.active),i.addClass(y.active),e.insertAfter(C),e.remove(),"auto"!=h.width&&(C.css("width",n+h.jitter),m.verbose("Specifying width during animation",n)),"auto"!=h.height&&(C.css("height",a+h.jitter),m.verbose("Specifying height during animation",a))},nextSide:function(e){F=e,f=W.filter(e),F=W.index(f),0===f.length&&(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),h.onChange.call(f[0]),m.set.defaultSide()}},flip:{up:function(){if(m.is.complete()&&!m.is.animating()&&!h.allowRepeats)return void m.debug("Side already visible",f);if(m.is.animating())m.queue("flip up");else{m.debug("Flipping up",f);var e=m.get.transform.up();m.set.stageSize(),m.stage.above(),m.animate(e)}},down:function(){if(m.is.complete()&&!m.is.animating()&&!h.allowRepeats)return void m.debug("Side already visible
|