wishthis/node_modules/fomantic-ui/dist/components/dimmer.min.js
2022-10-10 10:26:02 +02:00

11 lines
No EOL
8.9 KiB
JavaScript

/*
* # Fomantic UI - 2.9.0
* https://github.com/fomantic/Fomantic-UI
* http://fomantic-ui.com/
*
* Copyright 2022 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
!function(T,e,F,S){"use strict";T.isFunction=T.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")(),T.fn.dimmer=function(p){var b,h=T(this),v=(new Date).getTime(),y=[],C=p,w="string"==typeof C,x=[].slice.call(arguments,1);return h.each(function(){var o,i,a=T.isPlainObject(p)?T.extend(!0,{},T.fn.dimmer.settings,p):T.extend({},T.fn.dimmer.settings),n=a.selector,e=a.namespace,t=a.className,s=a.error,r="."+e,d="module-"+e,m=h.selector||"",c="ontouchstart"in F.documentElement?"touchstart":"click",l=T(this),u=this,f=l.data(d),g={preinitialize:function(){o=g.is.dimmer()?(i=l.parent(),l):(i=l,g.has.dimmer()?a.dimmerName?i.find(n.dimmer).filter("."+a.dimmerName):i.find(n.dimmer):g.create())},initialize:function(){g.debug("Initializing dimmer",a),g.bind.events(),g.set.dimmable(),g.instantiate()},instantiate:function(){g.verbose("Storing instance of module",g),f=g,l.data(d,f)},destroy:function(){g.verbose("Destroying previous module",o),g.unbind.events(),g.remove.variation(),i.off(r)},bind:{events:function(){"hover"==a.on?i.on("mouseenter"+r,g.show).on("mouseleave"+r,g.hide):"click"==a.on&&i.on(c+r,g.toggle),g.is.page()&&(g.debug("Setting as a page dimmer",i),g.set.pageDimmer()),g.is.closable()&&(g.verbose("Adding dimmer close event",o),i.on(c+r,n.dimmer,g.event.click))}},unbind:{events:function(){l.removeData(d),i.off(r)}},event:{click:function(e){g.verbose("Determining if event occurred on dimmer",e),0!==o.find(e.target).length&&!T(e.target).is(n.content)||(g.hide(),e.stopImmediatePropagation())}},addContent:function(e){e=T(e);g.debug("Add content to dimmer",e),e.parent()[0]!==o[0]&&e.detach().appendTo(o)},create:function(){var e=T(a.template.dimmer(a));return a.dimmerName&&(g.debug("Creating named dimmer",a.dimmerName),e.addClass(a.dimmerName)),e.appendTo(i),e},show:function(e){e=T.isFunction(e)?e:function(){},g.is.dimmed()&&!g.is.animating()||!g.is.enabled()?g.debug("Dimmer is already shown or disabled"):!1===a.onShow.call(u)?g.verbose("Show callback returned false cancelling dimmer show"):(g.debug("Showing dimmer",o,a),g.set.variation(),g.animate.show(e),a.onChange.call(u))},hide:function(e){e=T.isFunction(e)?e:function(){},g.is.dimmed()||g.is.animating()?!1===a.onHide.call(u)?g.verbose("Hide callback returned false cancelling dimmer hide"):(g.debug("Hiding dimmer",o),g.animate.hide(e),a.onChange.call(u)):g.debug("Dimmer is not visible")},toggle:function(){g.verbose("Toggling dimmer visibility",o),g.is.dimmed()?g.is.closable()&&g.hide():g.show()},animate:{show:function(e){e=T.isFunction(e)?e:function(){},a.useCSS&&T.fn.transition!==S&&o.transition("is supported")?(a.useFlex?(g.debug("Using flex dimmer"),g.remove.legacy()):(g.debug("Using legacy non-flex dimmer"),g.set.legacy()),"auto"!==a.opacity&&g.set.opacity(),o.transition({debug:a.debug,verbose:a.verbose,silent:a.silent,displayType:a.useFlex?"flex":"block",animation:(a.transition.showMethod||a.transition)+" in",queue:!1,duration:g.get.duration(),useFailSafe:!0,onStart:function(){g.set.dimmed()},onComplete:function(){g.set.active(),a.onVisible.call(o),e()}})):(g.verbose("Showing dimmer animation with javascript"),g.set.dimmed(),"auto"==a.opacity&&(a.opacity=.8),o.stop().css({opacity:0,width:"100%",height:"100%"}).fadeTo(g.get.duration(),a.opacity,function(){o.removeAttr("style"),g.set.active(),a.onVisible.call(o),e()}))},hide:function(e){e=T.isFunction(e)?e:function(){},a.useCSS&&T.fn.transition!==S&&o.transition("is supported")?(g.verbose("Hiding dimmer with css"),o.transition({debug:a.debug,verbose:a.verbose,silent:a.silent,displayType:a.useFlex?"flex":"block",animation:(a.transition.hideMethod||a.transition)+" out",queue:!1,duration:g.get.duration(),useFailSafe:!0,onComplete:function(){g.remove.dimmed(),g.remove.variation(),g.remove.active(),a.onHidden.call(o),e()}})):(g.verbose("Hiding dimmer with javascript"),o.stop().fadeOut(g.get.duration(),function(){g.remove.dimmed(),g.remove.active(),o.removeAttr("style"),a.onHidden.call(o),e()}))}},get:{dimmer:function(){return o},duration:function(){return g.is.active()?a.transition.hideDuration||a.duration.hide||a.duration:a.transition.showDuration||a.duration.show||a.duration}},has:{dimmer:function(){return a.dimmerName?0<l.find(n.dimmer).filter("."+a.dimmerName).length:0<l.find(n.dimmer).length}},is:{active:function(){return o.hasClass(t.active)},animating:function(){return o.is(":animated")||o.hasClass(t.animating)},closable:function(){return"auto"==a.closable?"hover"!=a.on:a.closable},dimmer:function(){return l.hasClass(t.dimmer)},dimmable:function(){return l.hasClass(t.dimmable)},dimmed:function(){return i.hasClass(t.dimmed)},disabled:function(){return i.hasClass(t.disabled)},enabled:function(){return!g.is.disabled()},page:function(){return i.is("body")},pageDimmer:function(){return o.hasClass(t.pageDimmer)}},can:{show:function(){return!o.hasClass(t.disabled)}},set:{opacity:function(e){var i=o.css("background-color"),n=i.split(","),t=n&&3<=n.length;e=0===a.opacity?0:a.opacity||e,i=t?(n[2]=n[2].replace(")",""),n[3]=e+")",n.join(",")):"rgba(0, 0, 0, "+e+")",g.debug("Setting opacity to",e),o.css("background-color",i)},legacy:function(){o.addClass(t.legacy)},active:function(){o.addClass(t.active)},dimmable:function(){i.addClass(t.dimmable)},dimmed:function(){i.addClass(t.dimmed)},pageDimmer:function(){o.addClass(t.pageDimmer)},disabled:function(){o.addClass(t.disabled)},variation:function(e){(e=e||a.variation)&&o.addClass(e)}},remove:{active:function(){o.removeClass(t.active)},legacy:function(){o.removeClass(t.legacy)},dimmed:function(){i.removeClass(t.dimmed)},disabled:function(){o.removeClass(t.disabled)},variation:function(e){(e=e||a.variation)&&o.removeClass(e)}},setting:function(e,i){if(g.debug("Changing setting",e,i),T.isPlainObject(e))T.extend(!0,a,e);else{if(i===S)return a[e];T.isPlainObject(a[e])?T.extend(!0,a[e],i):a[e]=i}},internal:function(e,i){if(T.isPlainObject(e))T.extend(!0,g,e);else{if(i===S)return g[e];g[e]=i}},debug:function(){!a.silent&&a.debug&&(a.performance?g.performance.log(arguments):(g.debug=Function.prototype.bind.call(console.info,console,a.name+":"),g.debug.apply(console,arguments)))},verbose:function(){!a.silent&&a.verbose&&a.debug&&(a.performance?g.performance.log(arguments):(g.verbose=Function.prototype.bind.call(console.info,console,a.name+":"),g.verbose.apply(console,arguments)))},error:function(){a.silent||(g.error=Function.prototype.bind.call(console.error,console,a.name+":"),g.error.apply(console,arguments))},performance:{log:function(e){var i,n;a.performance&&(n=(i=(new Date).getTime())-(v||i),v=i,y.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:u,"Execution Time":n})),clearTimeout(g.performance.timer),g.performance.timer=setTimeout(g.performance.display,500)},display:function(){var e=a.name+":",n=0;v=!1,clearTimeout(g.performance.timer),T.each(y,function(e,i){n+=i["Execution Time"]}),e+=" "+n+"ms",m&&(e+=" '"+m+"'"),1<h.length&&(e+=" ("+h.length+")"),(console.group!==S||console.table!==S)&&0<y.length&&(console.groupCollapsed(e),console.table?console.table(y):T.each(y,function(e,i){console.log(i.Name+": "+i["Execution Time"]+"ms")}),console.groupEnd()),y=[]}},invoke:function(t,e,i){var o,a,n,r=f;return e=e||x,i=i||u,"string"==typeof t&&r!==S&&(t=t.split(/[\. ]/),o=t.length-1,T.each(t,function(e,i){var n=e!=o?i+t[e+1].charAt(0).toUpperCase()+t[e+1].slice(1):t;if(T.isPlainObject(r[n])&&e!=o)r=r[n];else{if(r[n]!==S)return a=r[n],!1;{if(!T.isPlainObject(r[i])||e==o)return r[i]!==S?a=r[i]:g.error(s.method,t),!1;r=r[i]}}})),T.isFunction(a)?n=a.apply(i,e):a!==S&&(n=a),Array.isArray(b)?b.push(n):b!==S?b=[b,n]:n!==S&&(b=n),a}};g.preinitialize(),w?(f===S&&g.initialize(),g.invoke(C)):(f!==S&&f.invoke("destroy"),g.initialize())}),b!==S?b:this},T.fn.dimmer.settings={name:"Dimmer",namespace:"dimmer",silent:!1,debug:!1,verbose:!1,performance:!0,useFlex:!0,dimmerName:!1,variation:!1,closable:"auto",useCSS:!0,transition:"fade",on:!1,opacity:"auto",duration:{show:500,hide:500},displayLoader:!1,loaderText:!1,loaderVariation:"",onChange:function(){},onShow:function(){},onHide:function(){},onVisible:function(){},onHidden:function(){},error:{method:"The method you called is not defined."},className:{active:"active",animating:"animating",dimmable:"dimmable",dimmed:"dimmed",dimmer:"dimmer",disabled:"disabled",hide:"hide",legacy:"legacy",pageDimmer:"page",show:"show",loader:"ui loader"},selector:{dimmer:"> .ui.dimmer",content:".ui.dimmer > .content, .ui.dimmer > .content > .center"},template:{dimmer:function(e){var i,n=T("<div/>").addClass("ui dimmer");return e.displayLoader&&(i=T("<div/>").addClass(e.className.loader).addClass(e.loaderVariation),e.loaderText&&(i.text(e.loaderText),i.addClass("text")),n.append(i)),n}}}}(jQuery,window,document);