Sorry, you need to enable JavaScript to visit this website.

Bullshit Blocker

  • warning: Parameter 1 to phptemplate_comment_submitted() expected to be a reference, value given in /home2/slatedor/public_html/includes/theme.inc on line 669.
  • warning: Parameter 1 to phptemplate_comment_submitted() expected to be a reference, value given in /home2/slatedor/public_html/includes/theme.inc on line 669.
  • warning: Parameter 1 to phptemplate_comment_submitted() expected to be a reference, value given in /home2/slatedor/public_html/includes/theme.inc on line 669.
  • warning: Parameter 1 to phptemplate_comment_submitted() expected to be a reference, value given in /home2/slatedor/public_html/includes/theme.inc on line 669.

One of the best things about the Internet is the fact that not only is it a tremendous source of information, but it also provides us with a very fine-grained control over that information. For example, unlike broadcast and print media, we can automatically filter out adverts and other nasties, using indispensable software like AdBlock Plus and NoScript.

But there's another type of "nasty" that isn't so easy to filter out ... media hacks with an unsavoury political bent (putting it politely).

Take El Reg for example. Most of its articles are informative, entertaining and have a decidedly liberal leaning, but there are a few exceptions, most of which seem to be penned by a particularly unpleasant character by the name of Andrew Orlowski.

Orlowski is a thoroughly nasty piece of work, who sneers at anything even remotely virtuous. He hates Wikileaks with a passion, and environmentalists, and Google, and Free Software advocates (or "Freetards" as he likes to call us), and ... well, pretty much anything else on the "us" side of the "them and us" argument. Astute El Reg readers will note that Orlowski's articles are the only ones on the site with comments disabled (Ed: until very recently), and with good reason, given his right-wing extremist views.

So on the one hand I want to keep reading El Reg, but on the other I don't want to get even the vaguest whiff of Orlowski's sick propaganda. Well surely the answer is simple, I hear you say, just don't read his articles. But that's easier said than done, given that it's not always obvious who's written an article until after I've already started reading it. Even if I don't immediately notice the attribution line, the tone of an Orlowski article is unmistakable. I'd easily know one of his articles even if he submitted it anonymously, just by reading it. But frankly I'd rather not. Ever. Not if I can help it.

This got me thinking about creative and automatic ways of blocking undesirable content. I tried a few existing solutions, but most of them seem oriented towards blocking porn and suchlike, and there didn't seem to be any way to "block articles by author" ... that I could find, anyway.

Then I discovered Greasemonkey, yet another superb addon for Firefox. This amazing tool allows you to take complete control of the content you see in your browser, to the point that you can replace entire Websites with your own redesigned version. It does require either javascript skills or a willingness to live with others' scripts, but with a bit of determination you can cook up just about any solution to any Web-based problem.

And that's just what I did.

So here it is, a Greasemonkey javascript to block Web pages by keyword:

// ==UserScript==
// @name blockit
// @namespace none
// @description Blocks pages by keyword
// @include http://www.theregister.co.uk/*
// ==/UserScript==

// License: This script is dedicated to the Public Domain

var keywords = [];
keywords[0] = "Andrew Orlowski";
keywords[1] = "Matt Asay";

var webpage = document.getElementsByTagName('body')[0].innerHTML;

var keylength=keywords.length;
var isblocked = 0;
for ( var i = 0; i < keylength; i++ ) {
   var keypos = webpage.indexOf(keywords[i]);
   if ( keypos !== -1 ) {
      isblocked = 1;
      var blockname = keywords[i];
      break;
   }
}

if (isblocked == 1) {
   document.body.innerHTML = "This page is blocked because it contains bullshit by " + blockname + ".";
}

Feel free to add whatever sites and keywords you need. Comments, flames and suggestions are welcome.

Comments

Any way of adding drivel from Kelly Fiveash too?

I need to wash the stench of filth out of my eyes after reading anything she/he writes on The Register.

Seems OK to me.

Can you quote any specific examples of what you object to?

New & lost.

This sounds great but I can't find the window to install a script.

"New user script" doesn't seem to have a place for entering such code.

Suggestions?

Thanks!

x/RICHARD

Easy

The manual way:

(Substitute "<profile>" for your actual profile name)
mkdir ${HOME}/.mozilla/firefox/<profile>/gm_scripts/blockit
gedit ${HOME}/.mozilla/firefox/<profile>/gm_scripts/blockit/blockit.user.js
Copy and paste the above script, then save.

The automatic way:

Click on the "Install Now" button I just added to the article. :)