TribalWars Ad Remover

By GothBoy MetalHead Last update Jul 22, 2008 — Installed 7,062 times. Daily Installs: 15, 18, 11, 6, 9, 13, 14, 36, 11, 13, 13, 22, 16, 19, 25, 16, 16, 20, 12, 19, 14, 20, 13, 15, 12, 14, 27, 16, 23, 26, 21, 16
// ==UserScript==
// @name           TribalWars Ad Remover
// @namespace      TW Ad Remover
// @description    Removes the logout screen/ad when you click the Logout button and the ad block in TribalWars.
// @include        http://en*.tribalwars.net/*
// @include        http://www.tribalwars.net/*
// @include        http://www.triburile.ro/*
// @include        http://*.triburile.ro/*
// ==/UserScript==

var url=window.location.href;
var redirect="";
if(url.indexOf("tribalwars") != -1)
        redirect="http://www.tribalwars.net";
else if(url.indexOf("triburile") != -1)
        redirect="http://www.triburile.ro";
if(url.indexOf("logout.php") != -1){
	window.stop();
	window.location=redirect;
}

//start of the remove frame code
var frmsets = document.getElementsByTagName("frameset");
if(frmsets.length > 0){
	var frmset = frmsets[0];
	for(kk=0; kk<frmset.childNodes.length; kk++){
		var frm = frmset.childNodes[kk];
		if(frm.tagName=="FRAME" && frm.getAttribute("name") != "main"){
			frm.src = "about:blank";
			frm.cols ='10';
		}
	}
	if(frmset.getAttribute("rows")) frmset.setAttribute("rows", "0, *");
	else frmset.setAttribute("cols", "*, 0");

	// Remove ads timer
	unsafeWindow.reload = function(ad_top, ad_sky){; };

	// No need to go any further; this must be the top page
	return;
}else{
	var ad_iframe = $("ad");
	if(ad_iframe && ad_iframe.tagName == "IFRAME"){
		ad_iframe.style.display = "none";
		var body_iframe = $("main");
		if(body_iframe && body_iframe.tagName == "IFRAME"){
			body_iframe.style.top = "0px";
			body_iframe.style.left = "0px";
		}
	}
}