// ==UserScript==
// @name		Disable Targets
// @namespace	http://www.legroom.net/software
// @description	Disable target/onclick for any link
// @include		*
// ==/UserScript==

/** licenced under a Creative Commons Attribution-NonCommercial-ShareAlike 2.0
 ** http://creativecommons.org/licenses/by-nc-sa/2.0/
 **
 ** Based on:
 ** Disable Targets For Downloads
 ** Jason Rhyley - jason AT rhyley DOT org - www.rhyley.org
 **/

(function() {
	// Find links w/ targets
	linksToFix = document.evaluate("//a[@onclick='_blank'] | //a[@target='_blank'] | //a[@onclick='_new'] | //a[@target='_new']",document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);

	// Disable target
	for (var i = 0; i < linksToFix.snapshotLength; i++) {
		a = linksToFix.snapshotItem(i);
		a.setAttribute("target", "");
		a.setAttribute("onclick", "");
	}
})();

