Yahoo Mail Beta Ad Remover

By Narayan Natarajan Last update Aug 16, 2008 — Installed 9,163 times. Daily Installs: 6, 8, 1, 2, 4, 5, 1, 1, 2, 1, 5, 3, 4, 0, 2, 4, 3, 0, 3, 3, 6, 1, 3, 0, 3, 1, 3, 1, 5, 3, 5, 1

There are 1 previous version of this script.

// ==UserScript==
// @name           Yahoo Mail Beta Ad Remover
// @namespace      
// @description    A yahoo mail beta adver destroyer
// @include        http://*mail.yahoo.com/*
// ==/UserScript==
// Author: Narayan Natarajan
// email: venkman 69 at yahoo dot com 
//       (you know what to do to get the email addy from above)
//========
// change log:
// Version 0.5
// modified it to work with new yahoo advert hidebar name change
// Version 0.4
// changed behaviour of ads to "hide" rather than move them.
// thought maybe that would be more efficient
// also took care of the new yahoo "hide" button (so cheesy of yahoo!)
// Version 0.3
// Added width modifier to message panes that are popped into another tab
// Version 0.2
// Changed the name to something a bit more recognizable
// Version 0.1
// Adbeta released
//========
// Bugs
// not perfect, sometimes yahoo does not reload the page and does 
// some optimization by redrawing stuff around
// it does not recognize this and will not modify the width of such
// message panes.
//=========
function deleteNode(node){
	return node.parentNode.removeChild(node);;
}
function pixtoint(pix){
	return (parseInt(pix.toString().substring(0,pix.length - 2 )));
}
function addpix(pix1, pix2){
	return (pixtoint(pix1)+pixtoint(pix2));
}

function childsetwidth(node, width){
// first set the current node's width to width
// makes no sense for child nodes to be a different width
	if (node.style.width != 0 ) node.style.width=width;
	children=node.childNodes;
	for (i=0; i < children.length ; i++ ){
		childitem=children.item(i);
		if (childitem.style.width != 0 )
			childitem.style.width=width;
	}
}

function adbeta(){
	// get largePane width
	if (parent == null ) return;
	//largepane is advert 
	var hidebar=parent.document.getElementById('skyAdHider');
	var hidebarnew=parent.document.getElementById('ym-skyhider');
	var nlargepane=parent.document.getElementById('largePane');
	var msgfrm=parent.document.getElementById('messageAreaIframe');
	var tcDiv=parent.document.getElementById('tcDiv');
	if ( nlargepane != null ) {
//		deleteNode(nlargepane);
		nlargepane.style.visibility='hidden';
	}
	if ( hidebar != null ) {
//		deleteNode(hidebar);
		hidebar.style.visibility='hidden';
	}
	if ( hidebarnew != null ) {
//		deleteNode(hidebar);
		hidebarnew.style.visibility='hidden';
	}
	if ( msgfrm == null ){
		return;
	}

	// size of page width
	windowinner=top.innerWidth;
	// width of folder area
	foldwidth=pixtoint(parent.document.getElementById('foldersPane').style.width);
	// width of folder separator
	fsepwidth=pixtoint(parent.document.getElementById('folderMsgResizer').style.width);

	mb_style=msgfrm.style;
	mb_style.width=(windowinner - (foldwidth+fsepwidth))+"px";
	//alert(windowinner);
	// this sets double-clicked message panes that are opened
	var allifrm = parent.document.getElementsByTagName('IFRAME');
	for ( i=0; i< allifrm.length ; i++){
		if ( allifrm[i].id.indexOf('ViewArea_') !=-1 ||
				allifrm[i].id.indexOf('compArea_') !=-1 
			){
			popupmsgfrm=allifrm.item(i);
			popupmsgfrm.style.width	=mb_style.width;
		}
	}

	// rest of the widths are to be same as mb_style.width

	maintab_node=parent.document.getElementById('mainTablePane');
	mesgpane_node=parent.document.getElementById('messagePane');
	headers_node=maintab_node.parentNode;

	tcDiv.style.width=mb_style.width;
	childsetwidth(headers_node, mb_style.width);
	// do this for children of mainTablePane
	childsetwidth(maintab_node, mb_style.width);
	childsetwidth(mesgpane_node,mb_style.width);
}

adbeta();