wishthis/node_modules/fomantic-ui/dist/components/accordion.min.js

11 lines
7.4 KiB
JavaScript
Raw Normal View History

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