Project Insomnia

Project Insomnia is many things, but in this context it is simply a "braindump" of whatever I happen to be thinking/reading/watching/doing at the moment. Parental guidance suggested.

Tuesday, February 02, 2010

Block comments on SFGate.com

The "comments" section under every SFGate.com article is a cesspool (I'm not the first person to say this but I can't immediately find where it was said first) filled with hate, bigotry, trolling and various evil. Sure, you don't -have- to click through to the comments but SFGate helpfully shows the three highest-rated comments below each article--and the worst, and most prolific, commenters have hacking scripts that artificially inflate their comments' ratings. Here's another view on SFGate's comment section: link.

Feeling that "out of sight, out of mind" is a good policy, my first UserScript hides several DIVs associated with comments on SFGate article pages. Here's the source:


// ==UserScript==
// @name SFGate-NoComments
// @namespace http://www.userscripts.org
// @description Hide comments on SFGate.com articles
// @version 0.2
// @include http://www.sfgate.com/*
// @copyright 2010+, Andrew Rich (http://www.project-insomnia.com)
// @license (CC) Attribution Non-Commercial Share Alike; http://creativecommons.org/licenses/by-nc-sa/3.0/
// ==/UserScript==

var commentsDiv = document.getElementById('commentspage');
commentsDiv.style.display = 'none';
var commentslinksSpan = document.getElementById('commentslinks');
commentslinksSpan.style.display = 'none';
var commentBoxWrapperDiv = document.getElementById('articlePageCommentBoxWrapper');
commentBoxWrapperDiv.style.display = 'none';
var recCommentsDiv = document.getElementById('sfgate_recommended_comments');
recCommentsDiv.style.display = 'none';
var commentsListDiv = document.getElementById('commentslist');
commentsListDiv.style.display = 'none';
var commentsContainerDivAttrs = document.getElementById('Comments_Container_viewall').attributes;
commentsContainerDivAttrs.getNamedItem('class').value = '';
var commentsContainerDiv = document.getElementById('Comments_Container_viewall');
commentsContainerDiv.style.visibility = 'hidden';


I hope this is useful to you and thank you for reading. You can install it easily from the UserScripts.org link above. Tested in Safari 4.0.4 (5531.21.10) with GreaseKit 1.7 on Mac OS X 10.5.8 Build 9L30. Should work in other UserScript-supporting browsers (Firefox, Opera, Chrome "Dev Channel") without issue.

Labels: , , , ,

|| Andrew, 7:38 PM || ||

"Project Insomnia" and "project-insomnia.com" ™ & SM; site contents © Andrew Rich except where noted.