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

11 lines
8.7 KiB
JavaScript
Raw Normal View History

2022-01-13 13:00:31 +00:00
/*
2023-08-17 09:47:40 +00:00
* # Fomantic UI - 2.9.2
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
*
*/
2023-08-17 09:47:40 +00:00
!function(T,e,S){"use strict";function D(e){return"function"==typeof e&&"number"!=typeof e.nodeType}e=void 0!==e&&e.Math===Math?e:globalThis,T.fn.dimmer=function(v){var b,p=T(this),h=Date.now(),y=[],C=v,w="string"==typeof C,x=[].slice.call(arguments,1);return p.each(function(){var o,i,a=T.isPlainObject(v)?T.extend(!0,{},T.fn.dimmer.settings,v):T.extend({},T.fn.dimmer.settings),n=a.selector,e=a.namespace,t=a.className,d=a.error,r="."+e,s="module-"+e,m=p.selector||"",l="ontouchstart"in S.documentElement?"touchstart":"click",c=T(this),u=this,f=c.data(s),g={preinitialize:function(){o=g.is.dimmer()?(i=c.parent(),c):(i=c,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,c.data(s,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(l+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(l+r,n.dimmer,g.event.click))}},unbind:{events:function(){c.removeData(s),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=D(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=D(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=D(e)?e:function(){},a.useCSS&&void 0!==T.fn.transition?(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=D(e)?e:function(){},a.useCSS&&void 0!==T.fn.transition?(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:{d