如何去除gmail中的广告?

今天和大家分享一个小技巧,如何移除gmail右侧的广告?


如果你使用客户端处理gmail邮件的话,那不用看接下来的内容了,用客户端没有广告。


我说的广告,是指下图中的红框部分,因为本来笔记本的分辨率就小(1024),再加上我把标签栏移到了右边,要是还有广告的话,正文会显得十分拥挤:


image


移除这个广告的方法,主要是用user css,或者是user js




  • 如果你是Opera或者Firefox的用户,可以直接用样式表来修改(Firefox需要安装插件stylish)。


新建一个gmail-removeAD.css的文件,用文本编辑器便器,使内容是:


==================以下代码开始======================


/加大正文字体及行高/

.ii.gt,.ii.gt {font-size:14px !important;line-height:1.5 !important}

/
隐藏读信广告/

table.T1HY1.nH.iY{width:100% !important;}

table.Bs.nH.iY td.Bu:last-child{display:none;}

/
下面是把快速动作栏隐藏起来了,如果你需要的话,去除从position到important的注释,并且删除display:none这一句/

table.T1HY1.nH.iY td.tELAdc:last-child{/
position:absolute !important;top:-65px !important;left:0 !important;/display:none}

table.T1HY1.nH.iY td.tELAdc:last-child .nH{width:auto !important}

table.T1HY1.nH.iY td.tELAdc:last-child .hk{float:left !important;margin-left:1em !important;}

/
这一句是隐藏邀请朋友框/

.nH.pp.ps .pY{display: none !important;}


=================以上代码结束======================


然后在浏览器中对gmail使用这个样式表就行了,下面是使用之后的截图,是不是清爽了很多?


image



  • 如果你是Chrome的用户,并且是2.0之后的版本,可以用userjs来处理。新建一个叫做gmail.user.js的文件,用文本编辑器打开,然后其内容是


// ==UserScript==

// @name GMail - Remove ads and relocate action links

// @namespace http://userstyles.org

// @description This style removes the ad panel from Gmail or Google Apps Mail, relocates the action links (Print all, new window, etc.) from the side bar to above the mail subject, and widens the mail content area

// @author lOtR

// @homepage http://userstyles.org/styles/11768

// @include <a href=”http://mail.google.com/“>http://mail.google.com/*

// @include https://mail.google.com/

// @include <a href=”http://.mail.google.com/“>http://.mail.google.com/

// @include <a href=”https://
.mail.google.com/“>https://.mail.google.com/

// ==/UserScript==

(function() {

var css =”.ii.gt,.ii.gt
{font-size:14px !important;line-height:1.5 !important;}table.T1HY1.nH.iY{width:100% !important;}table.Bs.nH.iY td.Bu:last-child{display:none !important;}table.T1HY1.nH.iY td.tELAdc:last-child .nH{width:auto !important}table.T1HY1.nH.iY td.tELAdc:last-child .hk{float:left !important;margin-left:1em !important;}.nH.pp.ps .pY{display: none !important;}”;

if (typeof GM_addStyle != “undefined”) {

GM_addStyle(css);

} else if (typeof addStyle != “undefined”) {

addStyle(css);

} else {

var heads = document.getElementsByTagName(“head”);

if (heads.length > 0) {

var node = document.createElement(“style”);

node.type = “text/css”;

node.appendChild(document.createTextNode(css));

heads[0].appendChild(node);

}

}

})();


将这个脚本放入目录 C:\Documents and Settings{username}\Local Settings\Application Data\Google(Chromium)\Chrome\User\ DataDefault\User Scripts 下。


修改chrome快捷方式的属性,使其能使用userjs,比如这样的”C:Documents and Settings{username}Local SettingsApplication DataGoogleChromeApplicationchrome.exe” –enable-user-scripts。


另外,Google不好的一点是,在搜索的结果里面,会加入一个重定向的功能,也就是如果你登陆了gmail,在你点击搜索结果的时候,为了能记录你的浏览历史,google会把网址变为http://www.google.com/url?sa=U&start=1&q=……这样的形式,有时候你访问被墙的东西时,整个google就会被封掉……。解决办法是用一个user js,内容很简单


// ==UserScript==

// @include http://www.google.com/search?*

//

// ==/UserScript==


var linkList = document.getElementById(“res”).getElementsByTagName(“a”);

for(var i = 0; i < linkList.length; i++) {

var link = linkList[i];

link.setAttribute(‘onmousedown’,null);

}


这篇日志参考了http://ytzong.blogspot.com/2009/03/stylishgmail.htmlhttp://zhiqiang.org/blog/posts/enable-userscripts-chrome-gmail.html