Skip to content

Instantly share code, notes, and snippets.

/greaterfool.user.js Secret

Created Jun 16, 2016
Embed
What would you like to do?
Hide Certain Users Comments GreaterFool
// ==UserScript==
// @name Hiding Mark's Comments and any other user on http://www.greaterfool.ca
// @namespace http://www.greaterfool.ca
// @description Greasemonkey script that hides any user named Mark/mark/MARK/mArK etc comments and anyone else, just add their name to the users array
// @include *
// @grant none
// @author Fortune Faded
// ==/UserScript==
var users = ["Mark", "SMOKING man"];
var usersLC= users.join('|').toLowerCase().trim().split('|');
var dl = document.getElementById("comment_list");
var dt = dl.getElementsByTagName("dt");
var dd = dl.getElementsByTagName("dd");
var commentID, userName, userInfo, subNodes, myName;
for (i=0; i<dt.length; i++)
{
commentID = dt[i].getAttribute("id");
if (commentID.substring(0,7) == 'comment')
{
userInfo = dt[i].getElementsByTagName("Strong")[0];
userName = userInfo.innerHTML;
subNodes = userInfo.childNodes;
if(subNodes.length > 1)
{
for (x=0; x<subNodes.length;x++)
{
myName = subNodes[x].innerHTML;
if(typeof myName != 'undefined')
{
if(usersLC.indexOf(myName.toLowerCase().trim()) != -1 )
{
dd[i].style.visibility = 'hidden';
break;
}
}
}
}
else if(usersLC.indexOf(userName.toLowerCase().trim()) != -1 )
{
dd[i].style.visibility = 'hidden';
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.