March 17, 2005

Ignorance is bliss

I thought this greasemonkey userscript, which automatically ignores stories about Michael Jackson in the reuter’s feed in bloglines, was pretty clever, but it’s not nearly agressive enough about hiding things I don’t want to know about. A wee bit of hackery later, I present: Mental Health Through Ignorance, a greasemonkey script that will hide any stories matching specified strings. A link is provided if you want to risk your zen state and read the hidden story.

By default, anything with the strings ‘michael jackson’ or ‘scott peterson’ are ignored. If you want to change this script to alter the strings that will trigger the hiding behaviour, here’s what you do:

  1. Download the script into a text file on your computer; you can call it anything you want as long as it ends with .user.js
  2. look for the line var toMatch = ["michael jackson", "scott peterson"];
  3. let’s say you wanted to add Robert Blake and OJ Simpson to the list and remove Scott Peterson, you would change this line to read: var toMatch = ["michael jackson", "robert blake", "oj simpsons"];. The rule is to put the bits you want matched between quotes, with the bits separated by commas. (Aside to people who know what they’re doing and are wondering about using regexps: go crazy. Whatever you put in the array is compiled to regexp objects and used as the matcher.)
  4. save the file and open it in your browser. Click Tools/Install User Script. You’re done.

Happy blissful ignorance!

Update: A wee bit of tweaking: the text informing you of a hidden story now gives you the matched text. Fixed problem where multiple matches meant you couldn’t view the story (although really, you probably shouldn’t).

PS: I am a complete neophyte when it comes to JavaScript and DOM; using this code as an example of how to do things is probably unwise with a capital UN.

Posted by Bill Stilwell at March 17, 2005 05:22 PM
Comments