1234567891011 |
- /*
- * # Fomantic UI - 2.8.4
- * https://github.com/fomantic/Fomantic-UI
- * http://fomantic-ui.com/
- *
- * Copyright 2014 Contributors
- * Released under the MIT license
- * http://opensource.org/licenses/MIT
- *
- */
- !function(E,e,Y,F){"use strict";E.isFunction=E.isFunction||function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},e=void 0!==e&&e.Math==Math?e:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),E.fn.shape=function(b){var x,y=E(this),w=(new Date).getTime(),C=[],S=b,T="string"==typeof S,W=[].slice.call(arguments,1),A=e.requestAnimationFrame||e.mozRequestAnimationFrame||e.webkitRequestAnimationFrame||e.msRequestAnimationFrame||function(e){setTimeout(e,0)};return y.each(function(){var n,o,e,t=y.selector||"",r=E.isPlainObject(b)?E.extend(!0,{},E.fn.shape.settings,b):E.extend({},E.fn.shape.settings),i=r.namespace,s=r.selector,a=r.error,d=r.className,l="."+i,u="module-"+i,c=E(this),f=c.find(">"+s.sides),g=f.find(">"+s.side),h=!1,m=this,p=c.data(u),v={initialize:function(){v.verbose("Initializing module for",m),v.set.defaultSide(),v.instantiate()},instantiate:function(){v.verbose("Storing instance of module",v),p=v,c.data(u,p)},destroy:function(){v.verbose("Destroying previous module for",m),c.removeData(u).off(l)},refresh:function(){v.verbose("Refreshing selector cache for",m),c=E(m),f=E(this).find(s.sides),g=E(this).find(s.side)},repaint:function(){v.verbose("Forcing repaint event");(f[0]||Y.createElement("div")).offsetWidth},animate:function(e,t){v.verbose("Animating box with properties",e),t=t||function(e){v.verbose("Executing animation callback"),e!==F&&e.stopPropagation(),v.reset(),v.set.active()},r.beforeChange.call(o[0]),v.get.transitionEvent()?(v.verbose("Starting CSS animation"),c.addClass(d.animating),f.css(e).one(v.get.transitionEvent(),t),v.set.duration(r.duration),A(function(){c.addClass(d.animating),n.addClass(d.hidden)})):t()},queue:function(e){v.debug("Queueing animation of",e),f.one(v.get.transitionEvent(),function(){v.debug("Executing queued animation"),setTimeout(function(){c.shape(e)},0)})},reset:function(){v.verbose("Animating states reset"),c.removeClass(d.animating).attr("style","").removeAttr("style"),f.attr("style","").removeAttr("style"),g.attr("style","").removeAttr("style").removeClass(d.hidden),o.removeClass(d.animating).attr("style","").removeAttr("style")},is:{complete:function(){return g.filter("."+d.active)[0]==o[0]},animating:function(){return c.hasClass(d.animating)},hidden:function(){return 0<c.closest(":hidden").length}},set:{defaultSide:function(){n=g.filter("."+r.className.active),o=0<n.next(s.side).length?n.next(s.side):g.first(),h=!1,v.verbose("Active side set to",n),v.verbose("Next side set to",o)},duration:function(e){e="number"==typeof(e=e||r.duration)?e+"ms":e,v.verbose("Setting animation duration",e),!r.duration&&0!==r.duration||f.add(g).css({"-webkit-transition-duration":e,"-moz-transition-duration":e,"-ms-transition-duration":e,"-o-transition-duration":e,"transition-duration":e})},currentStageSize:function(){var e=g.filter("."+r.className.active),t=e.outerWidth(!0),i=e.outerHeight(!0);c.css({width:t,height:i})},stageSize:function(){var e=c.clone().addClass(d.loading),t=e.find(">"+s.sides+">"+s.side),i=t.filter("."+r.className.active),n=h?t.eq(h):0<i.next(s.side).length?i.next(s.side):t.first(),o="next"===r.width?n.outerWidth(!0):"initial"===r.width?c.width():r.width,a="next"===r.height?n.outerHeight(!0):"initial"===r.height?c.height():r.height;i.removeClass(d.active),n.addClass(d.active),e.insertAfter(c),e.remove(),"auto"!==r.width&&(c.css("width",o+r.jitter),v.verbose("Specifying width during animation",o)),"auto"!==r.height&&(c.css("height",a+r.jitter),v.verbose("Specifying height during animation",a))},nextSide:function(e){h=e,o=g.filter(e),h=g.index(o),0===o.length&&(v.set.defaultSide(),v.error(a.side)),v.verbose("Next side manually set to",o)},active:function(){v.verbose("Setting new side to active",o),g.removeClass(d.active),o.addClass(d.active),r.onChange.call(o[0]),v.set.defaultSide()}},flip:{to:function(e,t){var i;v.is.hidden()?v.debug("Module not visible",o):!v.is.complete()||v.is.animating()||r.allowRepeats?(i=v.get.transform[e](),v.is.animating()?v.queue("flip "+e):(v.debug("Flipping "+e,o),v.set.stageSize(),v.stage[t](),v.animate(i))):v.debug("Side already visible",o)},up:function(){v.flip.to("up","above")},down:function(){v.flip.to("down","below")},left:function(){v.flip.to("left","left")},right:function(){v.flip.to("right","right")},over:function(){v.flip.to("over","behind")},back:function(){v.flip.to("back","behind")}},get:{transform:{up:function(){var e=n.outerHeight(!0)/2;return{transform:"translateY("+(o.outerHeight(!0)-e)+"px) translateZ(-"+e+"px) rotateX(-90deg)"}},down:function(){var e=n.outerHeight(!0)/2;return{transform:"translateY(-"+e+"px) translateZ(-"+e+"px) rotateX(90deg)"}},left:function(){var e=n.outerWidth(!0)/2;return{transform:"translateX("+(o.outerWidth(!0)-e)+"px) translateZ(-"+e+"px) rotateY(90deg)"}},right:function(){var e=n.outerWidth(!0)/2;return{transform:"translateX(-"+e+"px) translateZ(-"+e+"px) rotateY(-90deg)"}},over:function(){return{transform:"translateX("+-(n.outerWidth(!0)-o.outerWidth(!0))/2+"px) rotateY(180deg)"}},back:function(){return{transform:"translateX("+-(n.outerWidth(!0)-o.outerWidth(!0))/2+"px) rotateY(-180deg)"}}},transitionEvent:function(){var e,t=Y.createElement("element"),i={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(e in i)if(t.style[e]!==F)return i[e]},nextSide:function(){return 0<n.next(s.side).length?n.next(s.side):g.first()}},stage:{above:function(){var e={origin:(n.outerHeight(!0)-o.outerHeight(!0))/2,depth:{active:o.outerHeight(!0)/2,next:n.outerHeight(!0)/2}};v.verbose("Setting the initial animation position as above",o,e),n.css({transform:"rotateX(0deg)"}),o.addClass(d.animating).css({top:e.origin+"px",transform:"rotateX(90deg) translateZ("+e.depth.next+"px) translateY(-"+e.depth.active+"px)"})},below:function(){var e={origin:(n.outerHeight(!0)-o.outerHeight(!0))/2,depth:{active:o.outerHeight(!0)/2,next:n.outerHeight(!0)/2}};v.verbose("Setting the initial animation position as below",o,e),n.css({transform:"rotateX(0deg)"}),o.addClass(d.animating).css({top:e.origin+"px",transform:"rotateX(-90deg) translateZ("+e.depth.next+"px) translateY("+e.depth.active+"px)"})},left:function(){var e=n.outerWidth(!0),t=o.outerWidth(!0),i={origin:(e-t)/2,depth:{active:t/2,next:e/2}};v.verbose("Setting the initial animation position as left",o,i),n.css({transform:"rotateY(0deg)"}),o.addClass(d.animating).css({left:i.origin+"px",transform:"rotateY(-90deg) translateZ("+i.depth.next+"px) translateX(-"+i.depth.active+"px)"})},right:function(){var e=n.outerWidth(!0),t=o.outerWidth(!0),i={origin:(e-t)/2,depth:{active:t/2,next:e/2}};v.verbose("Setting the initial animation position as right",o,i),n.css({transform:"rotateY(0deg)"}),o.addClass(d.animating).css({left:i.origin+"px",transform:"rotateY(90deg) translateZ("+i.depth.next+"px) translateX("+i.depth.active+"px)"})},behind:function(){var e=n.outerWidth(!0),t=o.outerWidth(!0),i={origin:(e-t)/2,depth:{active:t/2,next:e/2}};v.verbose("Setting the initial animation position as behind",o,i),n.css({transform:"rotateY(0deg)"}),o.addClass(d.animating).css({left:i.origin+"px",transform:"rotateY(-180deg)"})}},setting:function(e,t){if(v.debug("Changing setting",e,t),E.isPlainObject(e))E.extend(!0,r,e);else{if(t===F)return r[e];E.isPlainObject(r[e])?E.extend(!0,r[e],t):r[e]=t}},internal:function(e,t){if(E.isPlainObject(e))E.extend(!0,v,e);else{if(t===F)return v[e];v[e]=t}},debug:function(){!r.silent&&r.debug&&(r.performance?v.performance.log(arguments):(v.debug=Function.prototype.bind.call(console.info,console,r.name+":"),v.debug.apply(console,arguments)))},verbose:function(){!r.silent&&r.verbose&&r.debug&&(r.performance?v.performance.log(arguments):(v.verbose=Function.prototype.bind.call(console.info,console,r.name+":"),v.verbose.apply(console,arguments)))},error:function(){r.silent||(v.error=Function.prototype.bind.call(console.error,console,r.name+":"),v.error.apply(console,arguments))},performance:{log:function(e){var t,i;r.performance&&(i=(t=(new Date).getTime())-(w||t),w=t,C.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:m,"Execution Time":i})),clearTimeout(v.performance.timer),v.performance.timer=setTimeout(v.performance.display,500)},display:function(){var e=r.name+":",i=0;w=!1,clearTimeout(v.performance.timer),E.each(C,function(e,t){i+=t["Execution Time"]}),e+=" "+i+"ms",t&&(e+=" '"+t+"'"),1<y.length&&(e+=" ("+y.length+")"),(console.group!==F||console.table!==F)&&0<C.length&&(console.groupCollapsed(e),console.table?console.table(C):E.each(C,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),C=[]}},invoke:function(n,e,t){var o,a,i,r=p;return e=e||W,t=m||t,"string"==typeof n&&r!==F&&(n=n.split(/[\. ]/),o=n.length-1,E.each(n,function(e,t){var i=e!=o?t+n[e+1].charAt(0).toUpperCase()+n[e+1].slice(1):n;if(E.isPlainObject(r[i])&&e!=o)r=r[i];else{if(r[i]!==F)return a=r[i],!1;if(!E.isPlainObject(r[t])||e==o)return r[t]!==F&&(a=r[t]),!1;r=r[t]}})),E.isFunction(a)?i=a.apply(t,e):a!==F&&(i=a),Array.isArray(x)?x.push(i):x!==F?x=[x,i]:i!==F&&(x=i),a}};T?(p===F&&v.initialize(),0<(e=c.find("input")).length?(e.blur(),setTimeout(function(){v.invoke(S)},150)):v.invoke(S)):(p!==F&&p.invoke("destroy"),v.initialize())}),x!==F?x:this},E.fn.shape.settings={name:"Shape",silent:!1,debug:!1,verbose:!1,jitter:0,performance:!0,namespace:"shape",width:"initial",height:"initial",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);
|