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.

804 lines
26 KiB

9 years ago
10 years ago
9 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
9 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
9 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
9 years ago
10 years ago
10 years ago
9 years ago
10 years ago
9 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. /*!
  2. * # Semantic UI 1.11.4 - Tab
  3. * http://github.com/semantic-org/semantic-ui/
  4. *
  5. *
  6. * Copyright 2014 Contributorss
  7. * Released under the MIT license
  8. * http://opensource.org/licenses/MIT
  9. *
  10. */
  11. ;(function ($, window, document, undefined) {
  12. "use strict";
  13. $.fn.tab = function(parameters) {
  14. var
  15. // use window context if none specified
  16. $allModules = $.isFunction(this)
  17. ? $(window)
  18. : $(this),
  19. settings = ( $.isPlainObject(parameters) )
  20. ? $.extend(true, {}, $.fn.tab.settings, parameters)
  21. : $.extend({}, $.fn.tab.settings),
  22. moduleSelector = $allModules.selector || '',
  23. time = new Date().getTime(),
  24. performance = [],
  25. query = arguments[0],
  26. methodInvoked = (typeof query == 'string'),
  27. queryArguments = [].slice.call(arguments, 1),
  28. module,
  29. returnedValue
  30. ;
  31. $allModules
  32. .each(function() {
  33. var
  34. className = settings.className,
  35. metadata = settings.metadata,
  36. selector = settings.selector,
  37. error = settings.error,
  38. eventNamespace = '.' + settings.namespace,
  39. moduleNamespace = 'module-' + settings.namespace,
  40. $module = $(this),
  41. cache = {},
  42. firstLoad = true,
  43. recursionDepth = 0,
  44. $context,
  45. $tabs,
  46. activeTabPath,
  47. parameterArray,
  48. historyEvent,
  49. element = this,
  50. instance = $module.data(moduleNamespace)
  51. ;
  52. module = {
  53. initialize: function() {
  54. module.debug('Initializing tab menu item', $module);
  55. module.determineTabs();
  56. module.debug('Determining tabs', settings.context, $tabs);
  57. // set up automatic routing
  58. if(settings.auto) {
  59. module.set.auto();
  60. }
  61. // attach events if navigation wasn't set to window
  62. if( !$.isWindow( element ) ) {
  63. module.debug('Attaching tab activation events to element', $module);
  64. $module
  65. .on('click' + eventNamespace, module.event.click)
  66. ;
  67. }
  68. module.instantiate();
  69. },
  70. determineTabs: function() {
  71. var
  72. $reference
  73. ;
  74. // determine tab context
  75. if(settings.context === 'parent') {
  76. if($module.closest(selector.ui).length > 0) {
  77. $reference = $module.closest(selector.ui);
  78. module.verbose('Using closest UI element for determining parent', $reference);
  79. }
  80. else {
  81. $reference = $module;
  82. }
  83. $context = $reference.parent();
  84. module.verbose('Determined parent element for creating context', $context);
  85. }
  86. else if(settings.context) {
  87. $context = $(settings.context);
  88. module.verbose('Using selector for tab context', settings.context, $context);
  89. }
  90. else {
  91. $context = $('body');
  92. }
  93. // find tabs
  94. if(settings.childrenOnly) {
  95. $tabs = $context.children(selector.tabs);
  96. module.debug('Searching tab context children for tabs', $context, $tabs);
  97. }
  98. else {
  99. $tabs = $context.find(selector.tabs);
  100. module.debug('Searching tab context for tabs', $context, $tabs);
  101. }
  102. },
  103. initializeHistory: function() {
  104. if(settings.history) {
  105. module.debug('Initializing page state');
  106. if( $.address === undefined ) {
  107. module.error(error.state);
  108. return false;
  109. }
  110. else {
  111. if(settings.historyType == 'state') {
  112. module.debug('Using HTML5 to manage state');
  113. if(settings.path !== false) {
  114. $.address
  115. .history(true)
  116. .state(settings.path)
  117. ;
  118. }
  119. else {
  120. module.error(error.path);
  121. return false;
  122. }
  123. }
  124. $.address
  125. .bind('change', module.event.history.change)
  126. ;
  127. }
  128. }
  129. },
  130. instantiate: function () {
  131. module.verbose('Storing instance of module', module);
  132. instance = module;
  133. $module
  134. .data(moduleNamespace, module)
  135. ;
  136. },
  137. destroy: function() {
  138. module.debug('Destroying tabs', $module);
  139. $module
  140. .removeData(moduleNamespace)
  141. .off(eventNamespace)
  142. ;
  143. },
  144. event: {
  145. click: function(event) {
  146. var
  147. tabPath = $(this).data(metadata.tab)
  148. ;
  149. if(tabPath !== undefined) {
  150. if(settings.history) {
  151. module.verbose('Updating page state', event);
  152. $.address.value(tabPath);
  153. }
  154. else {
  155. module.verbose('Changing tab', event);
  156. module.changeTab(tabPath);
  157. }
  158. event.preventDefault();
  159. }
  160. else {
  161. module.debug('No tab specified');
  162. }
  163. },
  164. history: {
  165. change: function(event) {
  166. var
  167. tabPath = event.pathNames.join('/') || module.get.initialPath(),
  168. pageTitle = settings.templates.determineTitle(tabPath) || false
  169. ;
  170. module.performance.display();
  171. module.debug('History change event', tabPath, event);
  172. historyEvent = event;
  173. if(tabPath !== undefined) {
  174. module.changeTab(tabPath);
  175. }
  176. if(pageTitle) {
  177. $.address.title(pageTitle);
  178. }
  179. }
  180. }
  181. },
  182. refresh: function() {
  183. if(activeTabPath) {
  184. module.debug('Refreshing tab', activeTabPath);
  185. module.changeTab(activeTabPath);
  186. }
  187. },
  188. cache: {
  189. read: function(cacheKey) {
  190. return (cacheKey !== undefined)
  191. ? cache[cacheKey]
  192. : false
  193. ;
  194. },
  195. add: function(cacheKey, content) {
  196. cacheKey = cacheKey || activeTabPath;
  197. module.debug('Adding cached content for', cacheKey);
  198. cache[cacheKey] = content;
  199. },
  200. remove: function(cacheKey) {
  201. cacheKey = cacheKey || activeTabPath;
  202. module.debug('Removing cached content for', cacheKey);
  203. delete cache[cacheKey];
  204. }
  205. },
  206. set: {
  207. auto: function() {
  208. var
  209. url = (typeof settings.path == 'string')
  210. ? settings.path.replace(/\/$/, '') + '/{$tab}'
  211. : '/{$tab}'
  212. ;
  213. module.verbose('Setting up automatic tab retrieval from server', url);
  214. if($.isPlainObject(settings.apiSettings)) {
  215. settings.apiSettings.url = url;
  216. }
  217. else {
  218. settings.apiSettings = {
  219. url: url
  220. };
  221. }
  222. },
  223. state: function(state) {
  224. $.address.value(state);
  225. }
  226. },
  227. changeTab: function(tabPath) {
  228. var
  229. tabPath = (typeof tabPath == 'string')
  230. ? tabPath.toLowerCase()
  231. : tabPath,
  232. pushStateAvailable = (window.history && window.history.pushState),
  233. shouldIgnoreLoad = (pushStateAvailable && settings.ignoreFirstLoad && firstLoad),
  234. remoteContent = (settings.auto || $.isPlainObject(settings.apiSettings) ),
  235. // only get default path if not remote content
  236. pathArray = (remoteContent && !shouldIgnoreLoad)
  237. ? module.utilities.pathToArray(tabPath)
  238. : module.get.defaultPathArray(tabPath)
  239. ;
  240. tabPath = module.utilities.arrayToPath(pathArray);
  241. $.each(pathArray, function(index, tab) {
  242. var
  243. currentPathArray = pathArray.slice(0, index + 1),
  244. currentPath = module.utilities.arrayToPath(currentPathArray),
  245. isTab = module.is.tab(currentPath),
  246. isLastIndex = (index + 1 == pathArray.length),
  247. $tab = module.get.tabElement(currentPath),
  248. $anchor,
  249. nextPathArray,
  250. nextPath,
  251. isLastTab
  252. ;
  253. module.verbose('Looking for tab', tab);
  254. if(isTab) {
  255. module.verbose('Tab was found', tab);
  256. // scope up
  257. activeTabPath = currentPath;
  258. parameterArray = module.utilities.filterArray(pathArray, currentPathArray);
  259. if(isLastIndex) {
  260. isLastTab = true;
  261. }
  262. else {
  263. nextPathArray = pathArray.slice(0, index + 2);
  264. nextPath = module.utilities.arrayToPath(nextPathArray);
  265. isLastTab = ( !module.is.tab(nextPath) );
  266. if(isLastTab) {
  267. module.verbose('Tab parameters found', nextPathArray);
  268. }
  269. }
  270. if(isLastTab && remoteContent) {
  271. if(!shouldIgnoreLoad) {
  272. module.activate.navigation(currentPath);
  273. module.content.fetch(currentPath, tabPath);
  274. }
  275. else {
  276. module.debug('Ignoring remote content on first tab load', currentPath);
  277. firstLoad = false;
  278. module.cache.add(tabPath, $tab.html());
  279. module.activate.all(currentPath);
  280. settings.onTabInit.call($tab, currentPath, parameterArray, historyEvent);
  281. settings.onTabLoad.call($tab, currentPath, parameterArray, historyEvent);
  282. }
  283. return false;
  284. }
  285. else {
  286. module.debug('Opened local tab', currentPath);
  287. module.activate.all(currentPath);
  288. if( !module.cache.read(currentPath) ) {
  289. module.cache.add(currentPath, true);
  290. module.debug('First time tab loaded calling tab init');
  291. settings.onTabInit.call($tab, currentPath, parameterArray, historyEvent);
  292. }
  293. settings.onTabLoad.call($tab, currentPath, parameterArray, historyEvent);
  294. }
  295. }
  296. else if(tabPath.search('/') == -1 && tabPath !== '') {
  297. // look for in page anchor
  298. $anchor = $('#' + tabPath + ', a[name="' + tabPath + '"]'),
  299. currentPath = $anchor.closest('[data-tab]').data('tab');
  300. $tab = module.get.tabElement(currentPath);
  301. // if anchor exists use parent tab
  302. if($anchor && $anchor.length > 0 && currentPath) {
  303. module.debug('No tab found, but deep anchor link present, opening parent tab');
  304. module.activate.all(currentPath);
  305. if( !module.cache.read(currentPath) ) {
  306. module.cache.add(currentPath, true);
  307. module.debug('First time tab loaded calling tab init');
  308. settings.onTabInit.call($tab, currentPath, parameterArray, historyEvent);
  309. }
  310. return false;
  311. }
  312. }
  313. else {
  314. module.error(error.missingTab, $module, $context, currentPath);
  315. return false;
  316. }
  317. });
  318. },
  319. content: {
  320. fetch: function(tabPath, fullTabPath) {
  321. var
  322. $tab = module.get.tabElement(tabPath),
  323. apiSettings = {
  324. dataType : 'html',
  325. on : 'now',
  326. onSuccess : function(response) {
  327. module.cache.add(fullTabPath, response);
  328. module.content.update(tabPath, response);
  329. if(tabPath == activeTabPath) {
  330. module.debug('Content loaded', tabPath);
  331. module.activate.tab(tabPath);
  332. }
  333. else {
  334. module.debug('Content loaded in background', tabPath);
  335. }
  336. settings.onTabInit.call($tab, tabPath, parameterArray, historyEvent);
  337. settings.onTabLoad.call($tab, tabPath, parameterArray, historyEvent);
  338. },
  339. urlData: { tab: fullTabPath }
  340. },
  341. request = $tab.api('get request') || false,
  342. existingRequest = ( request && request.state() === 'pending' ),
  343. requestSettings,
  344. cachedContent
  345. ;
  346. fullTabPath = fullTabPath || tabPath;
  347. cachedContent = module.cache.read(fullTabPath);
  348. module.activate.tab(tabPath);
  349. if(settings.cache && cachedContent) {
  350. module.debug('Showing existing content', fullTabPath);
  351. module.content.update(tabPath, cachedContent);
  352. settings.onTabLoad.call($tab, tabPath, parameterArray, historyEvent);
  353. }
  354. else if(existingRequest) {
  355. module.debug('Content is already loading', fullTabPath);
  356. $tab.addClass(className.loading);
  357. }
  358. else if($.api !== undefined) {
  359. requestSettings = $.extend(true, {
  360. headers: { 'X-Remote': true }
  361. }, settings.apiSettings, apiSettings);
  362. module.debug('Retrieving remote content', fullTabPath, requestSettings);
  363. $tab.api( requestSettings );
  364. }
  365. else {
  366. module.error(error.api);
  367. }
  368. },
  369. update: function(tabPath, html) {
  370. module.debug('Updating html for', tabPath);
  371. var
  372. $tab = module.get.tabElement(tabPath)
  373. ;
  374. $tab
  375. .html(html)
  376. ;
  377. }
  378. },
  379. activate: {
  380. all: function(tabPath) {
  381. module.activate.tab(tabPath);
  382. module.activate.navigation(tabPath);
  383. },
  384. tab: function(tabPath) {
  385. var
  386. $tab = module.get.tabElement(tabPath)
  387. ;
  388. module.verbose('Showing tab content for', $tab);
  389. $tab
  390. .addClass(className.active)
  391. .siblings($tabs)
  392. .removeClass(className.active + ' ' + className.loading)
  393. ;
  394. },
  395. navigation: function(tabPath) {
  396. var
  397. $navigation = module.get.navElement(tabPath)
  398. ;
  399. module.verbose('Activating tab navigation for', $navigation, tabPath);
  400. $navigation
  401. .addClass(className.active)
  402. .siblings($allModules)
  403. .removeClass(className.active + ' ' + className.loading)
  404. ;
  405. }
  406. },
  407. deactivate: {
  408. all: function() {
  409. module.deactivate.navigation();
  410. module.deactivate.tabs();
  411. },
  412. navigation: function() {
  413. $allModules
  414. .removeClass(className.active)
  415. ;
  416. },
  417. tabs: function() {
  418. $tabs
  419. .removeClass(className.active + ' ' + className.loading)
  420. ;
  421. }
  422. },
  423. is: {
  424. tab: function(tabName) {
  425. return (tabName !== undefined)
  426. ? ( module.get.tabElement(tabName).length > 0 )
  427. : false
  428. ;
  429. }
  430. },
  431. get: {
  432. initialPath: function() {
  433. return $allModules.eq(0).data(metadata.tab) || $tabs.eq(0).data(metadata.tab);
  434. },
  435. path: function() {
  436. return $.address.value();
  437. },
  438. // adds default tabs to tab path
  439. defaultPathArray: function(tabPath) {
  440. return module.utilities.pathToArray( module.get.defaultPath(tabPath) );
  441. },
  442. defaultPath: function(tabPath) {
  443. var
  444. $defaultNav = $allModules.filter('[data-' + metadata.tab + '^="' + tabPath + '/"]').eq(0),
  445. defaultTab = $defaultNav.data(metadata.tab) || false
  446. ;
  447. if( defaultTab ) {
  448. module.debug('Found default tab', defaultTab);
  449. if(recursionDepth < settings.maxDepth) {
  450. recursionDepth++;
  451. return module.get.defaultPath(defaultTab);
  452. }
  453. module.error(error.recursion);
  454. }
  455. else {
  456. module.debug('No default tabs found for', tabPath, $tabs);
  457. }
  458. recursionDepth = 0;
  459. return tabPath;
  460. },
  461. navElement: function(tabPath) {
  462. tabPath = tabPath || activeTabPath;
  463. return $allModules.filter('[data-' + metadata.tab + '="' + tabPath + '"]');
  464. },
  465. tabElement: function(tabPath) {
  466. var
  467. $fullPathTab,
  468. $simplePathTab,
  469. tabPathArray,
  470. lastTab
  471. ;
  472. tabPath = tabPath || activeTabPath;
  473. tabPathArray = module.utilities.pathToArray(tabPath);
  474. lastTab = module.utilities.last(tabPathArray);
  475. $fullPathTab = $tabs.filter('[data-' + metadata.tab + '="' + lastTab + '"]');
  476. $simplePathTab = $tabs.filter('[data-' + metadata.tab + '="' + tabPath + '"]');
  477. return ($fullPathTab.length > 0)
  478. ? $fullPathTab
  479. : $simplePathTab
  480. ;
  481. },
  482. tab: function() {
  483. return activeTabPath;
  484. }
  485. },
  486. utilities: {
  487. filterArray: function(keepArray, removeArray) {
  488. return $.grep(keepArray, function(keepValue) {
  489. return ( $.inArray(keepValue, removeArray) == -1);
  490. });
  491. },
  492. last: function(array) {
  493. return $.isArray(array)
  494. ? array[ array.length - 1]
  495. : false
  496. ;
  497. },
  498. pathToArray: function(pathName) {
  499. if(pathName === undefined) {
  500. pathName = activeTabPath;
  501. }
  502. return typeof pathName == 'string'
  503. ? pathName.split('/')
  504. : [pathName]
  505. ;
  506. },
  507. arrayToPath: function(pathArray) {
  508. return $.isArray(pathArray)
  509. ? pathArray.join('/')
  510. : false
  511. ;
  512. }
  513. },
  514. setting: function(name, value) {
  515. module.debug('Changing setting', name, value);
  516. if( $.isPlainObject(name) ) {
  517. $.extend(true, settings, name);
  518. }
  519. else if(value !== undefined) {
  520. settings[name] = value;
  521. }
  522. else {
  523. return settings[name];
  524. }
  525. },
  526. internal: function(name, value) {
  527. if( $.isPlainObject(name) ) {
  528. $.extend(true, module, name);
  529. }
  530. else if(value !== undefined) {
  531. module[name] = value;
  532. }
  533. else {
  534. return module[name];
  535. }
  536. },
  537. debug: function() {
  538. if(settings.debug) {
  539. if(settings.performance) {
  540. module.performance.log(arguments);
  541. }
  542. else {
  543. module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
  544. module.debug.apply(console, arguments);
  545. }
  546. }
  547. },
  548. verbose: function() {
  549. if(settings.verbose && settings.debug) {
  550. if(settings.performance) {
  551. module.performance.log(arguments);
  552. }
  553. else {
  554. module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
  555. module.verbose.apply(console, arguments);
  556. }
  557. }
  558. },
  559. error: function() {
  560. module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
  561. module.error.apply(console, arguments);
  562. },
  563. performance: {
  564. log: function(message) {
  565. var
  566. currentTime,
  567. executionTime,
  568. previousTime
  569. ;
  570. if(settings.performance) {
  571. currentTime = new Date().getTime();
  572. previousTime = time || currentTime;
  573. executionTime = currentTime - previousTime;
  574. time = currentTime;
  575. performance.push({
  576. 'Name' : message[0],
  577. 'Arguments' : [].slice.call(message, 1) || '',
  578. 'Element' : element,
  579. 'Execution Time' : executionTime
  580. });
  581. }
  582. clearTimeout(module.performance.timer);
  583. module.performance.timer = setTimeout(module.performance.display, 500);
  584. },
  585. display: function() {
  586. var
  587. title = settings.name + ':',
  588. totalTime = 0
  589. ;
  590. time = false;
  591. clearTimeout(module.performance.timer);
  592. $.each(performance, function(index, data) {
  593. totalTime += data['Execution Time'];
  594. });
  595. title += ' ' + totalTime + 'ms';
  596. if(moduleSelector) {
  597. title += ' \'' + moduleSelector + '\'';
  598. }
  599. if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
  600. console.groupCollapsed(title);
  601. if(console.table) {
  602. console.table(performance);
  603. }
  604. else {
  605. $.each(performance, function(index, data) {
  606. console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
  607. });
  608. }
  609. console.groupEnd();
  610. }
  611. performance = [];
  612. }
  613. },
  614. invoke: function(query, passedArguments, context) {
  615. var
  616. object = instance,
  617. maxDepth,
  618. found,
  619. response
  620. ;
  621. passedArguments = passedArguments || queryArguments;
  622. context = element || context;
  623. if(typeof query == 'string' && object !== undefined) {
  624. query = query.split(/[\. ]/);
  625. maxDepth = query.length - 1;
  626. $.each(query, function(depth, value) {
  627. var camelCaseValue = (depth != maxDepth)
  628. ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
  629. : query
  630. ;
  631. if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
  632. object = object[camelCaseValue];
  633. }
  634. else if( object[camelCaseValue] !== undefined ) {
  635. found = object[camelCaseValue];
  636. return false;
  637. }
  638. else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
  639. object = object[value];
  640. }
  641. else if( object[value] !== undefined ) {
  642. found = object[value];
  643. return false;
  644. }
  645. else {
  646. module.error(error.method, query);
  647. return false;
  648. }
  649. });
  650. }
  651. if ( $.isFunction( found ) ) {
  652. response = found.apply(context, passedArguments);
  653. }
  654. else if(found !== undefined) {
  655. response = found;
  656. }
  657. if($.isArray(returnedValue)) {
  658. returnedValue.push(response);
  659. }
  660. else if(returnedValue !== undefined) {
  661. returnedValue = [returnedValue, response];
  662. }
  663. else if(response !== undefined) {
  664. returnedValue = response;
  665. }
  666. return found;
  667. }
  668. };
  669. if(methodInvoked) {
  670. if(instance === undefined) {
  671. module.initialize();
  672. }
  673. module.invoke(query);
  674. }
  675. else {
  676. if(instance !== undefined) {
  677. instance.invoke('destroy');
  678. }
  679. module.initialize();
  680. }
  681. })
  682. ;
  683. if(module && !methodInvoked) {
  684. module.initializeHistory();
  685. }
  686. return (returnedValue !== undefined)
  687. ? returnedValue
  688. : this
  689. ;
  690. };
  691. // shortcut for tabbed content with no defined navigation
  692. $.tab = function() {
  693. $(window).tab.apply(this, arguments);
  694. };
  695. $.fn.tab.settings = {
  696. name : 'Tab',
  697. namespace : 'tab',
  698. debug : false,
  699. verbose : true,
  700. performance : true,
  701. auto : false, // uses pjax style endpoints fetching content from same url with remote-content headers
  702. history : false, // use browser history
  703. historyType : 'hash', // #/ or html5 state
  704. path : false, // base path of url
  705. context : false, // specify a context that tabs must appear inside
  706. childrenOnly : false, // use only tabs that are children of context
  707. maxDepth : 25, // max depth a tab can be nested
  708. alwaysRefresh : false, // load tab content new every tab click
  709. cache : true, // cache the content requests to pull locally
  710. ignoreFirstLoad : false, // don't load remote content on first load
  711. apiSettings : false, // settings for api call
  712. onTabInit : function(tabPath, parameterArray, historyEvent) {}, // called first time loaded
  713. onTabLoad : function(tabPath, parameterArray, historyEvent) {}, // called on every load
  714. templates : {
  715. determineTitle: function(tabArray) {} // returns page title for path
  716. },
  717. error: {
  718. api : 'You attempted to load content without API module',
  719. method : 'The method you called is not defined',
  720. missingTab : 'Activated tab cannot be found for this context.',
  721. noContent : 'The tab you specified is missing a content url.',
  722. path : 'History enabled, but no path was specified',
  723. recursion : 'Max recursive depth reached',
  724. state : 'History requires Asual\'s Address library <https://github.com/asual/jquery-address>'
  725. },
  726. metadata : {
  727. tab : 'tab',
  728. loaded : 'loaded',
  729. promise: 'promise'
  730. },
  731. className : {
  732. loading : 'loading',
  733. active : 'active'
  734. },
  735. selector : {
  736. tabs : '.ui.tab',
  737. ui : '.ui'
  738. }
  739. };
  740. })( jQuery, window , document );