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.

10 lines
6.3 KiB

10 years ago
10 years ago
10 years ago
10 years ago
  1. /*
  2. * # Semantic UI - 1.7.2
  3. * https://github.com/Semantic-Org/Semantic-UI
  4. * http://www.semantic-ui.com/
  5. *
  6. * Copyright 2014 Contributors
  7. * Released under the MIT license
  8. * http://opensource.org/licenses/MIT
  9. *
  10. */
  11. !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.