Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
MRC Forum User Ignore user.js script
// ==UserScript==
// @name MRC Forum User Ignore(MRC)
// @namespace FiXato
// @description Hides messages from users you want to ignore on the forum
// @include*
// @version 1.1
// ==/UserScript==
// (c) 2011-2013, Filip H.F. "FiXato" Slagter, Licensed under MIT License.
// Tested with GreaseMonkey for Firefox 7 on Windows and on Chrome for Mac
//Add the users you want to ignore to this array
var users_to_ignore = ['sockPuppet', 'sockPuppet2'];
//What do you want to do with their posts? Either 'hide' or 'replace'
var action = 'replace';
var anchors = document.evaluate("//div[@id='forum-comments']//*[@class='author']//p/a[contains(@href, 'users/')]",document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0; i < anchors.snapshotLength; i++) {
var link = anchors.snapshotItem(i);
username = link.firstChild.textContent;
idx = users_to_ignore.indexOf(username);
commentNode = link.parentNode.parentNode.parentNode;
if(idx != -1) {
//Future support for styling per username
if(action == 'hide') {['display']= 'none';
//['display']= 'none';
//['display']= 'none';
else if(action == 'replace') {
messageNode = commentNode.getElementsByClassName('message')[0]
messageNode.setAttribute('oldInnerHTML', messageNode.innerHTML);
messageNode.innerHTML='You have ignored this user. If you want, you can <a style="cursor: pointer" onclick="this.parentNode.innerHTML=this.parentNode.getAttribute(\'oldInnerHTML\');">temporarily show this comment again</a>.<br />';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment