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

/*!
* # Semantic UI 2.0.0 - Shape
* http://github.com/semantic-org/semantic-ui/
*
*
* Copyright 2015 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
!function(e,t,i,n){"use strict";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||"",v=e.isPlainObject(a)?e.extend(!0,{},e.fn.shape.settings,a):e.extend({},e.fn.shape.settings),h=v.namespace,b=v.selector,x=v.error,y=v.className,S="."+h,w="module-"+h,z=e(this),C=z.find(b.sides),W=z.find(b.side),H=!1,T=this,Z=z.data(w);m={initialize:function(){m.verbose("Initializing module for",T),m.set.defaultSide(),m.instantiate()},instantiate:function(){m.verbose("Storing instance of module",m),Z=m,z.data(w,Z)},destroy:function(){m.verbose("Destroying previous module for",T),z.removeData(w).off(S)},refresh:function(){m.verbose("Refreshing selector cache for",T),z=e(T),C=e(this).find(b.shape),W=e(this).find(b.side)},repaint:function(){m.verbose("Forcing repaint event");{var e=C[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()},v.beforeChange.call(f[0]),m.get.transitionEvent()?(m.verbose("Starting CSS animation"),z.addClass(y.animating),C.css(e).one(m.get.transitionEvent(),i),m.set.duration(v.duration),g(function(){z.addClass(y.animating),t.addClass(y.hidden)})):i()},queue:function(e){m.debug("Queueing animation of",e),C.one(m.get.transitionEvent(),function(){m.debug("Executing queued animation"),setTimeout(function(){z.shape(e)},0)})},reset:function(){m.verbose("Animating states reset"),z.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 z.hasClass(y.animating)}},set:{defaultSide:function(){t=z.find("."+v.className.active),f=t.next(b.side).length>0?t.next(b.side):z.find(b.side).first(),H=!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),(v.duration||0===v.duration)&&C.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=z.find("."+v.className.active),t=e.outerWidth(!0),i=e.outerHeight(!0);z.css({width:t,height:i})},stageSize:function(){var e=z.clone().addClass(y.loading),t=e.find("."+v.className.active),i=H?e.find(b.side).eq(H):t.next(b.side).length>0?t.next(b.side):e.find(b.side).first(),n={};m.set.currentStageSize(),t.removeClass(y.active),i.addClass(y.active),e.insertAfter(z),n={width:i.outerWidth(!0),height:i.outerHeight(!0)},e.remove(),z.css(n),m.verbose("Resizing stage to fit new content",n)},nextSide:function(e){H=e,f=W.filter(e),H=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),v.onChange.call(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.stageSize(),m.stage.right(),m.animate(m.get.transform.right()))):void m.debug("Side already visible",f)},over:function(){return!m.is.complete()||m.is.animating()||v.allowRepeats?void(m.is.animating()?m.queue("flip over"):(m.debug("Flipping over",f),m.set.stageSize(),m.stage.behind(),m.animate(m.get.transform.over()))):void m.debug("Side already visible",f)},back:function(){return!m.is.complete()||m.is.animating()||v.allowRepeats?void(m.is.animating()?m.queue("flip back"):(m.debug("Flipping back",f),m.set.stageSize(),m.stage.behind(),m.animate(m.get.transform.back()))):void m.debug("Side already visible",f)}},get:{transform:{up:function(){var e={y:-((t.outerHeight(!0)-f.outerHeight(!0))/2),z:-(t.outerHeight(!0)/2)};return{transform:"translateY("+e.y+"px) translateZ("+e.z+"px) rotateX(-90deg)"}},down:function(){var e={y:-((t.outerHeight(!0)-f.outerHeight(!0))/2),z:-(t.outerHeight(!0)/2)};return{transform:"translateY("+e.y+"px) translateZ("+e.z+"px) rotateX(90deg)"}},left:function(){var e={x:-((t.outerWidth(!0)-f.outerWidth(!0))/2),z:-(t.outerWidth(!0)/2)};return{transform:"translateX("+e.x+"px) translateZ("+e.z+"px) rotateY(90deg)"}},right:function(){var e={x:-((t.outerWidth(!0)-f.outerWidth(!0))/2),z:-(t.outerWidth(!0)/2)};return{transform:"translateX("+e.x+"px) translateZ("+e.z+"px) rotateY(-90deg)"}},over:function(){var e={x:-((t.outerWidth(!0)-f.outerWidth(!0))/2)};return{transform:"translateX("+e.x+"px) rotateY(180deg)"}},back:function(){var e={x:-((t.outerWidth(!0)-f.outerWidth(!0))/2)};return{transform:"translateX("+e.x+"px) rotateY(-180deg)"}}},transitionEvent:function(){var e,t=i.createElement("element"),a={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(e in a)if(t.style[e]!==n)return a[e]},nextSide:function(){return t.next(b.side).length>0?t.next(b.side):z.find(b.side).first()}},stage:{above:function(){var e={origin:(t.outerHeight(!0)-f.outerHeight(!0))/2,depth:{active:f.outerHeight(!0)/2,next:t.outerHeight(!0)/2}};m.verbose("Setting the initial animation position as above",f,e),C.css({transform:"translateZ(-"+e.depth.active+"px)"}),t.css({transform:"rotateY(0deg) translateZ("+e.depth.active+"px)"}),f.addClass(y.animating).css({top:e.origin+"px",transform:"rotateX(90deg) translateZ("+e.depth.next+"px)"})},below:function(){var e={origin:(t.outerHeight(!0)-f.outerHeight(!0))/2,depth:{active:f.outerHeight(!0)/2,next:t.outerHeight(!0)/2}};m.verbose("Setting the initial animation position as below",f,e),C.css({transform:"translateZ(-"+e.depth.active+"px)"}),t.css({transform:"rotateY(0deg) translateZ("+e.depth.active+"px)"}),f.addClass(y.animating).css({top:e.origin+"px",transform:"rotateX(-90deg) translateZ("+e.depth.next+"px)"})},left:function(){var e={active:t.outerWidth(!0),next:f.outerWidth(!0)},i={origin:(e.active-e.next)/2,depth:{active:e.next/2,next:e.active/2}};m.verbose("Setting the initial animation position as left",f,i),C.css({transform:"translateZ(-"+i.depth.active+"px)"}),t.css({transform:"rotateY(0deg) translateZ("+i.depth.active+"px)"}),f.addClass(y.animating).css({left:i.origin+"px",transform:"rotateY(-90deg) translateZ("+i.depth.next+"px)"})},right:function(){var e={active:t.outerWidth(!0),next:f.outerWidth(!0)},i={origin:(e.active-e.next)/2,depth:{active:e.next/2,next:e.active/2}};m.verbose("Setting the initial animation position as left",f,i),C.css({transform:"translateZ(-"+i.depth.active+"px)"}),t.css({transform:"rotateY(0deg) translateZ("+i.depth.active+"px)"}),f.addClass(y.animating).css({left:i.origin+"px",transform:"rotateY(90deg) translateZ("+i.depth.next+"px)"})},behind:function(){var e={active:t.outerWidth(!0),next:f.outerWidth(!0)},i={origin:(e.active-e.next)/2,depth:{active:e.next/2,next:e.active/2}};m.verbose("Setting the initial animation position as behind",f,i),t.css({transform:"rotateY(0deg)"}),f.addClass(y.animating).css({left:i.origin+"px",transform:"rotateY(-180deg)"})}},setting:function(t,i){if(m.debug("Changing setting",t,i),e.isPlainObject(t))e.extend(!0,v,t);else{if(i===n)return v[t];v[t]=i}},internal:function(t,i){if(e.isPlainObject(t))e.extend(!0,m,t);else{if(i===n)return m[t];m[t]=i}},debug:function(){v.debug&&(v.performance?m.performance.log(arguments):(m.debug=Function.prototype.bind.call(console.info,console,v.name+":"),m.debug.apply(console,arguments)))},verbose:function(){v.verbose&&v.debug&&(v.performance?m.performance.log(arguments):(m.verbose=Function.prototype.bind.call(console.info,console,v.name+":"),m.verbose.apply(console,arguments)))},error:function(){m.error=Function.prototype.bind.call(console.error,console,v.name+":"),m.error.apply(console,arguments)},performance:{log:function(e){var t,i,n;v.performance&&(t=(new Date).getTime(),n=s||t,i=t-n,s=t,d.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:T,"Execution Time":i})),clearTimeout(m.performance.timer),m.performance.timer=setTimeout(m.performance.display,500)},display:function(){var t=v.name+":",i=0;s=!1,clearTimeout(m.performance.timer),e.each(d,function(e,t){i+=t["Execution Time"]}),t+=" "+i+"ms",p&&(t+=" '"+p+"'"),r.length>1&&(t+=" ("+r.length+")"),(console.group!==n||console.table!==n)&&d.length>0&&(console.groupCollapsed(t),console.table?console.table(d):e.each(d,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),d=[]}},invoke:function(t,i,a){var r,s,d,l=Z;return i=i||c,a=T||a,"string"==typeof t&&l!==n&&(t=t.split(/[\. ]/),r=t.length-1,e.each(t,function(i,a){var o=i!=r?a+t[i+1].charAt(0).toUpperCase()+t[i+1].slice(1):t;if(e.isPlainObject(l[o])&&i!=r)l=l[o];else{if(l[o]!==n)return s=l[o],!1;if(!e.isPlainObject(l[a])||i==r)return l[a]!==n?(s=l[a],!1):!1;l=l[a]}})),e.isFunction(s)?d=s.apply(a,i):s!==n&&(d=s),e.isArray(o)?o.push(d):o!==n?o=[o,d]:d!==n&&(o=d),s}},u?(Z===n&&m.initialize(),m.invoke(l)):(Z!==n&&Z.invoke("destroy"),m.initialize())}),o!==n?o:this},e.fn.shape.settings={name:"Shape",debug:!1,verbose:!1,performance:!0,namespace:"shape",beforeChange:function(){},onChange:function(){},allowRepeats:!1,duration:!1,error:{side:"You tried to switch to a side that does not exist.",method:"The method you called is not defined"},className:{animating:"animating",hidden:"hidden",loading:"loading",active:"active"},selector:{sides:".sides",side:".side"}}}(jQuery,window,document);