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
4.1 KiB

!function(a,b,c,d){a.fn.accordion=function(b){var c,e=a(this),f=a.isPlainObject(b)?a.extend(!0,{},a.fn.accordion.settings,b):a.fn.accordion.settings,g=f.className,h=f.namespace,i=f.selector,j=f.errors,k="."+h,l="module-"+h,m=e.selector||"",n=(new Date).getTime(),o=[],p=arguments[0],q="string"==typeof p,r=[].slice.call(arguments,1);return e.each(function(){var b,e=a(this),h=e.find(i.title),s=(e.find(i.icon),e.find(i.content)),t=this,u=e.data(l);b={initialize:function(){b.debug("Initializing accordion with bound events",e),h.on("click"+k,b.event.click),b.instantiate()},instantiate:function(){e.data(l,b)},destroy:function(){b.debug("Destroying previous accordion for",e),e.off(k).removeData(l)},event:{click:function(){b.verbose("Title clicked",this);var c=a(this),d=h.index(c);b.toggle(d)},resetStyle:function(){b.verbose("Resetting styles on element",this),a(this).removeAttr("style").children().removeAttr("style")}},toggle:function(a){b.debug("Toggling content content at index",a);var c=h.eq(a),d=c.hasClass(g.active);d?f.collapsible?b.close(a):b.debug("Cannot close accordion content collapsing is disabled"):b.open(a)},open:function(c){var d=h.eq(c),e=d.next(s),i=h.filter("."+g.active),j=i.next(h),k=i.size()>0;e.is(":animated")||(b.debug("Opening accordion content",d),f.exclusive&&k&&(i.removeClass(g.active),j.stop().children().animate({opacity:0},f.speed,b.event.resetStyle).end().slideUp(f.speed,f.easing,function(){j.removeClass(g.active).removeAttr("style").children().removeAttr("style")})),d.addClass(g.active),e.stop().children().removeAttr("style").end().slideDown(f.speed,f.easing,function(){e.addClass(g.active).removeAttr("style"),a.proxy(f.onOpen,e)(),a.proxy(f.onChange,e)()}))},close:function(c){var d=h.eq(c),e=d.next(s);b.debug("Closing accordion content",d),d.removeClass(g.active),e.removeClass(g.active).show().stop().children().animate({opacity:0},f.speed,b.event.resetStyle).end().slideUp(f.speed,f.easing,function(){e.removeAttr("style"),a.proxy(f.onClose,e)(),a.proxy(f.onChange,e)()})},setting:function(c,e){return b.debug("Changing setting",c,e),e===d?f[c]:(a.isPlainObject(c)?a.extend(!0,f,c):f[c]=e,void 0)},internal:function(c,e){return b.debug("Changing internal",c,e),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+":"),b.debug.apply(console,arguments)))},verbose:function(){f.verbose&&f.debug&&(f.performance?b.performance.log(arguments):(b.verbose=Function.prototype.bind.call(console.info,console,f.moduleName+":"),b.verbose.apply(console,arguments)))},error:function(){b.error=Function.prototype.bind.call(console.error,console,f.moduleName+":"),b.error.apply(console,arguments)},performance:{log:function(a){var c,d,e;f.performance&&(c=(new Date).getTime(),e=n||c,d=c-e,n=c,o.push({Element:t,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=f.moduleName+":",e=0;n=!1,clearTimeout(b.performance.timer),a.each(o,function(a,b){e+=b["Execution Time"]}),c+=" "+e+"ms",m&&(c+=" '"+m+"'"),(console.group!==d||console.table!==d)&&o.length>0&&(console.groupCollapsed(c),console.table?console.table(o):a.each(o,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),o=[]}},invoke:function(c,e,f){var g,h;return e=e||r,f=t||f,"string"==typeof c&&u!==d&&(c=c.split(/[\. ]/),g=c.length-1,a.each(c,function(c,e){return a.isPlainObject(u[e])&&c!=g?(u=u[e],!0):u[e]!==d?(h=u[e],!0):(b.error(j.method),!1)})),a.isFunction(h)?h.apply(f,e):h||!1}},q?(u===d&&b.initialize(),c=b.invoke(p)):(u!==d&&b.destroy(),b.initialize())}),c?c:this},a.fn.accordion.settings={moduleName:"Accordion",debug:!0,verbose:!0,performance:!0,exclusive:!0,collapsible:!0,onOpen:function(){},onClose:function(){},onChange:function(){},error:{method:"The method you called is not defined"},className:{active:"active",hover:"hover"},selector:{title:".title",icon:".icon",content:".content"},speed:500,easing:"easeInOutQuint"}}(jQuery,window,document);