annotate media/js/tiny_mce/utils/mctabs.js @ 133:c515b7401078

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