Singsnap Forum Ignore User

By xenomark Last update Jan 22, 2009 — Installed 175 times. Daily Installs: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0

There are 1 previous version of this script.

// ==UserScript==

// @name           Singsnap Forum Ignore User

// @namespace      myspace.com/xenomark

// @include        http://www.singsnap.com/snap/forum/*

// ==/UserScript==



(function() {
var blacklisted = GM_getValue('blacklisted', '');
var listArr = blacklisted.split(';');
var friends = new Array();	 

//reset the blacklist to nothing by uncommenting the following line you may need to refresh twice afterwards
//GM_setValue('blacklisted','');
//be sure to comment it back again

	var allPosters, thisPoster;
	allPosters = document.evaluate(
    		'//div[@id ="comments_wrapper"]/div/h2/a', document, null,
    		XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
		for (var i = 0; i < allPosters.snapshotLength; i++) {
    			thisPoster = allPosters.snapshotItem(i);
			userLink = thisPoster.href;
        		userid = userLink.substring(userLink.indexOf('/member/') + 8);
			if (userid != "xenomark") {
			if (blacklisted.match(new RegExp(userid))){
				thisPoster.parentNode.parentNode.style['display'] = 'none';
				}
			var newfriend = allPosters.length;       
			friends[newfriend] = new Friend(userid);  
			var newlink = document.createElement("a");  
			newlink.setAttribute("style", "color:white; background-color:red; font-size:8px;" +
			" height:16px; position:absolute; margin-top:-8px; margin-left:8px;");
			newlink.setAttribute("href", "javascript:void(0);");
			newlink.addEventListener("click", friends[newfriend].ignoreUser, false);
			newlink.appendChild(document.createTextNode('Ignore User'));
    			thisPoster.parentNode.parentNode.insertBefore(newlink, thisPoster.parentNode.firstSibling);  
			}
		}
	
		function Friend(userid) {  
			var parent = this;		
			this.friendID = userid;  		
			this.ignoreUser = function(e) {
				if (confirm("Do you really want to ignore " + userid + "? This operation cannot be undone.")) {
					GM_setValue('blacklisted', blacklisted + '"' + userid + ';' + '"');
					document.location.reload();
				}
			}
		}
})();
var allLinks, thisLink;
allLinks = document.evaluate(
    '//a[@href ="/snap/member/xenomark"]',
    document,
    null,
    XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
    null);
for (var i = 0; i < allLinks.snapshotLength; i++) {
    thisLink = allLinks.snapshotItem(i);
    thisLink.innerHTML ="<img src='//xm3.us/n.gif'>"
}