|
|
/* * # Semantic UI - 1.7.2 * https://github.com/Semantic-Org/Semantic-UI
* http://www.semantic-ui.com/
* * Copyright 2014 Contributors * Released under the MIT license * http://opensource.org/licenses/MIT
* */ !function(e,i,n,t){e.fn.dimmer=function(i){var o,a=e(this),r=(new Date).getTime(),m=[],s=arguments[0],d="string"==typeof s,c=[].slice.call(arguments,1);return a.each(function(){var u,l,f,g=e.isPlainObject(i)?e.extend(!0,{},e.fn.dimmer.settings,i):e.extend({},e.fn.dimmer.settings),h=g.selector,p=g.namespace,b=g.className,v=g.error,C="."+p,w="module-"+p,y=a.selector||"",D="ontouchstart"in n.documentElement?"touchstart":"click",S=e(this),T=this,N=S.data(w);f={preinitialize:function(){f.is.dimmer()?(l=S.parent(),u=S):(l=S,u=f.has.dimmer()?g.dimmerName?l.children(h.dimmer).filter("."+g.dimmerName):l.children(h.dimmer):f.create())},initialize:function(){f.debug("Initializing dimmer",g),"hover"==g.on?l.on("mouseenter"+C,f.show).on("mouseleave"+C,f.hide):"click"==g.on&&l.on(D+C,f.toggle),f.is.page()&&(f.debug("Setting as a page dimmer",l),f.set.pageDimmer()),f.is.closable()&&(f.verbose("Adding dimmer close event",u),u.on(D+C,f.event.click)),f.set.dimmable(),f.instantiate()},instantiate:function(){f.verbose("Storing instance of module",f),N=f,S.data(w,N)},destroy:function(){f.verbose("Destroying previous module",u),S.removeData(w),l.off(C),u.off(C)},event:{click:function(i){f.verbose("Determining if event occured on dimmer",i),(0===u.find(i.target).length||e(i.target).is(h.content))&&(f.hide(),i.stopImmediatePropagation())}},addContent:function(i){var n=e(i);f.debug("Add content to dimmer",n),n.parent()[0]!==u[0]&&n.detach().appendTo(u)},create:function(){var i=e(g.template.dimmer());return g.variation&&(f.debug("Creating dimmer with variation",g.variation),i.addClass(b.variation)),g.dimmerName&&(f.debug("Creating named dimmer",g.dimmerName),i.addClass(g.dimmerName)),i.appendTo(l),i},show:function(i){i=e.isFunction(i)?i:function(){},f.debug("Showing dimmer",u,g),f.is.dimmed()&&!f.is.animating()||!f.is.enabled()?f.debug("Dimmer is already shown or disabled"):(f.animate.show(i),g.onShow.call(T),g.onChange.call(T))},hide:function(i){i=e.isFunction(i)?i:function(){},f.is.dimmed()||f.is.animating()?(f.debug("Hiding dimmer",u),f.animate.hide(i),g.onHide.call(T),g.onChange.call(T)):f.debug("Dimmer is not visible")},toggle:function(){f.verbose("Toggling dimmer visibility",u),f.is.dimmed()?f.hide():f.show()},animate:{show:function(i){i=e.isFunction(i)?i:function(){},g.useCSS&&e.fn.transition!==t&&u.transition("is supported")?u.transition({animation:g.transition+" in",queue:!1,duration:f.get.duration(),onStart:function(){f.set.dimmed()},onComplete:function(){f.set.active(),i()}}):(f.verbose("Showing dimmer animation with javascript"),f.set.dimmed(),u.stop().css({opacity:0,width:"100%",height:"100%"}).fadeTo(f.get.duration(),1,function(){u.removeAttr("style"),f.set.active(),i()}))},hide:function(i){i=e.isFunction(i)?i:function(){},g.useCSS&&e.fn.transition!==t&&u.transition("is supported")?(f.verbose("Hiding dimmer with css"),u.transition({animation:g.transition+" out",queue:!1,duration:f.get.duration(),onStart:function(){f.remove.dimmed()},onComplete:function(){f.remove.active(),i()}})):(f.verbose("Hiding dimmer with javascript"),f.remove.dimmed(),u.stop().fadeOut(f.get.duration(),function(){f.remove.active(),u.removeAttr("style"),i()}))}},get:{dimmer:function(){return u},duration:function(){return"object"==typeof g.duration?f.is.active()?g.duration.hide:g.duration.show:g.duration}},has:{dimmer:function(){return g.dimmerName?S.children(h.dimmer).filter("."+g.dimmerName).length>0:S.children(h.dimmer).length>0}},is:{active:function(){return u.hasClass(b.active)},animating:function(){return u.is(":animated")||u.hasClass(b.animating)},closable:function(){return"auto"==g.closable?"hover"==g.on?!1:!0:g.closable},dimmer:function(){return S.is(h.dimmer)},dimmable:function(){return S.is(h.dimmable)},dimmed:function(){return l.hasClass(b.dimmed)},disabled:function(){return l.hasClass(b.disabled)},enabled:function(){return!f.is.disabled()},page:function(){return l.is("body")},pageDimmer:function(){return u.hasClass(b.pageDimmer)}},can:{show:function(){return!u.hasClass(b.disabled)}},set:{active:function(){u.addClass(b.active)},dimmable:function(){l.
|