User:Misterr/monobook.js

From translatewiki.net

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.
window.onload = function() {
  if(document.getElementById('p-googleadsense')) {
    document.getElementById('p-googleadsense').parentNode.removeChild(document.getElementById('p-googleadsense'));
  }
  if(wgNamespaceNumber == 8) {
    if(document.getElementById('editform')) {
      var editFormDOMs = document.getElementById('editform').getElementsByTagName('div');
      for(i in editFormDOMs) {
        if(editFormDOMs[i].className == "wikiEditor-ui") {document.getElementById('editform').replaceChild(document.getElementById('wpTextbox1').cloneNode(true), editFormDOMs[i]);}
      }
      document.getElementById('wpTextbox1').rows = 15;
    }
    if(document.getElementById('wpSummary')) {
      document.getElementById('wpSummary').style.marginBottom = "auto";
      if(document.getElementById('wpTextbox1').value == "") {
        document.getElementById('wpSummary').value = "translation";
        document.getElementById('wpMinoredit').checked = false;
      }
    }
    document.getElementById('wpPreview').focus();
    document.getElementById('wpTextbox1').focus();
  }
}
 
function keyDown(event) {
  var key;
  if(window.event) {key = window.event.keyCode;} else if(event.which) {key = event.which;} else {return true;}
 
  switch(key) {
    case 123: location.href = "http://translatewiki.net/wiki/MediaWiki:" + window.clipboardData.getData("Text").replace(/^\s+|\s+$/g,"") + "/sl?action=edit"; break; // Tipka F12
    default: return true;
  }
 
  return false;
}
document.onkeydown = keyDown;