Hacking Gmail

(Grace) #1

Gmail and


Greasemonkey


A


nother phenomenon to hit the web at the same time as
Gmail was the Firefox browser. Indeed, the growth of this
open source application easily rivaled Gmail for shocking
explosiveness. Apart from the additional security benefits and
tasty user interface advantages that Firefox gives, the browser is
also open to a considerable amount of hacking in itself. One of
the key hacks for Firefox was Greasemonkey. In this chapter, you
learn how Greasemonkey and Firefox can be used to radically
improve your Gmail experience, and how the understanding you
now have about the workings of Gmail will enable you to build
your own Greasemonkey scripts.

What Is Greasemonkey?


Greasemonkey allows the user to assign snippets of JavaScript
code to run automatically whenever a certain page is loaded. The
upshot of this is that you can write JavaScript code that will cus-
tomize those web pages, modifying layout, adding new features,
or removing extraneous parts of the page. Greasemonkey has
been used to remove advertising, rewrite links, add new links to
other sites, and even add completely new menus to sites. Gmail,
being one huge hunk of burning JavaScript, is beautifully posi-
tioned to be taken advantage of by Greasemonkey.

To use Greasemonkey, you have to install it first. Do that by get-
ting the latest version from http://greasemonkey.mozdev.
org/.

The snippets of JavaScript used by Greasemonkey are called user-
scripts. They need to be installed into Firefox for the application to
work. You do that like this: Go to the page with the userscript in
it. It will look really ugly, with lots of JavaScript, and the top 20 or
so lines preceded by double forward-slashes, as in Figure 6-1.

̨What is
Greasemonkey?

Other Userscripts


̨Customizing the
Gmail experience

chapter


in this chapter

Free download pdf