11 lines
7.3 KiB
JavaScript
11 lines
7.3 KiB
JavaScript
|
/*
|
||
|
* # Fomantic UI - 2.8.8
|
||
|
* https://github.com/fomantic/Fomantic-UI
|
||
|
* http://fomantic-ui.com/
|
||
|
*
|
||
|
* Copyright 2022 Contributors
|
||
|
* Released under the MIT license
|
||
|
* http://opensource.org/licenses/MIT
|
||
|
*
|
||
|
*/
|
||
|
!function(T,k,F){"use strict";T.isFunction=T.isFunction||function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},k=void 0!==k&&k.Math==Math?k:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),T.fn.accordion=function(s){var h,v=T(this),b=(new Date).getTime(),y=[],C=s,O="string"==typeof C,x=[].slice.call(arguments,1);return v.each(function(){var e,a=T.isPlainObject(s)?T.extend(!0,{},T.fn.accordion.settings,s):T.extend({},T.fn.accordion.settings),l=a.className,n=a.namespace,c=a.selector,r=a.error,t="."+n,i="module-"+n,o=v.selector||"",d=T(this),u=d.find(c.title),g=d.find(c.content),f=this,p=d.data(i),m={initialize:function(){m.debug("Initializing",d),m.bind.events(),a.observeChanges&&m.observeChanges(),m.instantiate()},instantiate:function(){p=m,d.data(i,m)},destroy:function(){m.debug("Destroying previous instance",d),d.off(t).removeData(i)},refresh:function(){u=d.find(c.title),g=d.find(c.content)},observeChanges:function(){"MutationObserver"in k&&((e=new MutationObserver(function(e){m.debug("DOM tree modified, updating selector cache"),m.refresh()})).observe(f,{childList:!0,subtree:!0}),m.debug("Setting up mutation observer",e))},bind:{events:function(){m.debug("Binding delegated events"),d.on(a.on+t,c.trigger,m.event.click)}},event:{click:function(){m.toggle.call(this)}},toggle:function(e){var n=e!==F?"number"==typeof e?u.eq(e):T(e).closest(c.title):T(this).closest(c.title),t=n.next(g),i=t.hasClass(l.animating),e=t.hasClass(l.active),t=e&&!i,i=!e&&i;m.debug("Toggling visibility of content",n),t||i?a.collapsible?m.close.call(n):m.debug("Cannot close accordion content collapsing is disabled"):m.open.call(n)},open:function(e){var n=e!==F?"number"==typeof e?u.eq(e):T(e).closest(c.title):T(this).closest(c.title),t=n.next(g),e=t.hasClass(l.animating);t.hasClass(l.active)||e?m.debug("Accordion already open, skipping",t):(m.debug("Opening accordion content",n),a.onOpening.call(t),a.onChanging.call(t),a.exclusive&&m.closeOthers.call(n),n.addClass(l.active),t.stop(!0,!0).addClass(l.animating),a.animateChildren&&(T.fn.transition!==F&&d.transition("is supported")?t.children().transition({animation:"fade in",queue:!1,useFailSafe:!0,debug:a.debug,verbose:a.verbose,duration:a.duration,skipInlineHidden:!0,onComplete:function(){t.children().removeClass(l.transition)}}):t.children().stop(!0,!0).animate({opacity:1},a.duration,m.resetOpacity)),t.slideDown(a.duration,a.easing,function(){t.removeClass(l.animating).addClass(l.active),m.reset.display.call(this),a.onOpen.call(this),a.onChange.call(this)}))},close:function(e){var n=e!==F?"number"==typeof e?u.eq(e):T(e).closest(c.title):T(this).closest(c.title),t=n.next(g),i=t.hasClass(l.animating),e=t.hasClass(l.active);!e&&!(!e&&i)||e&&i||(m.debug("Closing accordion content",t),a.onClosing.call(t),a.onChanging.call(t),n.removeClass(l.active),t.stop(!0,!0).addClass(l.animating),a.animateChildren&&(T.fn.transition!==F&&d.transition("is supported")?t.children().transition({animation:"fade out",queue:!1,useFailSafe:!0,debug:a.debug,verbose:a.verbose,duration:a.duration,skipInlineHidden:!0}):t.children().stop(!0,!0).animate({opacity:0},a.duration,m.resetOpacity)),t.slideUp(a.duration,a.easing,function(){t.removeClass(l.animating).removeClass(l.active),m.reset.display.call(this),a.onClose.call(this),a.onChange.call(this)}))},closeOthers:function(e){var n,t=e!==F?u.eq(e):T(this).closest(c.title),i=t.parents(c.content).prev(c.title),o=t.closest(c.accordion),e=c.title+"."+l.active+":visible",t=c.content+"."+l.active+":visible",s=a.closeNested?(n=o.find(e).not(i)).next(g):(n=o.find(e).not(i),s=o.find(t).find(e).not(i),(n=n.not(s)).next(g));0<n.length&&(m.debug("Exclusive enabled, closing other content",n),n.removeClass(l.active),s.removeClass(l.animating).stop(!0,!0),a.animateChildren&&(T.fn.transition!==F&&d.transition("is supported")?s.children().transition({animation:"fade out",useFailSafe:!0,debug:a.debug,verbose:a.verbose,duration:a.duration,skipInlineHidden:!0}):s.children().stop(!0,!0).animate({opacity:0},a.duration,m.resetOpacity)),s.slideUp(a.duration,a.easing,
|