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.9 KiB
1 lines
5.9 KiB
!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,arguments)},performance:{log:function(a){var c,d,e;g.performance&&(c=(new Date).getTime(),e=o||c,d=c-e,o=c,p.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 c=g.name+":",e=0;o=!1,clearTimeout(b.performance.timer),a.each(p,function(a,b){e+=b["Execution Time"]}),c+=" "+e+"ms",n&&(c+=" '"+n+"'"),f.size()>1&&(c+=" ("+f.size()+")"),(console.group!==d||console.table!==d)&&p.length>0&&(console.groupCollapsed(c),console.table?console.table(p):a.each(p,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),p=[]}},invoke:function(c,f,g){var h,i,j;return f=f||s,g=u||g,"string"==typeof c&&v!==d&&(c=c.split(/[\. ]/),h=c.length-1,a.each(c,function(e,f){var g=e!=h?f+c[e+1].charAt(0).toUpperCase()+c[e+1].slice(1):c;if(a.isPlainObject(v[f])&&e!=h)v=v[f];else{if(!a.isPlainObject(v[g])||e==h)return v[f]!==d?(i=v[f],!1):v[g]!==d?(i=v[g],!1):(b.error(k.method),!1);v=v[g]}})),a.isFunction(i)?j=i.apply(g,f):i!==d&&(j=i),a.isArray(e)?e.push(j):"string"==typeof e?e=[e,j]:j!==d&&(e=j),i}},r?(v===d&&b.initialize(),b.invoke(q)):(v!==d&&b.destroy(),b.initialize())}),e!==d?e:this},a.fn.dimmer.settings={name:"Dimmer",namespace:"dimmer",verbose:!0,debug:!0,performance:!0,transition:"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",pageDimmer:"page",hide:"hide",show:"show",transition:"transition hidden visible"}}}(jQuery,window,document);
|