Month: April 2019

Block Comments by EricJ on mst3kinfo.com

If you're a longtime reader of Satellite News (mst3kinfo.com) like me, you know that it's got a pretty good comments section, except for two things:

  1. A particularly obnoxious and persistent troll by the name of EricJ who insists on pissing in everyone's cornflakes; and
  2. A bunch of other posters with poor self-control who insist on responding to him.

And so, in the tradition of my Hide Techdirt Comments script, I've written a userscript that will block EricJ and replies that quote him. Works with Greasemonkey, Tampermonkey, and presumably any other similar userscript plugins that may be out there.

If there's anybody else who bothers you, you can add other usernames to the blacklistedUsers array, too.

And ordinarily, I wouldn't even name the troll I was talking about, because the entire point here is that you shouldn't give trolls the attention they crave -- but I figure you know, this post might prove useful to other Satellite News commenters, so I should probably put his name in it so that maybe somebody will find it while searching for a way to block all comments from, and replies to, The Original EricJ on mst3kinfo.com.

Enjoy.

// ==UserScript==
// @name          Hide Satellite News Comments
// @namespace     http://corporate-sellout.com
// @description	  Hide comments on mst3kinfo.com, based on user
// @include       http://www.mst3kinfo.com/?p=*
// @require       http://www.mst3kinfo.com/wp-includes/js/jquery/jquery.js
// ==/UserScript==

// List of users whose comments you want to hide --
// you can add more names to this list, but let's be honest, you want to block EricJ.
const blacklistedUsers = [
  'The Original EricJ'
];

const $ = jQuery;

// Comment class
// Constructor
function Comment(node) {
  this.node = node;
  this.nameBlock = $('.comment-author > .fn > a', this.node);
  this.name = this.nameBlock.text();
  this.quotedUserBlock = $('a[href^="#comment"]', this.node);
  
  this.quotedUser = this.quotedUserBlock.length === 1
    ? this.quotedUserBlock.text()
    : '';
}

// Functions
Comment.prototype = {
  constructor: Comment,
  
  check: function() {
    if(
      blacklistedUsers.includes(this.name)
      || (this.quotedUser !== '' && blacklistedUsers.includes(this.quotedUser))
    ) {
      this.node.remove();
      return true;
    }
    return false;
  }
};

$('.comment').each(function() {
  const cmt = new Comment($(this));
  cmt.check();
});

License

I'm not a lawyer, but my opinion as a programmer is that this script is too short, simple, and obvious to be copyrightable. As such, I claim no copyright, and offer no license, because none is needed. Use it however you want, with the standard disclaimer that it comes with absolutely no warranty.