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

11 lines
13 KiB
JavaScript
Raw Normal View History

2022-01-13 13:00:31 +00:00
/*
2022-06-16 11:46:53 +00:00
* # Fomantic UI - 2.9.0-beta.294+786baef
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(O,j,k,I){"use strict";O.isWindow=O.isWindow||function(e){return null!=e&&e===e.window},O.isFunction=O.isFunction||function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},j=void 0!==j&&j.Math==Math?j:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),O.fn.tab=function(c){var l,d=O.isFunction(this)?O(j):O(this),u=d.selector||"",g=(new Date).getTime(),P=[],F=c,w="string"==typeof F,S=[].slice.call(arguments,1),E=!1;return d.each(function(){var b,i,f,h,p,v=O.isPlainObject(c)?O.extend(!0,{},O.fn.tab.settings,c):O.extend({},O.fn.tab.settings),m=v.className,y=v.metadata,t=v.selector,T=v.error,a=v.regExp,e="."+v.namespace,n="module-"+v.namespace,L=O(this),o={},x=!0,r=0,A=this,s=L.data(n),C={initialize:function(){C.debug("Initializing tab menu item",L),C.fix.callbacks(),C.determineTabs(),C.debug("Determining tabs",v.context,i),v.auto&&C.set.auto(),C.bind.events(),v.history&&!E&&(C.initializeHistory(),E=!0);var e,t=C.determine.activeTab();v.autoTabActivation&&s===I&&null==t&&(t=!0===v.autoTabActivation?C.get.initialPath():v.autoTabActivation,C.debug("No active tab detected, setting tab active",t),C.changeTab(t)),null!=t&&v.history&&(e=O.address.autoUpdate(),O.address.autoUpdate(!1),O.address.value(t),O.address.autoUpdate(e)),C.instantiate()},instantiate:function(){C.verbose("Storing instance of module",C),s=C,L.data(n,C)},destroy:function(){C.debug("Destroying tabs",L),L.removeData(n).off(e)},bind:{events:function(){O.isWindow(A)||(C.debug("Attaching tab activation events to element",L),L.on("click"+e,C.event.click))}},determineTabs:function(){var e;"parent"===v.context?(0<L.closest(t.ui).length?(e=L.closest(t.ui),C.verbose("Using closest UI element as parent",e)):e=L,b=e.parent(),C.verbose("Determined parent element for creating context",b)):v.context?(b=[j,k].indexOf(v.context)<0?O(k).find(v.context):O(v.context),C.verbose("Using selector for tab context",v.context,b)):b=O("body"),v.childrenOnly?(i=b.children(t.tabs),C.debug("Searching tab context children for tabs",b,i)):(i=b.find(t.tabs),C.debug("Searching tab context for tabs",b,i))},fix:{callbacks:function(){O.isPlainObject(c)&&(c.onTabLoad||c.onTabInit)&&(c.onTabLoad&&(c.onLoad=c.onTabLoad,delete c.onTabLoad,C.error(T.legacyLoad,c.onLoad)),c.onTabInit&&(c.onFirstLoad=c.onTabInit,delete c.onTabInit,C.error(T.legacyInit,c.onFirstLoad)),v=O.extend(!0,{},O.fn.tab.settings,c))}},initializeHistory:function(){if(C.debug("Initializing page state"),O.address===I)return C.error(T.state),!1;if("state"==v.historyType){if(C.debug("Using HTML5 to manage state"),!1===v.path)return C.error(T.path),!1;O.address.history(!0).state(v.path),O(j).trigger("popstate")}O.address.bind("change",C.event.history.change)},event:{click:function(e){var t=O(this).data(y.tab);t!==I?(v.history?(C.verbose("Updating page state",e),O.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=v.templates.determineTitle(t)||!1;C.performance.display(),C.debug("History change event",t,e),p=e,t!==I&&C.changeTab(t),a&&O.address.title(a)}}},refresh:function(){f&&(C.debug("Refreshing tab",f),C.changeTab(f))},cache:{read:function(e){return e!==I&&o[e]},add:function(e,t){e=e||f,C.debug("Adding cached content for",e),o[e]=t},remove:function(e){e=e||f,C.debug("Removing cached content for",e),delete o[e]}},escape:{string:function(e){return(e=String(e)).replace(a.escape,"\\$&")}},set:{auto:function(){var e="string"==typeof v.path?v.path.replace(/\/$/,"")+"/{$tab}":"/{$tab}";C.verbose("Setting up automatic tab retrieval from server",e),O.isPlainObject(v.apiSettings)?v.apiSettings.url=e:v.apiSettings={url:e}},loading:function(e){var t=C.get.tabElement(e);t.hasClass(m.loading)||(C.verbose("Setting loading state for",t),t.addClass(m.loading).siblings(i).removeClass(m.active+" "+m.loading),0<t.length&&v.onRequest.call(t[0],e))},state:function(e){O.address.value(e)}},changeTab:function(l){var d=j.history&&j.history.pushState&&v.ignoreFirstLoad&&x,u=v.auto||