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
6.1 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,i,u=a(this),v=this,w=u.data(m);i={preinitialize:function(){i.is.dimmer()?(c=u.parent(),b=u):(c=u,i.has.dimmer()?b=c.children(h.dimmer).first():i.create())},initialize:function(){i.debug("Initializing dimmer",g),"hover"==g.on?c.on("mouseenter"+l,i.show).on("mouseleave"+l,i.hide):"click"==g.on&&c.on(t+l,i.toggle),i.is.page()&&(i.debug("Setting as a page dimmer",c),i.set.pageDimmer()),g.closable&&(i.verbose("Adding dimmer close event",b),b.on(t+l,i.event.click)),i.set.dimmable(),i.instantiate()},instantiate:function(){i.verbose("Storing instance of module",i),w=i,u.data(m,w)},destroy:function(){i.verbose("Destroying previous module",b),c.off(l),b.off(l)},event:{click:function(c){i.verbose("Determining if event occured on dimmer",c),(0===b.find(c.target).size()||a(c.target).is(h.content))&&(i.hide(),c.stopImmediatePropagation())}},addContent:function(c){var d=a(c).detach();i.debug("Add content to dimmer",d),d.parent()[0]!==b[0]&&b.append(d)},create:function(){return b=a(g.template.dimmer()),b.appendTo(c)},animate:{show:function(c){c=c||function(){},i.set.dimmed(),a.fn.transition!==d?b.transition(g.transition+" in",i.get.duration(),function(){i.set.active(),c()}):(i.verbose("Showing dimmer animation with javascript"),b.stop().css({opacity:0,width:"100%",height:"100%"}).fadeTo(i.get.duration(),1,function(){b.removeAttr("style"),i.set.active(),c()}))},hide:function(c){c=c||function(){},i.remove.dimmed(),a.fn.transition!==d?(i.verbose("Hiding dimmer with css"),b.transition(g.transition+" out",i.get.duration(),function(){i.remove.active(),c()})):(i.verbose("Hiding dimmer with javascript"),b.stop().fadeOut(i.get.duration(),function(){b.removeAttr("style"),i.remove.active(),c()}))}},get:{dimmer:function(){return b},duration:function(){return"object"==typeof g.duration?i.is.active()?g.duration.hide:g.duration.show:g.duration}},has:{dimmer:function(){return u.children(h.dimmer).size()>0}},is:{dimmer:function(){return u.is(h.dimmer)},dimmable:function(){return u.is(h.dimmable)},active:function(){return b.hasClass(j.active)},animating:function(){return b.is(":animated")||b.hasClass(j.transition)},page:function(){return c.is("body")},enabled:function(){return!c.hasClass(j.disabled)},disabled:function(){return c.hasClass(j.disabled)},pageDimmer:function(){return b.hasClass(j.pageDimmer)}},can:{show:function(){return!b.hasClass(j.disabled)}},set:{active:function(){b.removeClass(j.transition).addClass(j.active)},dimmable:function(){c.addClass(j.dimmable)},dimmed:function(){c.addClass(j.dimmed)},pageDimmer:function(){b.addClass(j.pageDimmer)},disabled:function(){b.addClass(j.disabled)}},remove:{active:function(){b.removeClass(j.transition).removeClass(j.active)},dimmed:function(){c.removeClass(j.dimmed)},disabled:function(){b.removeClass(j.disabled)}},show:function(c){i.debug("Showing dimmer",b,g),i.is.active()||i.is.animating()||!i.is.enabled()?i.debug("Dimmer is already shown or disabled"):(i.animate.show(c),a.proxy(g.onShow,v)(),a.proxy(g.onChange,v)())},hide:function(c){i.is.active()&&!i.is.animating()?(i.debug("Hiding dimmer",b),i.animate.hide(c),a.proxy(g.onHide,v)(),a.proxy(g.onChange,v)()):i.debug("Dimmer is not visible")},toggle:function(){i.verbose("Toggling dimmer visibility",b),i.is.active()?i.hide():i.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(b,c){return c===d?i[b]:(a.isPlainObject(b)?a.extend(!0,i,b):i[b]=c,void 0)},debug:function(){g.debug&&(g.performance?i.performance.log(arguments):(i.debug=Function.prototype.bind.call(console.info,console,g.name+":"),i.debug.apply(console,arguments)))},verbose:function(){g.verbose&&g.debug&&(g.performance?i.performance.log(arguments):(i.verbose=Function.prototype.bind.call(console.info,console,g.name+":"),i.verbose.apply(console,arguments)))},error:function(){i.error=Function.prototype.bind.call(console.error,console,g.name+":"),i.error.apply(console,arguments)},performance:{log:function(a){var b,c,d;g.performance&&(b=(new Date).getTime(),d=o||b,c=b-d,o=b,p.push({Element:v,Name:a[0],Arguments:[].slice.call(a,1)||"","Execution Time":c})),clearTimeout(i.performance.timer),i.performance.timer=setTimeout(i.performance.display,100)},display:function(){var b=g.name+":",c=0;o=!1,clearTimeout(i.performance.timer),a.each(p,function(a,b){c+=b["Execution Time"]}),b+=" "+c+"ms",n&&(b+=" '"+n+"'"),f.size()>1&&(b+=" ("+f.size()+")"),(console.group!==d||console.table!==d)&&p.length>0&&(console.groupCollapsed(b),console.table?console.table(p):a.each(p,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),p=[]}},invoke:function(b,c,f){var g,h,j;return c=c||s,f=v||f,"string"==typeof b&&w!==d&&(b=b.split(/[\. ]/),g=b.length-1,a.each(b,function(c,e){var f=c!=g?e+b[c+1].charAt(0).toUpperCase()+b[c+1].slice(1):b;if(a.isPlainObject(w[e])&&c!=g)w=w[e];else{if(!a.isPlainObject(w[f])||c==g)return w[e]!==d?(h=w[e],!1):w[f]!==d?(h=w[f],!1):(i.error(k.method),!1);w=w[f]}})),a.isFunction(h)?j=h.apply(f,c):h!==d&&(j=h),a.isArray(e)?e.push(j):"string"==typeof e?e=[e,j]:j!==d&&(e=j),h}},i.preinitialize(),r?(w===d&&i.initialize(),i.invoke(q)):(w!==d&&i.destroy(),i.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:{show:500,hide: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",dimmable:"ui dimmable",dimmed:"dimmed",disabled:"disabled",pageDimmer:"page",hide:"hide",show:"show",transition:"transition"}}}(jQuery,window,document);