User:Misterr/monobook.js

From translatewiki.net
Jump to: navigation, search
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;