By JoeSimmons
—
Last update
May 21, 2009
—
Installed
29 times.
// ==UserScript==
// @name ScrapeTorrent White Theme
// @namespace http://userscripts.org/users/23652
// @description White theme for scrapetorrent
// @include http://scrapetorrent.com/Search/*
// @copyright JoeSimmons
// @version 1.0.0
// @license Creative Commons Attribution-Noncommercial 3.0 United States License
// ==/UserScript==
// addGlobalStyle
function addGlobalStyle(css) {
if(!(head=document.getElementsByTagName('head')[0])) {return;}
var style = document.createElement('style');
style.type = 'text/css';
head.appendChild(style).innerHTML = css;
}
var css = <><![CDATA[
* {
background-color: #FFF !important;
}
a, td, input, select {
color: #000 !important;
}
table, input, select {
border:1px solid #DADADA !important;
}
iframe, a[href*="adbrite"], a[href*="Donate"], form[action*="paypal.com"]
{display:none !important;}
]]></>.toString();
addGlobalStyle(css);
// XPath by JoeSimmons
function xp(exp, t, n) {
var x = document.evaluate(exp||"//body",n||document,null,t||6,null);
if(t && t>-1 && t<10) switch(t) {
case 1: x=x.numberValue; break;
case 2: x=x.stringValue; break;
case 3: x=x.booleanValue; break;
case 8: x=x.singleNodeValue; break;
case 9: x=x.singleNodeValue; break;
default: break;
} return x;
}
// 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 removeAds() {
var i, ads = xp("//a[@href='/Donate/']"),
adbrite_frames = xp("//*[contains(@id, 'AdBrite') or contains(@href, 'adbrite')] | //iframe");
if(ads&&ads.parentNode&&ads.parentNode.parentNode) ads.parentNode.parentNode.removeChild(ads.parentNode);
deleteAll(adbrite_frames);
}
window.addEventListener('load', removeAds, false);
var bgcolors = xp("//*[@bgcolor or @background]");
for(var i=bgcolors.snapshotLength-1; (item=bgcolors.snapshotItem(i)); i--) {
item.removeAttribute('bgcolor');
item.removeAttribute('background');
}
if((search=document.getElementsByName('submit')[0])) {
search.setAttribute('value', 'Search');
search.setAttribute('type', 'submit');
search.removeAttribute('src');
}