User:Algebraist/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.
// logs link in toolbar

if (wgNamespaceNumber >= 0)
addOnloadHook(function(){
 if ( wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk" ) {
   return;
  } else
    { mw.util.addPortletLink('p-tb', mw.config.get('wgServer')+mw.config.get('wgScript')+'?title=Special:Log&page='+wgPageName,
 'Page logs', 't-pagelog', 'View logs for this page', '', document.getElementById('t-upload')) }
})

// add purge tab

importScript('Wikipedia:WikiProject User scripts/Scripts/Add purge to tabs');

// various userpage tabs, copied from [[Wikipedia:WikiProject User scripts/Scripts/User tabs]]

// Please leave the following line
// [[user:Where/usertabs]]
 
addOnloadHook(function() {
  if (wgTitle.indexOf("/") != -1 || document.title.indexOf("- History -") != -1)  //no subpages or history
     return;
  if (wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk") {
     var username = encodeURIComponent( wgTitle );
     mw.util.addPortletLink("p-cactions","http://toolserver.org/~soxred93/count/index.php?name="+ username +"&lang=en&wiki=wikipedia" , "Edit count", "ca-editcount", "Edit count from X!'s Tool");
     mw.util.addPortletLink("p-cactions", wgServer + "/w/index.php?title=Special:Log&type=move&user=" + username, "Moves", "ca-pagemoves", "Page moves by this user");
     mw.util.addPortletLink("p-cactions", wgServer + "/w/index.php?title=Special:Log&type=block&page=User:" + username, "Blocks", "ca-blog", "Blocks received by this user");
     mw.util.addPortletLink("p-cactions", wgServer + "/w/index.php?title=Special:Prefixindex&from=" + username + "&namespace=2", "Userspace", "", "List of pages in this user's userspace");
  }
});

// link to new pages in sidebar, plus JS and CSS at top

addOnloadHook(function(){
    addPortletLink ('p-interaction', '/wiki/Special:NewPages', 'New Pages','n-newpages', 'The list of recently created pages','',document.getElementById('n-help'));
    addPortletLink ('p-personal','/wiki/User:Algebraist/monobook.css','CSS','pt-css','Your custom CSS','',document.getElementById('pt-logout'));
    addPortletLink ('p-personal','/wiki/User:Algebraist/monobook.js','JavaScript','pt-js','Your custom JavaScript','',document.getElementById('pt-css'));
});

// Rename edit tab

addOnloadHook(function(){ if(document.getElementById("ca-edit")){document.getElementById("ca-edit").firstChild.innerHTML = "edit";}});

// Rename discussion tab

addOnloadHook(function(){ if(document.getElementById("ca-talk")){document.getElementById("ca-talk").firstChild.innerHTML = "talk";}});

// Move search bar below interaction

addOnloadHook(function(){
    var search = document.getElementById("p-search");
    var parent = search.parentNode;
    var tb = document.getElementById("p-tb");
    parent.insertBefore(search, tb);
});

// Rename some links

addOnloadHook(function(){ if(document.getElementById("pt-mytalk")){document.getElementById("pt-mytalk").firstChild.innerHTML = "Talk";}});
addOnloadHook(function(){ if(document.getElementById("pt-preferences")){document.getElementById("pt-preferences").firstChild.innerHTML = "Preferences";}});
addOnloadHook(function(){ if(document.getElementById("pt-watchlist")){document.getElementById("pt-watchlist").firstChild.innerHTML = "Watchlist";}});
addOnloadHook(function(){ if(document.getElementById("pt-mycontris")){document.getElementById("pt-mycontris").firstChild.innerHTML = "Contributions";}});