MediaWiki:Gadget-removeAccessKeys.js: Difference between revisions

Content deleted Content added
versin
m fix formatting
 
(12 intermediate revisions by 5 users not shown)
Line 6:
// **********************************************************************
// Imported from version as of: 2007-04-17T22:22:27
// Deactivating access keys, see [[Wikipedia talk:WikiProject User scripts/Scripts/removeAccessKeys|talk page]]
jQuery(document).ready(function($) {
if (mw.config.get('skin') == 'vector') {
var columnOnehead = document.getElementById('columnmw-onehead');
if (head) removeKeys(columnOnehead.getElementsByTagName('a'));
var panel = document.getElementById('mw-panel');
if (panel) removeKeys(documentpanel.getElementsByTagName('inputa'));
} else {
var columnOne = document.getElementById('column-one');
if (!columnOne) columnOne = document.getElementById('mw_portlets');
if (!columnOne) return;
removeKeys(documentcolumnOne.getElementsByTagName('labela'));
var cactions = document.getElementById('p-cactions');
if (cactions) removeKeys(cactions.getElementsByTagName('a'));
var personal = document.getElementById('p-personal');
if (personal) removeKeys(personal.getElementsByTagName('a'));
}
removeKeys(document.getElementsByTagName('input'));
removeKeys(document.getElementsByTagName('label'));
});
 
addOnloadHook(function removeKeys(nodeList) {
var el;
var columnOne = document.getElementById('column-one');
for (var i = 0; i < nodeList.length; i++) {
if (!columnOne) return;
el = nodeList[i];
removeKeys(columnOne.getElementsByTagName('a'))
if (!el.accessKey) continue;
removeKeys(document.getElementsByTagName('input'))
if (!window.removeAccessKeys || removeAccessKeys.indexOf(el.accessKey) >= 0) {
removeKeys(document.getElementsByTagName('label'))
el.accessKey = ''; // el.setAttribute('accessKey', '');
})
$(el).updateTooltipAccessKeys();
 
}
function removeKeys(nodeList){
var el;
for (var i = 0; i < nodeList.length; i++) {
el = nodeList[i];
if (!el.accessKey) continue;
if (!window.removeAccessKeys || removeAccessKeys.indexOf(el.accessKey) >= 0) {
el.accessKey = ''; //el.setAttribute('accessKey', '');
if (el.title) el.title = el.title.replace(tooltipAccessKeyRegexp, '');
}
}
}
 
//