wishthis/node_modules/fomantic-ui/dist/components/accordion.min.js
2022-01-13 14:00:31 +01:00

11 lines
No EOL
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.easing,function(){T(this).removeClass(u.active),r.reset.display.call(this)}))},reset:{display:function(){r.verbose("Removing inline display from element",this),T(this).css("display",""),""===T(this).attr("style")&&T(this).attr("style","").removeAttr("style")},opacity:function(){r.verbose("Removing inline opacity from element",this),T(this).css("opacity",""),""===T(this).attr("style")&&T(this).attr("style","").removeAttr("style")}},setting:function(e,n){if(r.debug("Changing setting",e,n),T.isPlainObject(e))T.extend(!0,d,e);else{if(n===F)return d[e];T.isPlainObject(d[e])?T.extend(!0,d[e],n):d[e]=n}},internal:function(e,n){if(r.debug("Changing internal",e,n),n===F)return r[e];T.isPlainObject(e)?T.extend(!0,r,e):r[e]=n},debug:function(){!d.silent&&d.debug&&(d.performance?r.performance.log(arguments):(r.debug=Function.prototype.bind.call(console.info,console,d.name+":"),r.debug.apply(console,arguments)))},verbose:function(){!d.silent&&d.verbose&&d.debug&&(d.performance?r.performance.log(arguments):(r.verbose=Function.prototype.bind.call(console.info,console,d.name+":"),r.verbose.apply(console,arguments)))},error:function(){d.silent||(r.error=Function.prototype.bind.call(console.error,console,d.name+":"),r.error.apply(console,arguments))},performance:{log:function(e){var n,t;d.performance&&(t=(n=(new Date).getTime())-(b||n),b=n,y.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:c,"Execution Time":t})),clearTimeout(r.performance.timer),r.performance.timer=setTimeout(r.performance.display,500)},display:function(){var e=d.name+":",t=0;b=!1,clearTimeout(r.performance.timer),T.each(y,function(e,n){t+=n["Execution Time"]}),e+=" "+t+"ms",o&&(e+=" '"+o+"'"),(console.group!==F||console.table!==F)&&0<y.length&&(console.groupCollapsed(e),console.table?console.table(y):T.each(y,function(e,n){console.log(n.Name+": "+n["Execution Time"]+"ms")}),console.groupEnd()),y=[]}},invoke:function(i,e,n){var o,s,t,a=h;return e=e||x,n=c||n,"string"==typeof i&&a!==F&&(i=i.split(/[\. ]/),o=i.length-1,T.each(i,function(e,n){var t=e!=o?n+i[e+1].charAt(0).toUpperCase()+i[e+1].slice(1):i;if(T.isPlainObject(a[t])&&e!=o)a=a[t];else{if(a[t]!==F)return s=a[t],!1;if(!T.isPlainObject(a[n])||e==o)return a[n]!==F?s=a[n]:r.error(l.method,i),!1;a=a[n]}})),T.isFunction(s)?t=s.apply(n,e):s!==F&&(t=s),Array.isArray(v)?v.push(t):v!==F?v=[v,t]:t!==F&&(v=t),s}},O?(h===F&&r.initialize(),r.invoke(C)):(h!==F&&h.invoke("destroy"),r.initialize())}),v!==F?v:this},T.fn.accordion.settings={name:"Accordion",namespace:"accordion",silent:!1,debug:!1,verbose:!1,performance:!0,on:"click",observeChanges:!0,exclusive:!0,collapsible:!0,closeNested:!1,animateChildren:!0,duration:350,easing:"easeOutQuad",onOpening:function(){},onClosing:function(){},onChanging:function(){},onOpen:function(){},onClose:function(){},onChange:function(){},error:{method:"The method you called is not defined"},className:{active:"active",animating:"animating",transition:"transition"},selector:{accordion:".accordion",title:".title",trigger:".title",content:".content"}},T.extend(T.easing,{easeOutQuad:function(e,n,t,i,o){return-i*(n/=o)*(n-2)+t}})}(jQuery,window,document);