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