HTML5, CSS3, jQuery, JSON, Responsive Design...

Dealing with trolls on ZDNet comments

Michael Brown  August 14 2013 04:35:26 PM
Comments on ZDNet tech articles these says, invariably descend into an ill-mannered slanging match.

Actually, a good many IT sites are prone to this problem, but on ZDNet it's particularly bad.  The worst offenders, IMHO, are a small group of Microsoft trolls, who go by names such as Owllllnet, Loverock-Davidson and toddbottom.  You know they're bad because their names turn up under different spellings (because they got banned from the forums under the previous spelling).  So Owllnet, might be Owlllnet, Owlllllnet or Owllllllnet and so on; each new spelling was a forum ban, causing him to go register under a new name.  Likewise toddbottom might be toddbottom2 or toddbottom3.  And so on.

What each of these trolls has in common is a religiously pro-Microsoft agenda.  This goes far beyond legitimate opinion: anybody making points even mildly against Microsoft, or in favour of Microsoft competitors, is relentlessly attacked and ridiculed.  They like to turn up on posts from Steven J Vaughan-Nichols, since he's a Linux aficionado.  Here's a prime example: a Vaughan-Nichols article describing a windows powered botnet.  See how toddbottom (he's up to "3"  here) wades in, in full attack mode.

Trolls on ZDNet

Wouldn't it be nice to have a kill file for idiots like this, like you do for email?  I thought so too.  So I wrote one!  I've called it Filter ZDnet Troll Comments (catchy, eh?) and it takes the form of a user script.

User Scripts

User scripts are JavaScripts that you, the user, can insert into sites, even where you don't control that site's code.  You insert them at the browser level, in effect.  The easiest way to install them is a via an extension or plug-in.  I used one called for Tampermonkey for Google Chorme to install my script, although it should also work with Greasemonkey for Firefox, although I haven't tested the latter.

Adding the Script to Tampermonkey

To find my script, once you've installed the Tampermonkey, you need to:
  1. Click on the Tampermonkey icon on your Chrome toolbar and choose "Get new scripts..." from the pop-up menu.
  2. That will open the site.  Type in "zdnet" as your search term, and my Filter ZDnet Troll Comments script should be the top listed one (because it's the most recent updated one as I write this!)
  3. Click the script's URL to open it.
  4. Click the Install button at the top right.

If you now visit the that Vaughan-Nichols article again, it should look like this:

Trolls not on ZDNet

Yep, Mr Bottom is no longer present in the comments!  The Chrome console confirms the blocking of his comments.

Editing the Script

That's all fine for my personal bugbears, but I'm sure you have your own.  So, here's how to edit the script to block out your own, personal trolls:
  1. Click on the Tampermonkey icon on your Chrome toolbar and choose "Dashboard" from the pop-up menu.
  2. The Filter ZDnet Troll Comments script should be the listed in your Dashboard.  Click on it to Edit.
  3. Click the script's URL to open it.
  4. Click on the Save button when you're done editing

The Script Itself

If you're familiar with JavaScript, you'll see that there's not really a lot to it.  There's some jQuery that finds all elements (divs, actually) that have the class of "author" to get the authors of the comments on that page.  It then compares those authors against master array of troll names.  If the author is in the troll array, then the author's parent comment div (class = "commentWrapper") is hidden.

Here's the troll array, which you'll need to customise to your own (dis)tastes:
myFilter.globals.filterList = [
  ["william farrel"],
  ["owl", "net"],
  ["loverock", "davidson"]

As you can see, each name in the array is an array itself.  The code will fail the author as a troll if each member of that inner array is contained somewhere in the author's name.  So "owl" and "net" are both contained in Owlnet, Owlllnet, Owlllllnet and so on, so he can't escape, unless he changes his name completely.  "toddbottom", on the other hands, is contained by "toddbottom", "toddbottom2", "toddbottom3" etc, so I only needed to specify his name as a single-member array.