A software package a day: Greasemonkey

Another of my favorite Firefox add-ins is Greasemonkey. Requiring a bit of knowledge of JavaScript to even get started with this isn’t a tool for everyone. However, if you have some knowledge of JavaScript and how web pages are represented in a browser (the DOM, or Document Object Model), then this tool can do things that would otherwise require a full blown extension.

Because Greasemonkey gives access to a general purpose programming language and your entire web page, the uses of the tool are really limited only to the user’s ability and the security model of the browser. I personally use it to customize sites that have content I want to adjust for my personal use. A few examples will help.

On one website the users are permitted to user avatars. Thinking themselves clever, many choose offensive images as the site doesn’t block anything except outright adult material. Worse, many of the lowest quality avatars are animated as well. Despite all these problems the content and discussion on the site are rather good. Instead of using an ad-blocker to knock out the images (which was causing “broken image” problems at the time) I wrote a quick script that replaced those images with the texted “blocked”. It turned out that many of the users were more recognizable by their avatar than their name, so I later customized the text for each user.

Emboldened by the simplicity of this task (a single IF statement and a quick tag swap) I started experimenting with other uses. It turns out to be very easy to highlight or suppress content on most sites so the site is more directly addressing your interests. Tired of a forum troll that isn’t being handled? Just hide the messages from that user’s ID. Interested in specific topics on a huge forum? Highlight key phrases in the topic list. Annoyed that a site doesn’t offer a decent text entry gadget? Add one of your own. High volume site that doesn’t support RSS feeds? Add a refresh every 30 minutes and create a floating summary of the changes.

For some examples of the power of Greasemonkey, the Top 10 Greasemonkey User Scripts at LifeHacker is a good starting point.