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