MySpace Comment Hider

By JoeSimmons Last update Jun 13, 2009 — Installed 727 times.

There are 9 previous versions of this script.

// ==UserScript==
// @name           MySpace Comment Hider
// @namespace      http://userscripts.org/users/23652
// @description    Removes comments with a link to the comments either automatically or with a link (edit option in source)
// @include        http://profile.myspace.com/index.cfm?fuseaction=user.viewProfile&friendID=*
// @include        http://www.myspace.com/*
// @copyright      JoeSimmons
// @version        1.0.1
// @license        Creative Commons Attribution-Noncommercial 3.0 United States License
// ==/UserScript==

// OPTIONS /////////////////////////////////////////////////////
var comments_auto_remove = true;
///////////////////////////////////////////////////////////////

var f_id = unsafeWindow.MySpace.ClientContext['DisplayFriendId']||(window.location.href.match(/friendID=([^&])/)||'')[1];

if(f_id=='' || top.location!=location) return;

function removeComments() {
	var comments = document.evaluate("//div[contains(@class, 'commentsModule')] | //table[@class='friendsComments']",document,null,9,null).singleNodeValue,
		a = document.createElement('a');
	a.setAttribute('href', 'javascript:void(0);');
	a.setAttribute('onClick', 'window.open(\'http://comment.myspace.com/index.cfm?fuseaction=user.viewComments&friendID='+f_id+'\', \'f_comments\');');
	a.textContent = 'View Comments';
	if(typeof comments!='undefined' && comments!=null) comments.parentNode.replaceChild(a, comments);
}

window.addEventListener('keypress', function(e){
	if(e.ctrlKey && e.altKey && e.keyCode==99) removeComments();
}, false);

if(comments_auto_remove) removeComments();
else {
var a = document.createElement('a');
a.textContent = 'Remove Comments';
a.href = 'javascript:void(0);';
a.setAttribute('style', 'position:fixed; bottom:0; left:0; padding:3px; color:#000 !important; background:#fff !important; font:12px arial; -moz-border-radius:4px;');
a.addEventListener('click', removeComments, false);
if(document.body.appendChild) document.body.appendChild(a);
}