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