ScrapeTorrent Cleaned Up

By JoeSimmons Last update Mar 27, 2009 — Installed 177 times. Daily Installs: 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0

There are 3 previous versions of this script.

// ==UserScript==
// @name           ScrapeTorrent Cleaned Up
// @namespace      http://userscripts.org/users/23652
// @description    Cleans up scrapetorrent
// @include        http://scrapetorrent.com/*
// @copyright      JoeSimmons
// ==/UserScript==

// XPath by JoeSimmons
function xp(exp, t, n) {
return t==9 ? document.evaluate(exp,n||document,null,9,null).singleNodeValue : document.evaluate(exp,n||document,null,t||6,null);
}

// deleteAll(array) by JoeSimmons
function deleteAll(array) {
if(array.snapshotItem) for(var i=array.snapshotLength-1; i>=0; i--) array.snapshotItem(i).parentNode.removeChild(array.snapshotItem(i));
else if(!array.snapshotItem) for(var i=array.length-1; i>=0; i--) array[i].parentNode.removeChild(array[i]);
}

function main() {
var i, ads = xp("//a[@href='/Donate/']", 9) || 'none',
	adbrite = xp("//*[contains(@id, 'AdBrite')]"),
	iframes = document.getElementsByTagName('iframe');

if(ads!='none') ads.parentNode.parentNode.removeChild(ads.parentNode);
deleteAll(adbrite);
deleteAll(iframes);
}

window.addEventListener('load', main, false);