You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
5.4 KiB
1 lines
5.4 KiB
!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:a[1]||"","Execution Time":d})),clearTimeout(b.performance.timer),b.performance.timer=setTimeout(b.performance.display,100)},display:function(){var b=f.moduleName+":",c=0;h=!1,a.each(i,function(a,b){c+=b["Execution Time"]}),b+=" "+c+"ms",g&&(b+=" '"+g+"'"),(console.group!==d||console.table!==d)&&i.length>0&&(console.groupCollapsed(b),console.table?console.table(i):a.each(i,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),i=[]}},invoke:function(c,e,f){var g,h;return e=e||l,f=s||f,"string"==typeof c&&t!==d&&(c=c.split("."),g=c.length-1,a.each(c,function(c,e){a.isPlainObject(t[e])&&c!=g?t=t[e]:t[e]!==d?h=t[e]:b.error(p.method)})),a.isFunction(h)?(t.verbose("Executing invoked function",h),h.apply(f,e)):h||!1}},k?(t===d&&b.initialize(),c=b.invoke(j)):(t===d&&b.destroy(),b.initialize())}),c?c:this},a.fn.dimmer.settings={moduleName:"Dimmer",namespace:"dimmer",verbose:!0,debug:!0,performance:!0,animation:{show:"fade",hide:"fade"},on:!1,closable:!0,duration:500,onChange:function(){},onShow:function(){},onHide:function(){},error:{method:"The method you called is not defined."},selector:{dimmable:".ui.dimmable",dimmer:".ui.dimmer",content:".ui.dimmer > .content"},template:{dimmer:function(){return a("<div />").attr("class","ui dimmer")}},className:{active:"active",animating:"animating",dimmable:"ui dimmable",dimmed:"dimmed",disabled:"disabled",hide:"hide",show:"show"}}}(jQuery,window,document);
|