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.
 
 
 

11 lines
6.4 KiB

/*
* # Semantic UI - 1.6.4
* https://github.com/Semantic-Org/Semantic-UI
* http://www.semantic-ui.com/
*
* Copyright 2014 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
!function(e,n,t,i){"use strict";e.fn.accordion=function(t){{var o,s=e(this),a=(new Date).getTime(),r=[],c=arguments[0],l="string"==typeof c,u=[].slice.call(arguments,1);n.requestAnimationFrame||n.mozRequestAnimationFrame||n.webkitRequestAnimationFrame||n.msRequestAnimationFrame||function(e){setTimeout(e,0)}}return s.each(function(){var d,p,f=e.isPlainObject(t)?e.extend(!0,{},e.fn.accordion.settings,t):e.extend({},e.fn.accordion.settings),m=f.className,g=f.namespace,b=f.selector,h=f.error,v="."+g,y="module-"+g,x=s.selector||"",C=e(this),O=C.find(b.title),F=C.find(b.content),T=this,A=C.data(y);p={initialize:function(){p.debug("Initializing accordion with bound events",C),C.on("click"+v,b.title,p.event.click),p.observeChanges(),p.instantiate()},instantiate:function(){A=p,C.data(y,p)},destroy:function(){p.debug("Destroying previous accordion for",C),C.removeData(y),O.off(v)},refresh:function(){O=C.find(b.title),F=C.find(b.content)},observeChanges:function(){"MutationObserver"in n&&(d=new MutationObserver(function(){p.debug("DOM tree modified, updating selector cache"),p.refresh()}),d.observe(T,{childList:!0,subtree:!0}),p.debug("Setting up mutation observer",d))},event:{click:function(){e.proxy(p.toggle,this)()}},toggle:function(n){var t=n!==i?"number"==typeof n?O.eq(n):e(n):e(this),o=t.next(F),s=o.is(":visible");p.debug("Toggling visibility of content",t),s?f.collapsible?e.proxy(p.close,t)():p.debug("Cannot close accordion content collapsing is disabled"):e.proxy(p.open,t)()},open:function(n){var t=n!==i?"number"==typeof n?O.eq(n):e(n):e(this),o=t.next(F),s=o.is(":animated"),a=o.hasClass(m.active);s||a||(p.debug("Opening accordion content",t),f.exclusive&&e.proxy(p.closeOthers,t)(),t.addClass(m.active),f.animateChildren&&(e.fn.transition!==i&&C.transition("is supported")?o.children().transition({animation:"fade in",useFailSafe:!0,debug:f.debug,verbose:f.verbose,duration:f.duration}):o.children().stop().animate({opacity:1},f.duration,p.resetOpacity)),o.stop().slideDown(f.duration,f.easing,function(){o.addClass(m.active),e.proxy(p.reset.display,this)(),e.proxy(f.onOpen,this)(),e.proxy(f.onChange,this)()}))},close:function(n){var t=n!==i?"number"==typeof n?O.eq(n):e(n):e(this),o=t.next(F),s=o.hasClass(m.active);s&&(p.debug("Closing accordion content",o),t.removeClass(m.active),o.removeClass(m.active).show(),f.animateChildren&&(e.fn.transition!==i&&C.transition("is supported")?o.children().transition({animation:"fade out",useFailSafe:!0,debug:f.debug,verbose:f.verbose,duration:f.duration}):o.children().stop().animate({opacity:0},f.duration,p.resetOpacity)),o.stop().slideUp(f.duration,f.easing,function(){e.proxy(p.reset.display,this)(),e.proxy(f.onClose,this)(),e.proxy(f.onChange,this)()}))},closeOthers:function(n){var t,o,s,a=n!==i?O.eq(n):e(this),r=a.parents(b.content).prev(b.title),c=a.closest(b.accordion),l=b.title+"."+m.active+":visible",u=b.content+"."+m.active+":visible";f.closeNested?(t=c.find(l).not(r),s=t.next(F)):(t=c.find(l).not(r),o=c.find(u).find(l).not(r),t=t.not(o),s=t.next(F)),t.size()>0&&(p.debug("Exclusive enabled, closing other content",t),t.removeClass(m.active),f.animateChildren&&(e.fn.transition!==i&&C.transition("is supported")?s.children().transition({animation:"fade out",useFailSafe:!0,debug:f.debug,verbose:f.verbose,duration:f.duration}):s.children().stop().animate({opacity:0},f.duration,p.resetOpacity)),s.stop().slideUp(f.duration,f.easing,function(){e(this).removeClass(m.active),e.proxy(p.reset.display,this)()}))},reset:{display:function(){p.verbose("Removing inline display from element",this),e(this).css("display",""),""===e(this).attr("style")&&e(this).attr("style","").removeAttr("style")},opacity:function(){p.verbose("Removing inline opacity from element",this),e(this).css("opacity",""),""===e(this).attr("style")&&e(this).attr("style","").removeAttr("style")}},setting:function(n,t){if(p.debug("Changing setting",n,t),e.isPlainObject(n))e.extend(!0,f,n);else{if(t===i)return f[n];f[n]=t}},internal:function(n,t){return p.debug("Changing internal",n,t),t===i?p[n]:void(e.isPlainObject(n)?e.extend(!0,p,n):p[n]=t)},debug:function(){f.debug&&(f.performance?p.performance.log(arguments):(p.debug=Function.prototype.bind.call(console.info,console,f.name+":"),p.debug.apply(console,arguments)))},verbose:function(){f.verbose&&f.debug&&(f.performance?p.performance.log(arguments):(p.verbose=Function.prototype.bind.call(console.info,console,f.name+":"),p.verbose.apply(console,arguments)))},error:function(){p.error=Function.prototype.bind.call(console.error,console,f.name+":"),p.error.apply(console,arguments)},performance:{log:function(e){var n,t,i;f.performance&&(n=(new Date).getTime(),i=a||n,t=n-i,a=n,r.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:T,"Execution Time":t})),clearTimeout(p.performance.timer),p.performance.timer=setTimeout(p.performance.display,100)},display:function(){var n=f.name+":",t=0;a=!1,clearTimeout(p.performance.timer),e.each(r,function(e,n){t+=n["Execution Time"]}),n+=" "+t+"ms",x&&(n+=" '"+x+"'"),(console.group!==i||console.table!==i)&&r.length>0&&(console.groupCollapsed(n),console.table?console.table(r):e.each(r,function(e,n){console.log(n.Name+": "+n["Execution Time"]+"ms")}),console.groupEnd()),r=[]}},invoke:function(n,t,s){var a,r,c,l=A;return t=t||u,s=T||s,"string"==typeof n&&l!==i&&(n=n.split(/[\. ]/),a=n.length-1,e.each(n,function(t,o){var s=t!=a?o+n[t+1].charAt(0).toUpperCase()+n[t+1].slice(1):n;if(e.isPlainObject(l[s])&&t!=a)l=l[s];else{if(l[s]!==i)return r=l[s],!1;if(!e.isPlainObject(l[o])||t==a)return l[o]!==i?(r=l[o],!1):(p.error(h.method,n),!1);l=l[o]}})),e.isFunction(r)?c=r.apply(s,t):r!==i&&(c=r),e.isArray(o)?o.push(c):o!==i?o=[o,c]:c!==i&&(o=c),r}},l?(A===i&&p.initialize(),p.invoke(c)):(A!==i&&p.destroy(),p.initialize())}),o!==i?o:this},e.fn.accordion.settings={name:"Accordion",namespace:"accordion",debug:!1,verbose:!0,performance:!0,exclusive:!0,collapsible:!0,closeNested:!1,animateChildren:!0,duration:500,easing:"easeOutQuint",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"}},e.extend(e.easing,{easeOutQuint:function(e,n,t,i,o){return i*((n=n/o-1)*n*n*n*n+1)+t}})}(jQuery,window,document);