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