Yahoo! Mail Cleanup

By nicorac Last update Apr 28, 2011 — Installed 6,095 times.

Added support for chrome

in
Subscribe to Added support for chrome 4 posts, 2 voices



Uldry User
Chrome

Below is a version that works both in Chrome and FF browsers, feel free to include it in your next release. BR.

var debug = false;

if (!debug) {
var GM_log = function() {};
} else if (unsafeWindow.console) {
var GM_log = unsafeWindow.console.log;
}
GM_log('Yahoo! Mail Cleanup script started');

// remove elements
//removeElementByID('ymail-image');
removeElementByID('theAd');
GM_log('Unneeded elements removed');

// move the search bar
x = document.getElementById("search");
if(x) {
x.style.zIndex='100';
GM_log('Search bar moved');
}

// add custom styles to document
var styles = "\
.col-hd { background-color: #E0E0E0 !important }\
.nav-bar div.tabs { padding-left:0px !important }\
div.nav-bar { top:44px !important; }\
#main { top: 72px !important }\
#uh { height:44px !important }\
#uh div.right { right:15px !important }\
#shellnavigation, #shellcontent { top:107px !important; right:0px !important; }\
#search { position:relative !important; margin-top:30px !important; }\
";
addGlobalStyle(styles);
GM_log('Styles changed');

// remove an element found by ID
function removeElementByID(strId) {
var elem = document.getElementById(strId);
if(elem) {
elem.parentNode.removeChild(elem);
GM_log('Element "' + strId + '" removed.');
} else {
GM_log('WARNING: Element "' + strId + '" not found.');
}
}

function addGlobalStyle(css) {
if(typeof GM_addStyle=='function') {GM_addStyle(css);return}
var style = document.createElement('style').setAttribute('type', 'text/css');
document.getElementsByTagName('head')[0].appendChild(style).innerHTML=css;
}

 
nicorac Script's Author
FirefoxWindows

Hi Uldry, thanks for your fix.

Your CSS style definition fix was included untouched.
As for the GM_addStyle function I preferred another way to fix it... see my code ;)

Thanks again

 
nicorac Script's Author
FirefoxWindows

Another fix for Chrome support (FF was broken in 2.0.2)

 
Uldry User
Chrome

Sadly 2.0.3 does not work for me under Chrome (latest dev version), error is:
Uncaught Error: NOT_FOUND_ERR: DOM Exception 8 GM_addStyle

I don't have any patience for JS/browser compatibility issues, so I go back to my version with the dispatcher function while you figure out... Good luck !

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel