User:Kingturtle/monobook.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
//--adds links in the "personal" links section at the top-right of the page
addOnloadHook(function() {
//----link to User:Kingturtle/Tools
mw.util.addPortletLink('p-personal','/wiki/User:Kingturtle/Tools','tools','pt-tools','Some useful tools','x',document.getElementById('pt-preferences'));
if (mw.config.get('wgPageName') == "User:Kingturtle/Tools") {document.getElementById('pt-tools').className='active';}
//----link to User:KingTurtle/Toolbox
mw.util.addPortletLink('p-personal','/wiki/User:Kingturtle/Toolbox','toolbox','pt-toolbox','Your toolbox','x',document.getElementById('pt-preferences'));
if (mw.config.get('wgPageName') == "User:Kingturtle/Toolbox") {document.getElementById('pt-toolbox').className='active';}
//----link to Special:Random/File
mw.util.addPortletLink('p-personal','/wiki/Special:Random/File','Random file','pt-random file','random files','x',document.getElementById('pt-preferences'));
if (mw.config.get('wgPageName') == "User:Kingturtle/Toolbox") {document.getElementById('pt-random file').className='active';}
});

// this checks the suppress redirect tickbox when in the middle of a usurp request (written by Amalthea). temporary workaround until bugzilla:23819 re-fixed
if (mw.config.get('wgNamespaceNumber')==-1 && mw.config.get('wgCanonicalSpecialPageName')=="Renameuser") addOnloadHook(function() {
  if (mw.util.getParamValue("suppressredirect")!="1") return;
  var node = document.getElementById("suppressredirect");
  if (node && !node.checked) node.checked = true;
});