X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/177fd6fefd2e3d5a0ea6591c71d660cabdb3c1a4..refs/tags/wordpress-3.4:/wp-includes/js/tinymce/utils/mctabs.js?ver=349-20120314 diff --git a/wp-includes/js/tinymce/utils/mctabs.js b/wp-includes/js/tinymce/utils/mctabs.js index 63d457db..027ef40e 100644 --- a/wp-includes/js/tinymce/utils/mctabs.js +++ b/wp-includes/js/tinymce/utils/mctabs.js @@ -1,14 +1,16 @@ /** - * $Id: mctabs.js 520 2008-01-07 16:30:32Z spocke $ + * mctabs.js * - * Moxiecode DHTML Tabs script. + * Copyright 2009, Moxiecode Systems AB + * Released under LGPL License. * - * @author Moxiecode - * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + * License: http://tinymce.moxiecode.com/license + * Contributing: http://tinymce.moxiecode.com/contributing */ function MCTabs() { - this.settings = new Array(); + this.settings = []; + this.onChange = tinyMCEPopup.editor.windowManager.createInstance('tinymce.util.Dispatcher'); }; MCTabs.prototype.init = function(settings) { @@ -27,37 +29,79 @@ MCTabs.prototype.getParam = function(name, default_value) { return value; }; -MCTabs.prototype.displayTab = function(tab_id, panel_id) { - var panelElm = document.getElementById(panel_id); - var panelContainerElm = panelElm ? panelElm.parentNode : null; - var tabElm = document.getElementById(tab_id); - var tabContainerElm = tabElm ? tabElm.parentNode : null; - var selectionClass = this.getParam('selection_class', 'current'); +MCTabs.prototype.showTab =function(tab){ + tab.className = 'current'; + tab.setAttribute("aria-selected", true); + tab.setAttribute("aria-expanded", true); + tab.tabIndex = 0; +}; + +MCTabs.prototype.hideTab =function(tab){ + var t=this; + + tab.className = ''; + tab.setAttribute("aria-selected", false); + tab.setAttribute("aria-expanded", false); + tab.tabIndex = -1; +}; + +MCTabs.prototype.showPanel = function(panel) { + panel.className = 'current'; + panel.setAttribute("aria-hidden", false); +}; + +MCTabs.prototype.hidePanel = function(panel) { + panel.className = 'panel'; + panel.setAttribute("aria-hidden", true); +}; + +MCTabs.prototype.getPanelForTab = function(tabElm) { + return tinyMCEPopup.dom.getAttrib(tabElm, "aria-controls"); +}; + +MCTabs.prototype.displayTab = function(tab_id, panel_id, avoid_focus) { + var panelElm, panelContainerElm, tabElm, tabContainerElm, selectionClass, nodes, i, t = this; + + tabElm = document.getElementById(tab_id); + + if (panel_id === undefined) { + panel_id = t.getPanelForTab(tabElm); + } + + panelElm= document.getElementById(panel_id); + panelContainerElm = panelElm ? panelElm.parentNode : null; + tabContainerElm = tabElm ? tabElm.parentNode : null; + selectionClass = t.getParam('selection_class', 'current'); if (tabElm && tabContainerElm) { - var nodes = tabContainerElm.childNodes; + nodes = tabContainerElm.childNodes; // Hide all other tabs - for (var i=0; i