Web Interface For Lite Argus Control modules
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.

88 lines
2.3 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <title>The source code</title>
  5. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  6. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  7. </head>
  8. <body onload="prettyPrint();">
  9. <pre class="prettyprint lang-js">/*!
  10. * Ext JS Library 3.3.1
  11. * Copyright(c) 2006-2010 Sencha Inc.
  12. * licensing@sencha.com
  13. * http://www.sencha.com/license
  14. */
  15. Ext.ns('Ext.ux');
  16. Ext.ux.Tabs = Ext.extend(Ext.util.Observable, {
  17. // Configuration options
  18. activeTab: 0,
  19. // Our class constructor
  20. constructor : function(element, config) {
  21. Ext.apply(this, config);
  22. Ext.ux.Tabs.superclass.constructor.call(this);
  23. this.addEvents(
  24. 'beforetabchange',
  25. 'tabchange'
  26. );
  27. this.el = Ext.get(element);
  28. this.init();
  29. },
  30. init : function() {
  31. var me = this;
  32. this.el.addClass('ux-tabs-container');
  33. this.tabStrip = this.el.child('ul');
  34. this.tabStrip.addClass('ux-tabs-strip');
  35. this.tabStrip.on('click', this.onStripClick, this, {delegate: 'a'});
  36. this.tabs = this.tabStrip.select('> li');
  37. this.cards = this.el.select('> div');
  38. this.cardsContainer = this.el.createChild({
  39. cls: 'ux-tabs-cards'
  40. });
  41. this.cardsContainer.setWidth(this.el.getWidth());
  42. this.cards.addClass('ux-tabs-card');
  43. this.cards.appendTo(this.cardsContainer);
  44. this.el.createChild({
  45. cls: 'ux-tabs-clearfix'
  46. });
  47. this.setActiveTab(this.activeTab || 0);
  48. },
  49. onStripClick : function(ev, t) {
  50. if(t && t.href && t.href.indexOf('#')) {
  51. ev.preventDefault();
  52. this.setActiveTab(t.href.split('#')[1]);
  53. }
  54. },
  55. setActiveTab : function(tab) {
  56. var card;
  57. if(Ext.isString(tab)) {
  58. card = Ext.get(tab);
  59. tab = this.tabStrip.child('a[href=#' + tab + ']').parent();
  60. }
  61. else if (Ext.isNumber(tab)) {
  62. tab = this.tabs.item(tab);
  63. card = Ext.get(tab.first().dom.href.split('#')[1]);
  64. }
  65. if(tab && card && this.fireEvent('beforetabchange', tab, card) !== false) {
  66. card.radioClass('ux-tabs-card-active');
  67. tab.radioClass('ux-tabs-tab-active');
  68. this.fireEvent('tabchange', tab, card);
  69. }
  70. }
  71. });</pre>
  72. </body>
  73. </html>