By BKDotCom
—
Last update
Jun 29, 2007
—
Installed
2,888 times.
// ==UserScript==
// @name Yahoo Mail Beta Ad Remover+
// @namespace
// @description A yahoo mail beta adver destroyer (also gets leftside ads)
// @include http://*mail.yahoo.com/*
// ==/UserScript==
// Author: Narayan Natarajan & Brad Kent
// email: venkman 69 at yahoo dot com
// (you know what to do to get the email addy from above)
//========
// change log:
// 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 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 ( 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 = parent.document.getElementById('folderMsgResizer')
? pixtoint(parent.document.getElementById('folderMsgResizer').style.width)
: 0;
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');
if ( maintab_node )
{
headers_node=maintab_node.parentNode;
childsetwidth(headers_node, mb_style.width);
childsetwidth(maintab_node, mb_style.width);
childsetwidth(mesgpane_node,mb_style.width);
}
if ( tcDiv )
tcDiv.style.width=mb_style.width;
// do this for children of mainTablePane
}
function hideSmallAds()
{
//dateObj = new Date();
//console.debug('hideSmallAds',dateObj.toLocaleTimeString());
//swPane
//nwPane
//foldersPane
//foldersTableDiv
var nwPane = top.document.getElementById('nwPane');
var swPane = top.document.getElementById('swPane');
var fp = top.document.getElementById('foldersPane');
var ftd = top.document.getElementById('foldersTableDiv');
var fph = parseInt(fp.style.height);
var ftdh = parseInt(ftd.style.height);
var ih = top.innerHeight;
//console.debug('fph/ftdh',dateObj.toLocaleTimeString(),ih,fph,ftdh);
if ( ih - fph > 40 )
{
//console.debug('setting fp');
fph = ih - 40;
fp.style.height = fph + 'px';
}
if ( fph - ftdh > 68 )
{
//console.debug('setting ftd');
ftd.style.top = '68px';
ftd.style.height = fph - 68 + 'px';
}
nwPane.style.display = 'none';
nwPane.style.height = '0px';
swPane.style.display = 'none';
swPane.style.height = '0px';
adbeta();
setTimeout(hideSmallAds,2000);
}
//adbeta();
docloc = document.location.toString();
//console.debug('docloc',docloc);
if ( parent != null && docloc.indexOf('browserHistory.html')>=0 )
{
//docloc.indexOf('action=welcome')>=0
//docloc.indexOf('userstatus.html')>=0
//docloc.indexOf('md=LREC')>=0
//dateObj = new Date();
//console.debug('starting loop',dateObj.toLocaleTimeString());
//window.setInterval(hideSmallAds,2500);
hideSmallAds();
}