|
|
!function(a,b,c,d){a.fn.dimmer=function(b){var c,e=a(this),f=a.isPlainObject(b)?a.extend(!0,{},a.fn.dimmer.settings,b):a.fn.dimmer.settings,g=("."+f.namespace,"module-"+f.namespace,e.selector||""),h=(e.size(),(new Date).getTime()),i=[],j=arguments[0],k="string"==typeof j,l=[].slice.call(arguments,1),m=f.selector,n=f.namespace,o=f.className,p=f.error;return e.each(function(){var b,e=a(this),q=e.children(m.dimmer).first(),r="animationend msAnimationEnd oAnimationEnd webkitAnimationEnd",s=this,t=q.data("module-"+n);b={initialize:function(){b.is.dimmer()?(q=e,e=q.parent(),b.debug("Module initialized as dimmer",q)):(b.has.dimmer()?(q=e.find(m.dimmer),b.debug("Module initialized with found dimmer",q)):(q=f.template.dimmer(),q.appendTo(e),b.debug("Module initialized with created dimmer",q)),"hover"==f.on?e.on("mouseenter",b.show).on("mouseleave",b.hide):"click"==f.on&&e.on("click",b.toggle)),e.addClass(o.dimmable),f.closable&&q.on("click",b.event.click),b.instantiate()},instantiate:function(){b.verbose("Storing instance of module"),t=b,q.data("module-"+n,t)},destroy:function(){b.verbose("Destroying previous module for",e),e.off(n)},event:{click:function(c){b.verbose("Determining if event occured on dimmer",c),console.log(c.target,m.content,a(c.target).is(m.content)),(0===q.find(c.target).size()||a(c.target).is(m.content))&&b.hide()}},animate:{show:function(){b.set.dimmed(),"css"==f.animation.show?(b.verbose("Showing dimmer animation with css"),q.one(r,function(){b.set.active(),q.removeClass(o.show)}).addClass(o.show)):"fade"==f.animation.show&&(b.verbose("Showing dimmer animation with javascript"),q.stop().css({opacity:0,width:"100%",height:"100%"}).fadeTo(f.duration,1,function(){q.removeAttr("style"),b.set.active()}))},hide:function(){b.remove.dimmed(),"css"==f.animation.hide?(b.verbose("Hiding dimmer with css"),q.one(r,function(){b.remove.active(),q.removeClass(o.hide)}).addClass(o.hide)):"fade"==f.animation.hide?(b.verbose("Hiding dimmer with javascript"),q.stop().fadeOut(.75*f.duration,function(){q.removeAttr("style"),b.remove.active()})):a.isFunction(f.animation.hide)&&a.proxy(f.animation.hide,q)()}},has:{dimmer:function(){return e.children(m.dimmer).size()>0}},is:{animating:function(){return q.hasClass(o.show)||q.hasClass(o.hide)||q.is(":animated")},dimmer:function(){return e.is(m.dimmer)},pageDimmer:function(){return e.is(m.pageDimmer)},dimmable:function(){return e.is(m.dimmable)},enabled:function(){return!e.hasClass(o.disabled)},disabled:function(){return e.hasClass(o.disabled)},active:function(){return q.hasClass(o.active)}},can:{show:function(){return!q.hasClass(o.disabled)}},set:{active:function(){q.addClass(o.active)},dimmed:function(){e.addClass(o.dimmed)},disabled:function(){q.addClass(o.disabled)}},remove:{active:function(){q.removeClass(o.active)},dimmed:function(){e.removeClass(o.dimmed)},disabled:function(){q.removeClass(o.disabled)}},show:function(){b.debug("Showing dimmer",q),b.is.active()&&!b.is.animating()||!b.is.enabled()?b.debug("Dimmer is already shown or disabled"):(b.animate.show(),a.proxy(f.onShow,s)(),a.proxy(f.onChange,s)())},hide:function(){b.is.active()||b.is.animating()?(b.debug("Hiding dimmer",q),b.animate.hide(),a.proxy(f.onHide,s)(),a.proxy(f.onChange,s)()):b.debug("Dimmer is not visible")},toggle:function(){b.verbose("Toggling dimmer visibility",q),b.is.hidden()?b.show():b.hide()},setting:function(b,c){return c===d?f[b]:(a.isPlainObject(b)?a.extend(!0,f,b):f[b]=c,void 0)},internal:function(c,e){return e===d?b[c]:(a.isPlainObject(c)?a.extend(!0,b,c):b[c]=e,void 0)},debug:function(){f.debug&&(f.performance?b.performance.log(arguments):b.debug=Function.prototype.bind.call(console.info,console,f.moduleName+":"))},verbose:function(){f.verbose&&f.debug&&(f.performance?b.performance.log(arguments):b.verbose=Function.prototype.bind.call(console.info,console,f.moduleName+":"))},error:function(){b.error=Function.prototype.bind.call(console.log,console,f.moduleName+":")},performance:{log:function(a){var c,d,e;f.performance&&(c=(new Date).getTime(),e=h||c,d=c-e,h=c,i.push({Element:s,Name:a[0],Arguments
|