// ==UserScript==
// @name          Hotmail Single Window
// @namespace     http://www.arantius.com/article/arantius/hotmail+single+window/
// @description	  Remove javascript from some links, especially those which open a window for links in mail.
// @include       http://*.hotmail.msn.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
//

(function(){
//dump('=== Apply Hotmail Single Window ===\n');
var results=document.evaluate('//a[starts-with(@href, "javascript:")]', 
	document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var m, el=null, i=0; el=results.snapshotItem(i); i++) {
	//a user has reported new links using a javascript 'dl' method that
	//include a pop up confirmation.  I can't see any such links but if
	//you do, he has suggested the following commented out statement.
	//you can try using it instead of the one directly below it.
	//if (m=el.href.match(/^javascript:(ol|dl|G)\(\'([^\']*)\'(,1)?\);?$/)) {
	
	if (m=el.href.match(/^javascript:(ol|G)\(\'([^\']*)\'\);?$/)) {
		el.href=m[2];
	} else if (m=el.href.match(/^javascript:HMFO\(\'([^\']*)\'\);?$/)) {
		el.href='/cgi-bin/HoTMaiL?a='+encodeURIComponent(m[1])+'&curmbox='+encodeURIComponent(m[1]);
	} else {
		//dump(el+'\n');
		//el.style.backgroundColor='red';
	}
}
})();
