GMail link on Google.com

By Richard Bronosky Last update Mar 29, 2007 — Installed 2,414 times. Daily Installs: 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 4, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0
// ==UserScript==
// @name          GMail link on Google.com
// @author        Richard Bronosky
// @namespace     http://bronosky.com/pub/greasemonkey_scripts
// @description   When you are logged into gmail, your email address appears on every google.com page, but it does not take you to gmail.  That sucks.  This fixes it.
// @include       http://www.google.com/*
// ==/UserScript==

try{
	var el = (document.body.childNodes[0].firstChild.firstChild.firstChild.textContent.search(/gmail.com$/)!=-1) && 
		document.body.childNodes[0].firstChild.firstChild.firstChild;
} catch(e) {
	try{
		var el = (document.body.childNodes[2].firstChild.firstChild.firstChild.firstChild.firstChild.firstChild.firstChild.textContent.search(/gmail.com$/)!=-1) && 
			document.body.childNodes[2].firstChild.firstChild.firstChild.firstChild.firstChild.firstChild.firstChild;
	} catch(e) {
		try{
			var el = (document.body.childNodes[1].firstChild.firstChild.textContent.search(/gmail.com$/)!=-1) && 
				document.body.childNodes[1].firstChild.firstChild; 
		} catch(e) {}
	}
}

try{
	if(el){ el.innerHTML="<a href='http://gmail.com'>"+el.textContent+"</a>"; }
} catch(e) {}

//.user.js