11 lines
8.5 KiB
JavaScript
11 lines
8.5 KiB
JavaScript
|
/*
|
||
|
* # Fomantic UI - 2.8.8
|
||
|
* https://github.com/fomantic/Fomantic-UI
|
||
|
* http://fomantic-ui.com/
|
||
|
*
|
||
|
* Copyright 2021 Contributors
|
||
|
* Released under the MIT license
|
||
|
* http://opensource.org/licenses/MIT
|
||
|
*
|
||
|
*/
|
||
|
!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,s,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,d=a.error,r="."+e,m="module-"+e,c=b.selector||"",l="ontouchstart"in F.documentElement?"touchstart":"click",u=T(this),f=this,g=u.data(m);(s={preinitialize:function(){o=s.is.dimmer()?(i=u.parent(),u):(i=u,s.has.dimmer()?a.dimmerName?i.find(n.dimmer).filter("."+a.dimmerName):i.find(n.dimmer):s.create())},initialize:function(){s.debug("Initializing dimmer",a),s.bind.events(),s.set.dimmable(),s.instantiate()},instantiate:function(){s.verbose("Storing instance of module",s),g=s,u.data(m,g)},destroy:function(){s.verbose("Destroying previous module",o),s.unbind.events(),s.remove.variation(),i.off(r)},bind:{events:function(){"hover"==a.on?i.on("mouseenter"+r,s.show).on("mouseleave"+r,s.hide):"click"==a.on&&i.on(l+r,s.toggle),s.is.page()&&(s.debug("Setting as a page dimmer",i),s.set.pageDimmer()),s.is.closable()&&(s.verbose("Adding dimmer close event",o),i.on(l+r,n.dimmer,s.event.click))}},unbind:{events:function(){u.removeData(m),i.off(r)}},event:{click:function(e){s.verbose("Determining if event occurred on dimmer",e),0!==o.find(e.target).length&&!T(e.target).is(n.content)||(s.hide(),e.stopImmediatePropagation())}},addContent:function(e){var i=T(e);s.debug("Add content to dimmer",i),i.parent()[0]!==o[0]&&i.detach().appendTo(o)},create:function(){var e=T(a.template.dimmer(a));return a.dimmerName&&(s.debug("Creating named dimmer",a.dimmerName),e.addClass(a.dimmerName)),e.appendTo(i),e},show:function(e){e=T.isFunction(e)?e:function(){},s.debug("Showing dimmer",o,a),s.set.variation(),s.is.dimmed()&&!s.is.animating()||!s.is.enabled()?s.debug("Dimmer is already shown or disabled"):(s.animate.show(e),a.onShow.call(f),a.onChange.call(f))},hide:function(e){e=T.isFunction(e)?e:function(){},s.is.dimmed()||s.is.animating()?(s.debug("Hiding dimmer",o),s.animate.hide(e),a.onHide.call(f),a.onChange.call(f)):s.debug("Dimmer is not visible")},toggle:function(){s.verbose("Toggling dimmer visibility",o),s.is.dimmed()?s.is.closable()&&s.hide():s.show()},animate:{show:function(e){e=T.isFunction(e)?e:function(){},a.useCSS&&T.fn.transition!==D&&o.transition("is supported")?(a.useFlex?(s.debug("Using flex dimmer"),s.remove.legacy()):(s.debug("Using legacy non-flex dimmer"),s.set.legacy()),"auto"!==a.opacity&&s.set.opacity(),o.transition({displayType:a.useFlex?"flex":"block",animation:(a.transition.showMethod||a.transition)+" in",queue:!1,duration:s.get.duration(),useFailSafe:!0,onStart:function(){s.set.dimmed()},onComplete:function(){s.set.active(),e()}})):(s.verbose("Showing dimmer animation with javascript"),s.set.dimmed(),"auto"==a.opacity&&(a.opacity=.8),o.stop().css({opacity:0,width:"100%",height:"100%"}).fadeTo(s.get.duration(),a.opacity,function(){o.removeAttr("style"),s.set.active(),e()}))},hide:function(e){e=T.isFunction(e)?e:function(){},a.useCSS&&T.fn.transition!==D&&o.transition("is supported")?(s.verbose("Hiding dimmer with css"),o.transition({displayType:a.useFlex?"flex":"block",animation:(a.transition.hideMethod||a.transition)+" out",queue:!1,duration:s.get.duration(),useFailSafe:!0,onComplete:function(){s.remove.dimmed(),s.remove.variation(),s.remove.active(),e()}})):(s.verbose("Hiding dimmer with javascript"),o.stop().fadeOut(s.get.duration(),function(){s.remove.dimmed(),s.remove.active(),o.removeAttr("style"),e()}))}},get:{dimmer:function(){return o},duration:function(){return s.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<u.find(n.dimmer).filter("."+a.dimmerName).length:0<u.find(n.dimmer).length}},i
|