Hacking Gmail

(Grace) #1

Chapter 6 — Gmail and Greasemonkey 111


Julien Couvreur’s MailtoComposeInGmail userscript solves this issue. It applies


itself to every site apart from Gmail, rewriting the mailto:links it finds into a
link that opens the Gmail compose page, with the to:and subject:lines


already filled in.


Listing 6-4 elucidates the userscript. Afterwards, you will see how it works.


Listing 6-4:MailtoComposeInGmail

// MailtoComposeInGMail
// version 0.1
// 2005-03-28
// Copyright (c) 2005, Julien Couvreur
// Released under the GPL license
// http://www.gnu.org/copyleft/gpl.html
// -----------------------------------------------------------


//
// This is a Greasemonkey user script.
//
// To install, you need Greasemonkey:
http://greasemonkey.mozdev.org/
// Then restart Firefox and revisit this script.
// Under Tools, there will be a new menu item to “Install User
Script”.
// Accept the default configuration and install.
//
// To uninstall, go to Tools/Manage User Scripts,
// select “Mailto Compose In GMail”, and click Uninstall.
//
// Aaron Boodman also has a similar script, at:
// http://youngpup.net/userscripts/gmailto.user.js
// In his approach, the links are re-written at the time that
you click
// on them. One benefit is that the link still looks like
mailto:x
// when you hover over it.
// -----------------------------------------------------------


//
// WHAT IT DOES:
// After the page is loaded, look for “mailto:” links and
hooks their onclick
// event to go to GMail’s compose page, passing all the usual
parameters
// (to, cc, subject, body,...).


Continued
http://www.gnu.org/copyleft/gpl.html // ----------------------------------------------------------- - Hacking Gmail - free download pdf - issuhub">
Free download pdf