|
|
!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,m=a.isPlainObject(c)?a.extend(!0,{},a.fn.accordion.settings,c):a.extend({},a.fn.accordion.settings),n=m.className,o=m.namespace,p=m.selector,q=(m.error,"."+o),r="module-"+o,s=f.selector||"",t=a(this),u=t.find(p.title),v=t.find(p.content),w=this,x=t.data(r);l={initialize:function(){l.debug("Initializing accordion with bound events",t),t.on("click"+q,p.title,l.event.click),l.observeChanges(),l.instantiate()},instantiate:function(){x=l,t.data(r,l)},destroy:function(){l.debug("Destroying previous accordion for",t),t.removeData(r),u.off(q)},refresh:function(){u=t.find(p.title),v=t.find(p.content)},observeChanges:function(){MutationObserver!==d&&(b=new MutationObserver(function(){l.debug("DOM tree modified, updating selector cache"),l.refresh()}),b.observe(w,{childList:!0,subtree:!0}),l.debug("Setting up mutation observer",b))},event:{click:function(){a.proxy(l.toggle,this)()}},toggle:function(b){var c=b!==d?"number"==typeof b?u.eq(b):a(b):a(this),e=c.next(v),f=e.is(":visible");l.debug("Toggling visibility of content",c),f?m.collapsible?a.proxy(l.close,c)():l.debug("Cannot close accordion content collapsing is disabled"):a.proxy(l.open,c)()},open:function(b){var c=b!==d?"number"==typeof b?u.eq(b):a(b):a(this),e=c.next(v),f=e.is(":animated"),g=e.hasClass(n.active);f||g||(l.debug("Opening accordion content",c),m.exclusive&&a.proxy(l.closeOthers,c)(),c.addClass(n.active),e.stop().children().stop().animate({opacity:1},m.duration,l.reset.display).end().slideDown(m.duration,m.easing,function(){e.addClass(n.active),a.proxy(l.reset.display,this)(),a.proxy(m.onOpen,this)(),a.proxy(m.onChange,this)()}))},close:function(b){var c=b!==d?"number"==typeof b?u.eq(b):a(b):a(this),e=c.next(v),f=e.hasClass(n.active);f&&(l.debug("Closing accordion content",e),c.removeClass(n.active),e.removeClass(n.active).show().stop().children().stop().animate({opacity:0},m.duration,l.reset.opacity).end().slideUp(m.duration,m.easing,function(){a.proxy(l.reset.display,this)(),a.proxy(m.onClose,this)(),a.proxy(m.onChange,this)()}))},closeOthers:function(b){var c,e,f,g=b!==d?u.eq(b):a(this),h=g.parents(p.content).prev(p.title),i=g.closest(p.accordion),j=p.title+"."+n.active+":visible",k=p.content+"."+n.active+":visible";m.closeNested?(c=i.find(j).not(h),f=c.next(v)):(c=i.find(j).not(h),e=i.find(k).find(j).not(h),c=c.not(e),f=c.next(v)),c.size()>0&&(l.debug("Exclusive enabled, closing other content",c),c.removeClass(n.active),f.stop().children().stop().animate({opacity:0},m.duration,l.resetOpacity).end().slideUp(m.duration,m.easing,function(){a(this).removeClass(n.active),a.proxy(l.reset.display,this)()}))},reset:{display:function(){l.verbose("Removing inline display from element",this),a(this).css("display",""),""===a(this).attr("style")&&a(this).attr("style","").removeAttr("style")},opacity:function(){l.verbose("Removing inline opacity from element",this),a(this).css("opacity",""),""===a(this).attr("style")&&a(this).attr("style","").removeAttr("style")}},setting:function(b,c){if(l.debug("Changing setting",b,c),a.isPlainObject(b))a.extend(!0,m,b);else{if(c===d)return m[b];m[b]=c}},internal:function(b,c){return l.debug("Changing internal",b,c),c===d?l[b]:void(a.isPlainObject(b)?a.extend(!0,l,b):l[b]=c)},debug:function(){m.debug&&(m.performance?l.performance.log(arguments):(l.debug=Function.prototype.bind.call(console.info,console,m.name+":"),l.debug.apply(console,arguments)))},verbose:function(){m.verbose&&m.debug&&(m.performance?l.performance.log(arguments):(l.verbose=Function.prototype.bind.call(console.info,console,m.name+":"),l.verbose.apply(console,arguments)))},error:function(){l.error=Function.prototype.bind.call(console.error,console,m.name+":"),l.error.apply(console,arguments)},performance:{log:function(a){var b,c,d;m.p
|