// ==UserScript==
// @name        GMail Single Window
// @namespace   http://www.arantius.com/misc/greasemonkey/
// @description	Remove the javascript call that opens a new window for links in messages in Gmail.
// @include     http*://mail.google.com/*
// ==/UserScript==

//
// Originally written by Anthony Lieuallen of http://www.arantius.com/
// Licensed for unlimited modification and redistribution as long as
// this notice is kept intact.
//
// If possible, please contact me regarding new features, bugfixes
// or changes that I could integrate into the existing code instead of
// creating a different script.  Thank you
//

dump('===== Load Gmail Single Window =====\n');

(function(){
var res = document.evaluate("//a[contains(./@onclick, 'top.js.OpenExtLink')]", 
	document, null,	XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); 
var i, el;
for (i=0; el=res.snapshotItem(i); i++) {
	el.removeAttribute('onclick');
	el.removeAttribute('target');
}
})()
