03 Nov 2011

Remove Ads in the new GMail

Tags: javascript, gmail, ads, remove, css, greasemonkey

Google just released a new interface for GMail, some things I like, and some things I don't. I think it was easier to differentiate between different elements in the old theme. However the search functionality in the new one is really just what GMail needed. It is so much easier to use.

Search function

The only thing that really bothers me about the new GMail are the ads, I didn't really notice them before, but now that I switched to an almost colorless layout for my GMail, they just break the whole experience, so I decided to write a small userscript to get rid of them.

Here is the script, click the title to download it.

gmail-adblock.user.js
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
// ==UserScript==
// @name           Gmail adblock
// @namespace   gmail-no-ads
// @description    Block the ads from gmail
// @include        https://mail.google.com/*
// ==/UserScript==

var cssCode = ".oM, .u7, .u5, .mq {display: none !important;}";

var styleElement = document.createElement("style");
styleElement.type = "text/css";
styleElement.appendChild(document.createTextNode(cssCode));
document.getElementsByTagName("head")[0].appendChild(styleElement);