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

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