TribalWars Ad Remover

By GothBoy MetalHead Last update Apr 7, 2010 — Installed 15,673 times.

There are 1 previous version of this script.

// ==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;
}

//another comment :P
//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";
		}
	}
}