wishthis/semantic/dist/components/dimmer.min.js

11 lines
8.5 KiB
JavaScript
Raw Normal View History

2022-01-13 13:00:31 +00:00
/*
* # 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
*
*/
2022-03-15 09:43:53 +00:00
!function(T,e,F,D){"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 h,b=T(this),v=(new Date).getTime(),y=[],C=p,w="string"==typeof C,x=[].slice.call(arguments,1);return b.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=b.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.debug("Showing dimmer",o,a),g.set.variation(),g.is.dimmed()&&!g.is.animating()||!g.is.enabled()?g.debug("Dimmer is already shown or disabled"):(g.animate.show(e),a.onShow.call(u),a.onChange.call(u))},hide:function(e){e=T.isFunction(e)?e:function(){},g.is.dimmed()||g.is.animating()?(g.debug("Hiding dimmer",o),g.animate.hide(e),a.onHide.call(u),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!==D&&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({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(),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(),e()}))},hide:function(e){e=T.isFunction(e)?e:function(){},a.useCSS&&T.fn.transition!==D&&o.transition("is supported")?(g.verbose("Hiding dimmer with css"),o.transition({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(),e()}})):(g.verbose("Hiding dimmer with javascript"),o.stop().fadeOut(g.get.duration(),function(){g.remove.dimmed(),g.remove.active(),o.removeAttr("style"),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:{acti