You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ORPA-pyOpenRPA/3rdParty/Semantic-UI-CSS-master/components/tab.min.js

1 line
11 KiB

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