newtorrents.info cleaner

By mungushume Last update Feb 10, 2008 — Installed 190 times. Daily Installs: 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
// ==UserScript==
// @author         mungushume
// @version        1.0
// @name           newtorrents.info cleaner
// @namespace      http://www.monkeyr.com
// @description    Hides the unneeded elements on newtorrents.info
// @include        http://www.newtorrents.info/*
// @include        http://newtorrents.info/*
// @scriptsource   http://userscripts.org/scripts/show/22590
// ==/UserScript==


var css = "@namespace url(http://www.w3.org/1999/xhtml); #yourad, #adbrite, #promo, #right { display: none !important; } #news { height: 35px !important; } #main { width:auto !important; float:none !important; } table.sm { width:100% !important; }  #tablediv { width:90% !important; } ";
_addStyle(css);

var form = document.evaluate ("//form[contains(@action,'register&save=3')]", document, null, 
							XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;    	
var topban = document.evaluate ("//div[@id='topbanner']", document, null, 
							XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;    	
var lgon = document.evaluate ("//div[@class='nt_soft' and position()=3]", document, null, 
							XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;    	
						
if ( form && topban ) 
{
	var css = "@namespace url(http://www.w3.org/1999/xhtml); #topbanner { float:left; margin: 17px 35px; border:none; }";
	topban.innerHTML="";
	var div=document.createElement("div");
	var inps=form.getElementsByTagName("input");
	for(var inp; inp=inps[0];)
	{
		div.appendChild( inp );
		div.appendChild( document.createTextNode(" ") );
	}
	var as=form.getElementsByTagName("a");
	for(var a; a=as[0];)
	{
		div.appendChild( document.createTextNode(" - ") );
		div.appendChild( a );
	}
	form = form.cloneNode( false );
	form.appendChild( div );
	topban.appendChild( form );
	_addStyle(css);
} 
else if ( lgon && topban ) 
{
	var css = "@namespace url(http://www.w3.org/1999/xhtml); #topbanner { float:left; margin: 3px 6px; border:none; }";
	var str=lgon.innerHTML;
	str=str.replace(/<br><br>/ig," - ");
	topban.innerHTML=str;
	_addStyle(css);
}

function _addStyle(css){
	if (typeof GM_addStyle != "undefined") {
	    GM_addStyle(css);
	} else if (typeof addStyle != "undefined") {
	    addStyle(css);
	} else {
	    var heads = document.getElementsByTagName("head");
	    if (heads.length > 0) {
	        var node = document.createElement("style");
	        node.type = "text/css";
	        node.innerHTML = css;
	        heads[0].appendChild(node); 
	    }
	}
}