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
9.4 KiB
11 lines
9.4 KiB
/*
|
|
* # Semantic UI
|
|
* git://github.com/Semantic-Org/Semantic-UI.git
|
|
*
|
|
*
|
|
* Copyright 2014 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"),d=(new Date).getTime(),u=[],c=arguments[0],l="string"==typeof c,g=[].slice.call(arguments,1),f=t.requestAnimationFrame||t.mozRequestAnimationFrame||t.webkitRequestAnimationFrame||t.msRequestAnimationFrame||function(e){setTimeout(e,0)};return r.each(function(){var t,m,p,h=r.selector||"",v=e.extend(!0,{},e.fn.shape.settings,a),b=v.namespace,x=v.selector,y=v.error,z=v.className,C="."+b,W="module-"+b,S=e(this),w=S.find(x.sides),k=S.find(x.side),T=!1,E=this,F=S.data(W);p={initialize:function(){p.verbose("Initializing module for",E),p.set.defaultSide(),p.instantiate()},instantiate:function(){p.verbose("Storing instance of module",p),F=p,S.data(W,F)},destroy:function(){p.verbose("Destroying previous module for",E),S.removeData(W).off(C)},refresh:function(){p.verbose("Refreshing selector cache for",E),S=e(E),w=e(this).find(x.shape),k=e(this).find(x.side)},repaint:function(){p.verbose("Forcing repaint event");{var e=w.get(0)||i.createElement("div");e.offsetWidth}},animate:function(i,a){p.verbose("Animating box with properties",i),a=a||function(e){p.verbose("Executing animation callback"),e!==n&&e.stopPropagation(),p.reset(),p.set.active()},e.proxy(v.beforeChange,m[0])(),p.get.transitionEvent()?(p.verbose("Starting CSS animation"),S.addClass(z.animating),w.css(i).one(p.get.transitionEvent(),a),p.set.duration(v.duration),f(function(){S.addClass(z.animating),t.addClass(z.hidden)})):a()},queue:function(e){p.debug("Queueing animation of",e),w.one(p.get.transitionEvent(),function(){p.debug("Executing queued animation"),setTimeout(function(){S.shape(e)},0)})},reset:function(){p.verbose("Animating states reset"),S.removeClass(z.animating).attr("style","").removeAttr("style"),w.attr("style","").removeAttr("style"),k.attr("style","").removeAttr("style").removeClass(z.hidden),m.removeClass(z.animating).attr("style","").removeAttr("style")},is:{animating:function(){return S.hasClass(z.animating)}},set:{defaultSide:function(){t=S.find("."+v.className.active),m=t.next(x.side).size()>0?t.next(x.side):S.find(x.side).first(),T=!1,p.verbose("Active side set to",t),p.verbose("Next side set to",m)},duration:function(e){e=e||v.duration,e="number"==typeof e?e+"ms":e,p.verbose("Setting animation duration",e),w.add(k).css({"-webkit-transition-duration":e,"-moz-transition-duration":e,"-ms-transition-duration":e,"-o-transition-duration":e,"transition-duration":e})},stageSize:function(){var e=S.clone().addClass(z.loading),t=e.find("."+v.className.active),i=T?e.find(T):t.next(x.side).size()>0?t.next(x.side):e.find(x.side).first(),n={};t.removeClass(z.active),i.addClass(z.active),e.prependTo(s),n={width:i.outerWidth(),height:i.outerHeight()},e.remove(),S.css(n),p.verbose("Resizing stage to fit new content",n)},nextSide:function(e){T=e,m=S.find(e),0===m.size()&&p.error(y.side),p.verbose("Next side manually set to",m)},active:function(){p.verbose("Setting new side to active",m),k.removeClass(z.active),m.addClass(z.active),e.proxy(v.onChange,m[0])(),p.set.defaultSide()}},flip:{up:function(){p.debug("Flipping up",m),p.is.animating()?p.queue("flip up"):(p.set.stageSize(),p.stage.above(),p.animate(p.get.transform.up()))},down:function(){p.debug("Flipping down",m),p.is.animating()?p.queue("flip down"):(p.set.stageSize(),p.stage.below(),p.animate(p.get.transform.down()))},left:function(){p.debug("Flipping left",m),p.is.animating()?p.queue("flip left"):(p.set.stageSize(),p.stage.left(),p.animate(p.get.transform.left()))},right:function(){p.debug("Flipping right",m),p.is.animating()?p.queue("flip right"):(p.set.stageSize(),p.stage.right(),p.animate(p.get.transform.right()))},over:function(){p.debug("Flipping over",m),p.is.animating()?p.queue("flip over"):(p.set.stageSize(),p.stage.behind(),p.animate(p.get.transform.over()))},back:function(){p.debug("Flipping back",m),p.is.animating()?p.queue("flip back"):(p.set.stageSize(),p.stage.behind(),p.animate(p.get.transform.back()))}},get:{transform:{up:function(){var e={y:-((t.outerHeight()-m.outerHeight())/2),z:-(t.outerHeight()/2)};return{transform:"translateY("+e.y+"px) translateZ("+e.z+"px) rotateX(-90deg)"}},down:function(){var e={y:-((t.outerHeight()-m.outerHeight())/2),z:-(t.outerHeight()/2)};return{transform:"translateY("+e.y+"px) translateZ("+e.z+"px) rotateX(90deg)"}},left:function(){var e={x:-((t.outerWidth()-m.outerWidth())/2),z:-(t.outerWidth()/2)};return{transform:"translateX("+e.x+"px) translateZ("+e.z+"px) rotateY(90deg)"}},right:function(){var e={x:-((t.outerWidth()-m.outerWidth())/2),z:-(t.outerWidth()/2)};return{transform:"translateX("+e.x+"px) translateZ("+e.z+"px) rotateY(-90deg)"}},over:function(){var e={x:-((t.outerWidth()-m.outerWidth())/2)};return{transform:"translateX("+e.x+"px) rotateY(180deg)"}},back:function(){var e={x:-((t.outerWidth()-m.outerWidth())/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(x.side).size()>0?t.next(x.side):S.find(x.side).first()}},stage:{above:function(){var e={origin:(t.outerHeight()-m.outerHeight())/2,depth:{active:m.outerHeight()/2,next:t.outerHeight()/2}};p.verbose("Setting the initial animation position as above",m,e),t.css({transform:"rotateY(0deg) translateZ("+e.depth.active+"px)"}),m.addClass(z.animating).css({display:"block",top:e.origin+"px",transform:"rotateX(90deg) translateZ("+e.depth.next+"px)"})},below:function(){var e={origin:(t.outerHeight()-m.outerHeight())/2,depth:{active:m.outerHeight()/2,next:t.outerHeight()/2}};p.verbose("Setting the initial animation position as below",m,e),t.css({transform:"rotateY(0deg) translateZ("+e.depth.active+"px)"}),m.addClass(z.animating).css({display:"block",top:e.origin+"px",transform:"rotateX(-90deg) translateZ("+e.depth.next+"px)"})},left:function(){var e={origin:(t.outerWidth()-m.outerWidth())/2,depth:{active:m.outerWidth()/2,next:t.outerWidth()/2}};p.verbose("Setting the initial animation position as left",m,e),t.css({transform:"rotateY(0deg) translateZ("+e.depth.active+"px)"}),m.addClass(z.animating).css({display:"block",left:e.origin+"px",transform:"rotateY(-90deg) translateZ("+e.depth.next+"px)"})},right:function(){var e={origin:(t.outerWidth()-m.outerWidth())/2,depth:{active:m.outerWidth()/2,next:t.outerWidth()/2}};p.verbose("Setting the initial animation position as left",m,e),t.css({transform:"rotateY(0deg) translateZ("+e.depth.active+"px)"}),m.addClass(z.animating).css({display:"block",left:e.origin+"px",transform:"rotateY(90deg) translateZ("+e.depth.next+"px)"})},behind:function(){var e={origin:(t.outerWidth()-m.outerWidth())/2,depth:{active:m.outerWidth()/2,next:t.outerWidth()/2}};p.verbose("Setting the initial animation position as behind",m,e),t.css({transform:"rotateY(0deg)"}),m.addClass(z.animating).css({display:"block",left:e.origin+"px",transform:"rotateY(-180deg)"})}},setting:function(t,i){if(p.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,p,t);else{if(i===n)return p[t];p[t]=i}},debug:function(){v.debug&&(v.performance?p.performance.log(arguments):(p.debug=Function.prototype.bind.call(console.info,console,v.name+":"),p.debug.apply(console,arguments)))},verbose:function(){v.verbose&&v.debug&&(v.performance?p.performance.log(arguments):(p.verbose=Function.prototype.bind.call(console.info,console,v.name+":"),p.verbose.apply(console,arguments)))},error:function(){p.error=Function.prototype.bind.call(console.error,console,v.name+":"),p.error.apply(console,arguments)},performance:{log:function(e){var t,i,n;v.performance&&(t=(new Date).getTime(),n=d||t,i=t-n,d=t,u.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:E,"Execution Time":i})),clearTimeout(p.performance.timer),p.performance.timer=setTimeout(p.performance.display,100)},display:function(){var t=v.name+":",i=0;d=!1,clearTimeout(p.performance.timer),e.each(u,function(e,t){i+=t["Execution Time"]}),t+=" "+i+"ms",h&&(t+=" '"+h+"'"),r.size()>1&&(t+=" ("+r.size()+")"),(console.group!==n||console.table!==n)&&u.length>0&&(console.groupCollapsed(t),console.table?console.table(u):e.each(u,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),u=[]}},invoke:function(t,i,a){var r,s,d,u=F;return i=i||g,a=E||a,"string"==typeof t&&u!==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(u[o])&&i!=r)u=u[o];else{if(u[o]!==n)return s=u[o],!1;if(!e.isPlainObject(u[a])||i==r)return u[a]!==n?(s=u[a],!1):!1;u=u[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}},l?(F===n&&p.initialize(),p.invoke(c)):(F!==n&&p.destroy(),p.initialize())}),o!==n?o:this},e.fn.shape.settings={name:"Shape",debug:!1,verbose:!0,performance:!0,namespace:"shape",beforeChange:function(){},onChange:function(){},duration:700,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);
|