Link Remover

By JoeSimmons Last update Sep 24, 2008 — Installed 259 times.

There are 3 previous versions of this script.

// ==UserScript==
// @name           Link Remover
// @namespace      http://userscripts.org/users/23652
// @copyright      JoeSimmons
// @description    Removes links you specify inside the script
// @include        *
// ==/UserScript==

/////////////////////////////////////////////////
///////// SETUP /////////////////////////////////
/////////////////////////////////////////////////
/////////////////////////////////////////////////
var links = new Array(
"Add links by adding lines like this -- No comma after the last link",
"/comments",
"/versions"
);
/////////////////////////////////////////////////
/////////////////////////////////////////////////
/////////////////////////////////////////////////
/////////////////////////////////////////////////



var allA, cLink, i, x, xp='';
for(e in links) {
if(e!=links.length-1) {xp += "//a[contains(@href, '"+links[e]+"')] | ";}
else {xp += "//a[contains(@href, '"+links[e]+"')]";}
}
allA = document.evaluate(xp,document,null,7,null);
for(i=0; i<allA.snapshotLength; i++) {
cLink = allA.snapshotItem(i);
cLink.parentNode.removeChild(cLink);
}