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.

0 lines
5.2 KiB

10 years ago
  1. !function(a,b,c,d){"use strict";a.fn.accordion=function(c){{var e,f=a(this),g=(new Date).getTime(),h=[],i=arguments[0],j="string"==typeof i,k=[].slice.call(arguments,1);b.requestAnimationFrame||b.mozRequestAnimationFrame||b.webkitRequestAnimationFrame||b.msRequestAnimationFrame||function(a){setTimeout(a,0)}}return f.each(function(){var b,l=a.isPlainObject(c)?a.extend(!0,{},a.fn.accordion.settings,c):a.extend({},a.fn.accordion.settings),m=l.className,n=l.namespace,o=l.selector,p=(l.error,"."+n),q="module-"+n,r=f.selector||"",s=a(this),t=s.find(o.title),u=s.find(o.content),v=this,w=s.data(q);b={initialize:function(){b.debug("Initializing accordion with bound events",s),t.on("click"+p,b.event.click),b.instantiate()},instantiate:function(){w=b,s.data(q,b)},destroy:function(){b.debug("Destroying previous accordion for",s),s.removeData(q),t.off(p)},reset:{display:function(){b.verbose("Removing inline display from element",this),a(this).css("display",""),""===a(this).attr("style")&&a(this).attr("style","").removeAttr("style")},opacity:function(){b.verbose("Removing inline opacity from element",this),a(this).css("opacity",""),""===a(this).attr("style")&&a(this).attr("style","").removeAttr("style")}},event:{click:function(){a.proxy(b.toggle,this)()}},toggle:function(c){var e=c!==d?"number"==typeof c?t.eq(c):a(c):a(this),f=e.next(u),g=f.is(":visible");b.debug("Toggling visibility of content",e),g?l.collapsible?a.proxy(b.close,e)():b.debug("Cannot close accordion content collapsing is disabled"):a.proxy(b.open,e)()},open:function(c){var e=c!==d?"number"==typeof c?t.eq(c):a(c):a(this),f=e.next(u),g=f.is(":animated"),h=f.hasClass(m.active);g||h||(b.debug("Opening accordion content",e),l.exclusive&&a.proxy(b.closeOthers,e)(),e.addClass(m.active),f.stop().children().stop().animate({opacity:1},l.duration,b.reset.display).end().slideDown(l.duration,l.easing,function(){f.addClass(m.active),a.proxy(b.reset.display,this)(),a.proxy(l.onOpen,v)(),a.proxy(l.onChange,v)()}))},close:function(c){var e=c!==d?"number"==typeof c?t.eq(c):a(c):a(this),f=e.next(u),g=f.hasClass(m.active);g&&(b.debug("Closing accordion content",f),e.removeClass(m.active),f.removeClass(m.active).show().stop().children().stop().animate({opacity:0},l.duration,b.reset.opacity).end().slideUp(l.duration,l.easing,function(){a.proxy(b.reset.display,this)(),a.proxy(l.onClose,v)(),a.proxy(l.onChange,v)()}))},closeOthers:function(c){var e=c!==d?t.eq(c):a(this),f=e.parents(o.content).prev(o.title),g=e.closest(o.accordion),h=g.find(o.title+"."+m.active+":visible").not(f),i=h.next(u),j=h.size()>0;j&&(b.debug("Exclusive enabled, closing other content",h),h.removeClass(m.active),i.stop().children().stop().animate({opacity:0},l.duration,b.resetOpacity).end().slideUp(l.duration,l.easing,function(){a(this).removeClass(m.active),a.proxy(b.reset.display,this)()}))},setting:function(c,e){if(b.debug("Changing setting",c,e),a.isPlainObject(c))a.extend(!0,l,c);else{if(e===d)return l[c];l[c]=e}},internal:function(c,e){return b.debug("Changing internal",c,e),e===d?b[c]:void(a.isPlainObject(c)?a.extend(!0,b,c):b[c]=e)},debug:function(){l.debug&&(l.performance?b.performance.log(arguments):(b.debug=Function.prototype.bind.call(console.info,console,l.name+":"),b.debug.apply(console,arguments)))},verbose:function(){l.verbose&&l.debug&&(l.performance?b.performance.log(arguments):(b.verbose=Function.prototype.bind.call(console.info,console,l.name+":"),b.verbose.apply(console,arguments)))},error:function(){b.error=Function.prototype.bind.call(console.error,console,l.name+":"),b.error.apply(console,arguments)},performance:{log:function(a){var c,d,e;l.performance&&(c=(new Date).getTime(),e=g||c,d=c-e,g=c,h.push({Element:v,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=l.name+":",e=0;g=!1,clearTimeout(b.performance.timer),a.each(h,function(a,b){e+=b["Execution Time"]}),c+=" "+e+"ms",r&&(c+=" '"+r+"'"),(console.group!==d||console.table!==d)&&h.length>0&&(console.groupCollaps