User:Inquisitor Sasha/blockUser.js

From RationalWiki
Jump to navigation Jump to search

Note: After saving, 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: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/*

BLOCK USER BUTTON

AUTHOR: Inquisitor Ehrenstein
CONTRIBUTORS:
DESCRIPTION: Adds a button to the userbar links at the top for blocking a specific user.  It can be repeated for blocking multiple users, but this will quickly fill up the userbar, particularly on small monitors.

DOCUMENTATION:  To use this script, copy it and set the user variable below to the name of the user you want to have easy block access to.  It should only be the name of the user, without the User: prefix.

*/

var user = 'NAME OF USER';

/* --------------------------------------------------------------------- */

var buRef = document.getElementById('pt-logout');
var buParent = buRef.parentNode;
var buNewLink = document.createElement('li');
 
buNewLink.id = 'block-user-link';
buNewLink.innerHTML = '<a style="font-size: 9pt; border: 1px solid #777777; background: #CCCCCC; padding-left: 10px; padding-right: 10px; padding-top: 2px; padding-bottom: 2px;" href="http://rationalwiki.org/wiki/Special:Block/' + user + '"><b>Block '+ user +'</b></a>';
 
buParent.insertBefore(buNewLink, buRef);