Edit File by line
/home/barbar84/www/wp-inclu.../js/tinymce/utils
File: mctabs.js
/**
[0] Fix | Delete
* mctabs.js
[1] Fix | Delete
*
[2] Fix | Delete
* Released under LGPL License.
[3] Fix | Delete
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
[4] Fix | Delete
*
[5] Fix | Delete
* License: http://www.tinymce.com/license
[6] Fix | Delete
* Contributing: http://www.tinymce.com/contributing
[7] Fix | Delete
*/
[8] Fix | Delete
[9] Fix | Delete
/*jshint globals: tinyMCEPopup */
[10] Fix | Delete
[11] Fix | Delete
function MCTabs() {
[12] Fix | Delete
this.settings = [];
[13] Fix | Delete
this.onChange = tinyMCEPopup.editor.windowManager.createInstance('tinymce.util.Dispatcher');
[14] Fix | Delete
}
[15] Fix | Delete
[16] Fix | Delete
MCTabs.prototype.init = function (settings) {
[17] Fix | Delete
this.settings = settings;
[18] Fix | Delete
};
[19] Fix | Delete
[20] Fix | Delete
MCTabs.prototype.getParam = function (name, default_value) {
[21] Fix | Delete
var value = null;
[22] Fix | Delete
[23] Fix | Delete
value = (typeof (this.settings[name]) == "undefined") ? default_value : this.settings[name];
[24] Fix | Delete
[25] Fix | Delete
// Fix bool values
[26] Fix | Delete
if (value == "true" || value == "false") {
[27] Fix | Delete
return (value == "true");
[28] Fix | Delete
}
[29] Fix | Delete
[30] Fix | Delete
return value;
[31] Fix | Delete
};
[32] Fix | Delete
[33] Fix | Delete
MCTabs.prototype.showTab = function (tab) {
[34] Fix | Delete
tab.className = 'current';
[35] Fix | Delete
tab.setAttribute("aria-selected", true);
[36] Fix | Delete
tab.setAttribute("aria-expanded", true);
[37] Fix | Delete
tab.tabIndex = 0;
[38] Fix | Delete
};
[39] Fix | Delete
[40] Fix | Delete
MCTabs.prototype.hideTab = function (tab) {
[41] Fix | Delete
var t = this;
[42] Fix | Delete
[43] Fix | Delete
tab.className = '';
[44] Fix | Delete
tab.setAttribute("aria-selected", false);
[45] Fix | Delete
tab.setAttribute("aria-expanded", false);
[46] Fix | Delete
tab.tabIndex = -1;
[47] Fix | Delete
};
[48] Fix | Delete
[49] Fix | Delete
MCTabs.prototype.showPanel = function (panel) {
[50] Fix | Delete
panel.className = 'current';
[51] Fix | Delete
panel.setAttribute("aria-hidden", false);
[52] Fix | Delete
};
[53] Fix | Delete
[54] Fix | Delete
MCTabs.prototype.hidePanel = function (panel) {
[55] Fix | Delete
panel.className = 'panel';
[56] Fix | Delete
panel.setAttribute("aria-hidden", true);
[57] Fix | Delete
};
[58] Fix | Delete
[59] Fix | Delete
MCTabs.prototype.getPanelForTab = function (tabElm) {
[60] Fix | Delete
return tinyMCEPopup.dom.getAttrib(tabElm, "aria-controls");
[61] Fix | Delete
};
[62] Fix | Delete
[63] Fix | Delete
MCTabs.prototype.displayTab = function (tab_id, panel_id, avoid_focus) {
[64] Fix | Delete
var panelElm, panelContainerElm, tabElm, tabContainerElm, selectionClass, nodes, i, t = this;
[65] Fix | Delete
[66] Fix | Delete
tabElm = document.getElementById(tab_id);
[67] Fix | Delete
[68] Fix | Delete
if (panel_id === undefined) {
[69] Fix | Delete
panel_id = t.getPanelForTab(tabElm);
[70] Fix | Delete
}
[71] Fix | Delete
[72] Fix | Delete
panelElm = document.getElementById(panel_id);
[73] Fix | Delete
panelContainerElm = panelElm ? panelElm.parentNode : null;
[74] Fix | Delete
tabContainerElm = tabElm ? tabElm.parentNode : null;
[75] Fix | Delete
selectionClass = t.getParam('selection_class', 'current');
[76] Fix | Delete
[77] Fix | Delete
if (tabElm && tabContainerElm) {
[78] Fix | Delete
nodes = tabContainerElm.childNodes;
[79] Fix | Delete
[80] Fix | Delete
// Hide all other tabs
[81] Fix | Delete
for (i = 0; i < nodes.length; i++) {
[82] Fix | Delete
if (nodes[i].nodeName == "LI") {
[83] Fix | Delete
t.hideTab(nodes[i]);
[84] Fix | Delete
}
[85] Fix | Delete
}
[86] Fix | Delete
[87] Fix | Delete
// Show selected tab
[88] Fix | Delete
t.showTab(tabElm);
[89] Fix | Delete
}
[90] Fix | Delete
[91] Fix | Delete
if (panelElm && panelContainerElm) {
[92] Fix | Delete
nodes = panelContainerElm.childNodes;
[93] Fix | Delete
[94] Fix | Delete
// Hide all other panels
[95] Fix | Delete
for (i = 0; i < nodes.length; i++) {
[96] Fix | Delete
if (nodes[i].nodeName == "DIV") {
[97] Fix | Delete
t.hidePanel(nodes[i]);
[98] Fix | Delete
}
[99] Fix | Delete
}
[100] Fix | Delete
[101] Fix | Delete
if (!avoid_focus) {
[102] Fix | Delete
tabElm.focus();
[103] Fix | Delete
}
[104] Fix | Delete
[105] Fix | Delete
// Show selected panel
[106] Fix | Delete
t.showPanel(panelElm);
[107] Fix | Delete
}
[108] Fix | Delete
};
[109] Fix | Delete
[110] Fix | Delete
MCTabs.prototype.getAnchor = function () {
[111] Fix | Delete
var pos, url = document.location.href;
[112] Fix | Delete
[113] Fix | Delete
if ((pos = url.lastIndexOf('#')) != -1) {
[114] Fix | Delete
return url.substring(pos + 1);
[115] Fix | Delete
}
[116] Fix | Delete
[117] Fix | Delete
return "";
[118] Fix | Delete
};
[119] Fix | Delete
[120] Fix | Delete
[121] Fix | Delete
//Global instance
[122] Fix | Delete
var mcTabs = new MCTabs();
[123] Fix | Delete
[124] Fix | Delete
tinyMCEPopup.onInit.add(function () {
[125] Fix | Delete
var tinymce = tinyMCEPopup.getWin().tinymce, dom = tinyMCEPopup.dom, each = tinymce.each;
[126] Fix | Delete
[127] Fix | Delete
each(dom.select('div.tabs'), function (tabContainerElm) {
[128] Fix | Delete
//var keyNav;
[129] Fix | Delete
[130] Fix | Delete
dom.setAttrib(tabContainerElm, "role", "tablist");
[131] Fix | Delete
[132] Fix | Delete
var items = tinyMCEPopup.dom.select('li', tabContainerElm);
[133] Fix | Delete
var action = function (id) {
[134] Fix | Delete
mcTabs.displayTab(id, mcTabs.getPanelForTab(id));
[135] Fix | Delete
mcTabs.onChange.dispatch(id);
[136] Fix | Delete
};
[137] Fix | Delete
[138] Fix | Delete
each(items, function (item) {
[139] Fix | Delete
dom.setAttrib(item, 'role', 'tab');
[140] Fix | Delete
dom.bind(item, 'click', function (evt) {
[141] Fix | Delete
action(item.id);
[142] Fix | Delete
});
[143] Fix | Delete
});
[144] Fix | Delete
[145] Fix | Delete
dom.bind(dom.getRoot(), 'keydown', function (evt) {
[146] Fix | Delete
if (evt.keyCode === 9 && evt.ctrlKey && !evt.altKey) { // Tab
[147] Fix | Delete
//keyNav.moveFocus(evt.shiftKey ? -1 : 1);
[148] Fix | Delete
tinymce.dom.Event.cancel(evt);
[149] Fix | Delete
}
[150] Fix | Delete
});
[151] Fix | Delete
[152] Fix | Delete
each(dom.select('a', tabContainerElm), function (a) {
[153] Fix | Delete
dom.setAttrib(a, 'tabindex', '-1');
[154] Fix | Delete
});
[155] Fix | Delete
[156] Fix | Delete
/*keyNav = tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', {
[157] Fix | Delete
root: tabContainerElm,
[158] Fix | Delete
items: items,
[159] Fix | Delete
onAction: action,
[160] Fix | Delete
actOnFocus: true,
[161] Fix | Delete
enableLeftRight: true,
[162] Fix | Delete
enableUpDown: true
[163] Fix | Delete
}, tinyMCEPopup.dom);*/
[164] Fix | Delete
}
[165] Fix | Delete
);
[166] Fix | Delete
});
[167] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function