User:Diberri/monobook.js

Revision as of 16:57, 7 July 2009 by Diberri (talk | contribs) (deactivate access keys so I can have emacs bindings back)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
//Deactivating access keys

addOnloadHook(function(){
 var columnOne = document.getElementById('column-one');
 if (!columnOne) return;
 removeKeys(columnOne.getElementsByTagName('a'))
 removeKeys(document.getElementsByTagName('input'))
 removeKeys(document.getElementsByTagName('label'))
})

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, '');
    }
  }
}