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.1 KiB

!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?t.eq(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?t.eq(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?t.eq(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.groupCollapsed(c),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,j=w;return c=c||k,f=v||f,"string"==typeof b&&j!==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(j[f])&&c!=g)j=j[f];else{if(j[f]!==d)return h=j[f],!1;if(!a.isPlainObject(j[e])||c==g)return j[e]!==d?(h=j[e],!1):!1;j=j[e]}})),a.isFunction(h)?i=h.apply(f,c):h!==d&&(i=h),a.isArray(e)?e.push(i):e!==d?e=[e,i]:i!==d&&(e=i),h}},j?(w===d&&b.initialize(),b.invoke(i)):(w!==d&&b.destroy(),b.initialize())}),e!==d?e:this},a.fn.accordion.settings={name:"Accordion",namespace:"accordion",debug:!1,verbose:!0,performance:!0,exclusive:!0,collapsible:!0,closeNested:!0,duration:500,easing:"easeInOutQuint",onOpen:function(){},onClose:function(){},onChange:function(){},error:{method:"The method you called is not defined"},className:{active:"active"},selector:{accordion:".accordion",title:".title",content:".content"}},a.extend(a.easing,{easeInOutQuint:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b*b*b*b+c:d/2*((b-=2)*b*b*b*b+2)+c}})}(jQuery,window,document);