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