User:Shadowphoenix/monobook.js

From Guild Wars 2 Wiki
Jump to navigationJump 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.
// adds a 'block logs for this user' link to the toolbox bar
// if the page is not in the User namespace, then no link is displayed; the link may display in the mainspace, but should not work
// should on be used on a person's userpage

addOnloadHook(function () {
    if ( wgCanonicalNamespace == "User" && wgPageName.indexOf("/") == -1 ) {
       url = wgServer + "/index.php?title=Special%3ALog&type=block&user=&page=" + wgPageName;
       addPortletLink("p-tb", url, "Block logs for this user", "pt-logs");
    }
});

addOnloadHook(function () {
    if ( wgCanonicalNamespace == "User" && wgPageName.indexOf("/") == -1 ) {
       url = wgServer + "/index.php?title=Special:Log&type=delete&user=" + username;
       addPortletLink("p-cactions", url, "Deletions", "pt-logs");
    }
});

//

// 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 );
     addPortletLink("p-cactions", wgServer + "/wiki/index.php?title=Special:Log&type=block&page=User:" + username, "Blocks received", "ca-blog", "Blocks received by this user");
     addPortletLink("p-cactions", wgServer + "/wiki/index.php?title=Special:Log&type=block&user=" + username, "Blocks given", "", "Blocks by this user");
     addPortletLink("p-cactions", wgServer + "/wiki/index.php?title=Special:Log&type=protect&user=" + username, "Protections", "", "Protections by this user");
  }
});