LocalCDN-Firefox-Chrome-Brave/resources/semantic-ui/2.5.0/components/tab.min.jsm

1 line
11 KiB
JavaScript
Raw Normal View History

2022-10-07 06:16:13 +02:00
!function(E,O,w,k){"use strict";O=void 0!==O&&O.Math==Math?O:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),E.fn.tab=function(r){var l,d=E.isFunction(this)?E(O):E(this),u=d.selector||"",b=(new Date).getTime(),g=[],f=r,F="string"==typeof f,S=[].slice.call(arguments,1),j=!1;return d.each(function(){var h,o,p,m,v,y=E.isPlainObject(r)?E.extend(!0,{},E.fn.tab.settings,r):E.extend({},E.fn.tab.settings),T=y.className,L=y.metadata,t=y.selector,x=y.error,e="."+y.namespace,a="module-"+y.namespace,A=E(this),n={},P=!0,i=0,s=this,c=A.data(a),C={initialize:function(){C.debug("Initializing tab menu item",A),C.fix.callbacks(),C.determineTabs(),C.debug("Determining tabs",y.context,o),y.auto&&C.set.auto(),C.bind.events(),y.history&&!j&&(C.initializeHistory(),j=!0),C.instantiate()},instantiate:function(){C.verbose("Storing instance of module",C),c=C,A.data(a,C)},destroy:function(){C.debug("Destroying tabs",A),A.removeData(a).off(e)},bind:{events:function(){E.isWindow(s)||(C.debug("Attaching tab activation events to element",A),A.on("click"+e,C.event.click))}},determineTabs:function(){var e;"parent"===y.context?(0<A.closest(t.ui).length?(e=A.closest(t.ui),C.verbose("Using closest UI element as parent",e)):e=A,h=e.parent(),C.verbose("Determined parent element for creating context",h)):y.context?(h=E(y.context),C.verbose("Using selector for tab context",y.context,h)):h=E("body"),y.childrenOnly?(o=h.children(t.tabs),C.debug("Searching tab context children for tabs",h,o)):(o=h.find(t.tabs),C.debug("Searching tab context for tabs",h,o))},fix:{callbacks:function(){E.isPlainObject(r)&&(r.onTabLoad||r.onTabInit)&&(r.onTabLoad&&(r.onLoad=r.onTabLoad,delete r.onTabLoad,C.error(x.legacyLoad,r.onLoad)),r.onTabInit&&(r.onFirstLoad=r.onTabInit,delete r.onTabInit,C.error(x.legacyInit,r.onFirstLoad)),y=E.extend(!0,{},E.fn.tab.settings,r))}},initializeHistory:function(){if(C.debug("Initializing page state"),E.address===k)return C.error(x.state),!1;if("state"==y.historyType){if(C.debug("Using HTML5 to manage state"),!1===y.path)return C.error(x.path),!1;E.address.history(!0).state(y.path)}E.address.bind("change",C.event.history.change)},event:{click:function(e){var t=E(this).data(L.tab);t!==k?(y.history?(C.verbose("Updating page state",e),E.address.value(t)):(C.verbose("Changing tab",e),C.changeTab(t)),e.preventDefault()):C.debug("No tab specified")},history:{change:function(e){var t=e.pathNames.join("/")||C.get.initialPath(),a=y.templates.determineTitle(t)||!1;C.performance.display(),C.debug("History change event",t,e),v=e,t!==k&&C.changeTab(t),a&&E.address.title(a)}}},refresh:function(){p&&(C.debug("Refreshing tab",p),C.changeTab(p))},cache:{read:function(e){return e!==k&&n[e]},add:function(e,t){e=e||p,C.debug("Adding cached content for",e),n[e]=t},remove:function(e){e=e||p,C.debug("Removing cached content for",e),delete n[e]}},set:{auto:function(){var e="string"==typeof y.path?y.path.replace(/\/$/,"")+"/{$tab}":"/{$tab}";C.verbose("Setting up automatic tab retrieval from server",e),E.isPlainObject(y.apiSettings)?y.apiSettings.url=e:y.apiSettings={url:e}},loading:function(e){var t=C.get.tabElement(e);t.hasClass(T.loading)||(C.verbose("Setting loading state for",t),t.addClass(T.loading).siblings(o).removeClass(T.active+" "+T.loading),0<t.length&&y.onRequest.call(t[0],e))},state:function(e){E.address.value(e)}},changeTab:function(u){var b=O.history&&O.history.pushState&&y.ignoreFirstLoad&&P,g=y.auto||E.isPlainObject(y.apiSettings),f=g&&!b?C.utilities.pathToArray(u):C.get.defaultPathArray(u);u=C.utilities.arrayToPath(f),E.each(f,function(e,t){var a,n,i,o,r=f.slice(0,e+1),s=C.utilities.arrayToPath(r),c=C.is.tab(s),l=e+1==f.length,d=C.get.tabElement(s);if(C.verbose("Looking for tab",t),c){if(C.verbose("Tab was found",t),p=s,m=C.utilities.filterArray(f,r),l?o=!0:(n=f.slice(0,e+2),i=C.utilities.arrayToPath(n),(o=!C.is.tab(i))&&C.verbose("Tab parameters found",n)),o&&g)return b?(C.debug("Ignoring remote content on first tab load",s),P=!1,C.cache.add(u,d.html()),C.activate.all(s),y.onFirstLoad.call(d[0],s,m,v),y.onLoad.call(d[0],s,m,v)):(