Jan 17 2006
Greasemonkey Hacks by Mark Pilgrim
There is a certain group of people that can’t leave well enough alone. These are the kind of people who get a new gadget and five minutes later are already voiding the warranty to figure out how it works. Greesemonkey is what happens when these kind of people get a hold of a web browser like Firefox. Leaving things the way they are is just unacceptable.
Now, if you add in Web 2.0 and the Culture of Participation, and you have an Internet that is shaped as much by the people who use it as by those who built it. Now we no that web pages are there to be messed with. So, whether you’re a tweaker or want to be on the bleeding edge of Where its Going, you need to know your way around Greesemonkey.
Greesemonkey is a user script manager for Firefox. It allows you to run nuggets of JavaScript to modify webpages via Mozilla’s Document Object Model. In short, it lets you control the way web pages are displayed. And with a tool so versatile and powerful, its hard to know where to dig in. This is where the hacks come it.
In Greasemonkey Hacks, Mark Pilgrim introduces the concept of the user script and gives a smorgasbord of source code and hints on developing your own. This isn’t a simple users guide for Greasemonkey. This is a get-your-hands-dirty guide to making the monkey, and the web work for you. The book is organized linearly, but is also compartmentalized by topic – making it both a reference and a tutorial. Hacks will provide you with explanation behind the coding in heaps of userscripts, giving you the know-how to hack them out yourself.
As I mentioned, these scripts require a working knowledge of JavaScript and the DOM. You’re safe coming to the book with a base understanding of JavaScirpt. The DOM is explained, but if you’re going to do anything beyond tweaking existing scripts, you will need to be able to knock out your own JavaScript code. Of course, with all the examples provided you will have plenty of starting points.
And what kind of hacks are covered? Every kind you can imagine, from adding icons and graphics to removing ads. There are hacks for remembering passwords, tweak Yahoo! and Google searches and bypass site registrations. You can make all kinds of modifications to Gmail, and cross-reference information across sites. Of course, with a little script and imagination, there are limitless possibilities to Greasmonkey.
Now, to avoid frustration you will want to go straight to O’Reilly’s site and download the zip file of the code samples. There are almost 100 samples and you won’t want to have to retype them. That was something I learned the hard way, as it isn’t very explicit in the book.
As with any trend evolving as quickly as Greasemonkey, to is difficult to stay current. While Mark covers just about every kind of script there is, there is not any coverage of Greasemonkey solutions for other browsers – and what is compatible between them. For example, Internet Explorer can run user scripts using Trixie (one of several solutions for IE) and Opera has native support for them. While many scripts work universally, each of these browsers render differently and there is no guarantee a Greasemonkey script will work each of them. Perhaps in a future edition Mark can give us some pointers on making compatible scripts.
In the meantime, this book is the best (and only) thorough resource for Greasemonkey. So, tweakers of the web – here is your new playbook!






