| ... | ... |
@@ -1,76 +1,74 @@ |
| 1 |
-/** |
|
| 2 |
- * $Id: mctabs.js 758 2008-03-30 13:53:29Z spocke $ |
|
| 3 |
- * |
|
| 4 |
- * Moxiecode DHTML Tabs script. |
|
| 5 |
- * |
|
| 6 |
- * @author Moxiecode |
|
| 7 |
- * @copyright Copyright � 2004-2008, Moxiecode Systems AB, All rights reserved. |
|
| 8 |
- */ |
|
| 9 |
- |
|
| 10 |
-function MCTabs() {
|
|
| 11 |
- this.settings = []; |
|
| 12 |
-}; |
|
| 13 |
- |
|
| 14 |
-MCTabs.prototype.init = function(settings) {
|
|
| 15 |
- this.settings = settings; |
|
| 16 |
-}; |
|
| 17 |
- |
|
| 18 |
-MCTabs.prototype.getParam = function(name, default_value) {
|
|
| 19 |
- var value = null; |
|
| 20 |
- |
|
| 21 |
- value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name]; |
|
| 22 |
- |
|
| 23 |
- // Fix bool values |
|
| 24 |
- if (value == "true" || value == "false") |
|
| 25 |
- return (value == "true"); |
|
| 26 |
- |
|
| 27 |
- return value; |
|
| 28 |
-}; |
|
| 29 |
- |
|
| 30 |
-MCTabs.prototype.displayTab = function(tab_id, panel_id) {
|
|
| 31 |
- var panelElm, panelContainerElm, tabElm, tabContainerElm, selectionClass, nodes, i; |
|
| 32 |
- |
|
| 33 |
- panelElm= document.getElementById(panel_id); |
|
| 34 |
- panelContainerElm = panelElm ? panelElm.parentNode : null; |
|
| 35 |
- tabElm = document.getElementById(tab_id); |
|
| 36 |
- tabContainerElm = tabElm ? tabElm.parentNode : null; |
|
| 37 |
- selectionClass = this.getParam('selection_class', 'current');
|
|
| 38 |
- |
|
| 39 |
- if (tabElm && tabContainerElm) {
|
|
| 40 |
- nodes = tabContainerElm.childNodes; |
|
| 41 |
- |
|
| 42 |
- // Hide all other tabs |
|
| 43 |
- for (i = 0; i < nodes.length; i++) {
|
|
| 44 |
- if (nodes[i].nodeName == "LI") |
|
| 45 |
- nodes[i].className = ''; |
|
| 46 |
- } |
|
| 47 |
- |
|
| 48 |
- // Show selected tab |
|
| 49 |
- tabElm.className = 'current'; |
|
| 50 |
- } |
|
| 51 |
- |
|
| 52 |
- if (panelElm && panelContainerElm) {
|
|
| 53 |
- nodes = panelContainerElm.childNodes; |
|
| 54 |
- |
|
| 55 |
- // Hide all other panels |
|
| 56 |
- for (i = 0; i < nodes.length; i++) {
|
|
| 57 |
- if (nodes[i].nodeName == "DIV") |
|
| 58 |
- nodes[i].className = 'panel'; |
|
| 59 |
- } |
|
| 60 |
- |
|
| 61 |
- // Show selected panel |
|
| 62 |
- panelElm.className = 'current'; |
|
| 63 |
- } |
|
| 64 |
-}; |
|
| 65 |
- |
|
| 66 |
-MCTabs.prototype.getAnchor = function() {
|
|
| 67 |
- var pos, url = document.location.href; |
|
| 68 |
- |
|
| 69 |
- if ((pos = url.lastIndexOf('#')) != -1)
|
|
| 70 |
- return url.substring(pos + 1); |
|
| 71 |
- |
|
| 72 |
- return ""; |
|
| 73 |
-}; |
|
| 74 |
- |
|
| 75 |
-// Global instance |
|
| 76 |
-var mcTabs = new MCTabs(); |
|
| 1 |
+/** |
|
| 2 |
+ * $Id$ |
|
| 3 |
+ * |
|
| 4 |
+ * Moxiecode DHTML Tabs script. |
|
| 5 |
+ * |
|
| 6 |
+ * @author Moxiecode |
|
| 7 |
+ * @copyright Copyright � 2004-2007, Moxiecode Systems AB, All rights reserved. |
|
| 8 |
+ */ |
|
| 9 |
+ |
|
| 10 |
+function MCTabs() {
|
|
| 11 |
+ this.settings = new Array(); |
|
| 12 |
+}; |
|
| 13 |
+ |
|
| 14 |
+MCTabs.prototype.init = function(settings) {
|
|
| 15 |
+ this.settings = settings; |
|
| 16 |
+}; |
|
| 17 |
+ |
|
| 18 |
+MCTabs.prototype.getParam = function(name, default_value) {
|
|
| 19 |
+ var value = null; |
|
| 20 |
+ |
|
| 21 |
+ value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name]; |
|
| 22 |
+ |
|
| 23 |
+ // Fix bool values |
|
| 24 |
+ if (value == "true" || value == "false") |
|
| 25 |
+ return (value == "true"); |
|
| 26 |
+ |
|
| 27 |
+ return value; |
|
| 28 |
+}; |
|
| 29 |
+ |
|
| 30 |
+MCTabs.prototype.displayTab = function(tab_id, panel_id) {
|
|
| 31 |
+ var panelElm = document.getElementById(panel_id); |
|
| 32 |
+ var panelContainerElm = panelElm ? panelElm.parentNode : null; |
|
| 33 |
+ var tabElm = document.getElementById(tab_id); |
|
| 34 |
+ var tabContainerElm = tabElm ? tabElm.parentNode : null; |
|
| 35 |
+ var selectionClass = this.getParam('selection_class', 'current');
|
|
| 36 |
+ |
|
| 37 |
+ if (tabElm && tabContainerElm) {
|
|
| 38 |
+ var nodes = tabContainerElm.childNodes; |
|
| 39 |
+ |
|
| 40 |
+ // Hide all other tabs |
|
| 41 |
+ for (var i=0; i<nodes.length; i++) {
|
|
| 42 |
+ if (nodes[i].nodeName == "LI") |
|
| 43 |
+ nodes[i].className = ''; |
|
| 44 |
+ } |
|
| 45 |
+ |
|
| 46 |
+ // Show selected tab |
|
| 47 |
+ tabElm.className = 'current'; |
|
| 48 |
+ } |
|
| 49 |
+ |
|
| 50 |
+ if (panelElm && panelContainerElm) {
|
|
| 51 |
+ var nodes = panelContainerElm.childNodes; |
|
| 52 |
+ |
|
| 53 |
+ // Hide all other panels |
|
| 54 |
+ for (var i=0; i<nodes.length; i++) {
|
|
| 55 |
+ if (nodes[i].nodeName == "DIV") |
|
| 56 |
+ nodes[i].className = 'panel'; |
|
| 57 |
+ } |
|
| 58 |
+ |
|
| 59 |
+ // Show selected panel |
|
| 60 |
+ panelElm.className = 'current'; |
|
| 61 |
+ } |
|
| 62 |
+}; |
|
| 63 |
+ |
|
| 64 |
+MCTabs.prototype.getAnchor = function() {
|
|
| 65 |
+ var pos, url = document.location.href; |
|
| 66 |
+ |
|
| 67 |
+ if ((pos = url.lastIndexOf('#')) != -1)
|
|
| 68 |
+ return url.substring(pos + 1); |
|
| 69 |
+ |
|
| 70 |
+ return ""; |
|
| 71 |
+}; |
|
| 72 |
+ |
|
| 73 |
+// Global instance |
|
| 74 |
+var mcTabs = new MCTabs(); |
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,76 @@ |
| 1 |
+/** |
|
| 2 |
+ * $Id: mctabs.js 758 2008-03-30 13:53:29Z spocke $ |
|
| 3 |
+ * |
|
| 4 |
+ * Moxiecode DHTML Tabs script. |
|
| 5 |
+ * |
|
| 6 |
+ * @author Moxiecode |
|
| 7 |
+ * @copyright Copyright � 2004-2008, Moxiecode Systems AB, All rights reserved. |
|
| 8 |
+ */ |
|
| 9 |
+ |
|
| 10 |
+function MCTabs() {
|
|
| 11 |
+ this.settings = []; |
|
| 12 |
+}; |
|
| 13 |
+ |
|
| 14 |
+MCTabs.prototype.init = function(settings) {
|
|
| 15 |
+ this.settings = settings; |
|
| 16 |
+}; |
|
| 17 |
+ |
|
| 18 |
+MCTabs.prototype.getParam = function(name, default_value) {
|
|
| 19 |
+ var value = null; |
|
| 20 |
+ |
|
| 21 |
+ value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name]; |
|
| 22 |
+ |
|
| 23 |
+ // Fix bool values |
|
| 24 |
+ if (value == "true" || value == "false") |
|
| 25 |
+ return (value == "true"); |
|
| 26 |
+ |
|
| 27 |
+ return value; |
|
| 28 |
+}; |
|
| 29 |
+ |
|
| 30 |
+MCTabs.prototype.displayTab = function(tab_id, panel_id) {
|
|
| 31 |
+ var panelElm, panelContainerElm, tabElm, tabContainerElm, selectionClass, nodes, i; |
|
| 32 |
+ |
|
| 33 |
+ panelElm= document.getElementById(panel_id); |
|
| 34 |
+ panelContainerElm = panelElm ? panelElm.parentNode : null; |
|
| 35 |
+ tabElm = document.getElementById(tab_id); |
|
| 36 |
+ tabContainerElm = tabElm ? tabElm.parentNode : null; |
|
| 37 |
+ selectionClass = this.getParam('selection_class', 'current');
|
|
| 38 |
+ |
|
| 39 |
+ if (tabElm && tabContainerElm) {
|
|
| 40 |
+ nodes = tabContainerElm.childNodes; |
|
| 41 |
+ |
|
| 42 |
+ // Hide all other tabs |
|
| 43 |
+ for (i = 0; i < nodes.length; i++) {
|
|
| 44 |
+ if (nodes[i].nodeName == "LI") |
|
| 45 |
+ nodes[i].className = ''; |
|
| 46 |
+ } |
|
| 47 |
+ |
|
| 48 |
+ // Show selected tab |
|
| 49 |
+ tabElm.className = 'current'; |
|
| 50 |
+ } |
|
| 51 |
+ |
|
| 52 |
+ if (panelElm && panelContainerElm) {
|
|
| 53 |
+ nodes = panelContainerElm.childNodes; |
|
| 54 |
+ |
|
| 55 |
+ // Hide all other panels |
|
| 56 |
+ for (i = 0; i < nodes.length; i++) {
|
|
| 57 |
+ if (nodes[i].nodeName == "DIV") |
|
| 58 |
+ nodes[i].className = 'panel'; |
|
| 59 |
+ } |
|
| 60 |
+ |
|
| 61 |
+ // Show selected panel |
|
| 62 |
+ panelElm.className = 'current'; |
|
| 63 |
+ } |
|
| 64 |
+}; |
|
| 65 |
+ |
|
| 66 |
+MCTabs.prototype.getAnchor = function() {
|
|
| 67 |
+ var pos, url = document.location.href; |
|
| 68 |
+ |
|
| 69 |
+ if ((pos = url.lastIndexOf('#')) != -1)
|
|
| 70 |
+ return url.substring(pos + 1); |
|
| 71 |
+ |
|
| 72 |
+ return ""; |
|
| 73 |
+}; |
|
| 74 |
+ |
|
| 75 |
+// Global instance |
|
| 76 |
+var mcTabs = new MCTabs(); |