wishthis/node_modules/fomantic-ui/dist/components/dimmer.min.js

11 lines
8.6 KiB
JavaScript
Raw Normal View History

2022-01-13 13:00:31 +00:00
/*
* # Fomantic UI - 2.9.3
2022-01-13 13:00:31 +00:00
* https://github.com/fomantic/Fomantic-UI
2023-08-17 09:47:40 +00:00
* https://fomantic-ui.com/
2022-01-13 13:00:31 +00:00
*
2023-08-17 09:47:40 +00:00
* Copyright 2023 Contributors
2022-01-13 13:00:31 +00:00
* Released under the MIT license
2023-08-17 09:47:40 +00:00
* https://opensource.org/licenses/MIT
2022-01-13 13:00:31 +00:00
*
*/
!function(x,e,T){"use strict";function S(e){return"function"==typeof e&&"number"!=typeof e.nodeType}e=void 0!==e&&e.Math===Math?e:globalThis,x.fn.dimmer=function(g){var v,b=x(this),p=Date.now(),h=[],y=g,C="string"==typeof y,w=[].slice.call(arguments,1);return b.each(function(){var o,i,a=x.isPlainObject(g)?x.extend(!0,{},x.fn.dimmer.settings,g):x.extend({},x.fn.dimmer.settings),n=a.selector,e=a.namespace,t=a.className,d=a.error,r="."+e,s="module-"+e,m="ontouchstart"in T.documentElement?"touchstart":"click",l=x(this),c=this,u=l.data(s),f={preinitialize:function(){o=f.is.dimmer()?(i=l.parent(),l):(i=l,f.has.dimmer()?a.dimmerName?i.find(n.dimmer).filter("."+a.dimmerName):i.find(n.dimmer):f.create())},initialize:function(){f.debug("Initializing dimmer",a),f.bind.events(),f.set.dimmable(),f.instantiate()},instantiate:function(){f.verbose("Storing instance of module",f),u=f,l.data(s,u)},destroy:function(){f.verbose("Destroying previous module",o),f.unbind.events(),f.remove.variation(),i.off(r)},bind:{events:function(){"hover"===a.on?i.on("mouseenter"+r,f.show).on("mouseleave"+r,f.hide):"click"===a.on&&i.on(m+r,f.toggle),f.is.page()&&(f.debug("Setting as a page dimmer",i),f.set.pageDimmer()),f.is.closable()&&(f.verbose("Adding dimmer close event",o),i.on(m+r,n.dimmer,f.event.click))}},unbind:{events:function(){l.removeData(s),i.off(r)}},event:{click:function(e){f.verbose("Determining if event occurred on dimmer",e),0!==o.find(e.target).length&&!x(e.target).is(n.content)||(f.hide(),e.stopImmediatePropagation())}},addContent:function(e){e=x(e);f.debug("Add content to dimmer",e),e.parent()[0]!==o[0]&&e.detach().appendTo(o)},create:function(){var e=x(a.template.dimmer(a));return a.dimmerName&&(f.debug("Creating named dimmer",a.dimmerName),e.addClass(a.dimmerName)),e.appendTo(i),e},show:function(e){e=S(e)?e:function(){},f.is.dimmed()&&!f.is.animating()||!f.is.enabled()?f.debug("Dimmer is already shown or disabled"):!1===a.onShow.call(c)?f.verbose("Show callback returned false cancelling dimmer show"):(f.debug("Showing dimmer",o,a),f.set.variation(),f.animate.show(e),a.onChange.call(c))},hide:function(e){e=S(e)?e:function(){},f.is.dimmed()||f.is.animating()?!1===a.onHide.call(c)?f.verbose("Hide callback returned false cancelling dimmer hide"):(f.debug("Hiding dimmer",o),f.animate.hide(e),a.onChange.call(c)):f.debug("Dimmer is not visible")},toggle:function(){f.verbose("Toggling dimmer visibility",o),f.is.dimmed()?f.is.closable()&&f.hide():f.show()},animate:{show:function(e){e=S(e)?e:function(){},a.useCSS&&void 0!==x.fn.transition?(a.useFlex?(f.debug("Using flex dimmer"),f.remove.legacy()):(f.debug("Using legacy non-flex dimmer"),f.set.legacy()),"auto"!==a.opacity&&f.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:f.get.duration(),useFailSafe:!0,onStart:function(){f.set.dimmed()},onComplete:function(){f.set.active(),a.onVisible.call(o),e()}})):(f.verbose("Showing dimmer animation with javascript"),f.set.dimmed(),"auto"===a.opacity&&(a.opacity=.8),o.stop().css({opacity:0,width:"100%",height:"100%"}).fadeTo(f.get.duration(),a.opacity,function(){o.removeAttr("style"),f.set.active(),a.onVisible.call(o),e()}))},hide:function(e){e=S(e)?e:function(){},a.useCSS&&void 0!==x.fn.transition?(f.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:f.get.duration(),useFailSafe:!0,onComplete:function(){f.remove.dimmed(),f.remove.variation(),f.remove.active(),a.onHidden.call(o),e()}})):(f.verbose("Hiding dimmer with javascript"),o.stop().fadeOut(f.get.duration(),function(){f.remove.dimmed(),f.remove.active(),o.removeAttr("style"),a.onHidden.call(o),e()}))}},get:{dimmer:function(){return o},duration:function(){return f.is.active()?a.transition.hideDuration||a.duration.hide||a.duration:a.transition.showDuration||a.duration.show||a.duration}},has:{dimmer:function(){