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