自制去除Gmail广告的Chrome扩展

24 views
Skip to first unread message

七夜

unread,
Dec 8, 2009, 10:42:07 PM12/8/09
to fans
之前发过帖子介绍在firefox中去除Gmail中任何不想看到的东西(像广告,邀请框之类的),今天chrome扩展也正式上线了。 下面再介绍一种不借助外界扩展,自制chrome扩展去除Gmail中多余的东西的方法。

--
点击此网址可直接与我对话:www.googlechat.cn

七夜

unread,
Dec 8, 2009, 10:53:17 PM12/8/09
to fans
制作方法:

1. 新建一个记事本文件,修改其后缀并重命名为:gmail.user.js 

2. 打开新建的记事本,在其中输入如下代码:

// @name          给Gmail美容
(function() {
var css = "table.Bs.nH.iY td.Bu:last-child{position:absolute !important;top:-99999px !important;right:0 !important;}.nH.pp.ps .pY{display: none !important;} 此处插入其它要去掉组件的代码";
if (typeof GM_addStyle != "undefined") {
 GM_addStyle(css);
} else if (typeof PRO_addStyle != "undefined") {
 PRO_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);
 }
}
})();

3. 上面红色的代码为去除广告的代码,如果不想去掉广告,可以将这段代码删除。蓝色的代码为去掉邀请框的代码。如果还要去除其他的组件,可以将上面绿色的汉字替换在下面的代码。 

.qq{display: none}              /*隐藏左上角链接*/
.gb1{display: none}             /*隐藏左上角Gmail*/
.nH.pY{display: none}          /*隐藏邀请框*/
.mn{display: none}              /*隐藏底部提示信息*/
.toxOdd{display: none}       /*隐藏显示搜索选项和创建过滤器*/
.nH.qp{display: none}         /*隐藏顶部所有链接*/

.nH.fY{display: none}          /*隐藏设置菜单*/


4. 上面粉红色的文字为在chrome里显示的扩展标题,这个文字可以任意修改。

5. 关闭并保存文件,在保存文件时,代码里的绿色汉字要删掉。

6. 打开一个chrome窗口,将这个 gmail.user.js 文件拖到chrome窗口中进行安装,安装完之后,登录gmail,就可以看到效果了。


--
点击此网址可直接与我对话:www.googlechat.cn

livelazily

unread,
Dec 8, 2009, 11:03:04 PM12/8/09
to fa...@googlegroups.com
这算不算是一个userscript啊?

2009/12/9 七夜 <fav...@gmail.com>:

wzyboy

unread,
Dec 11, 2009, 9:10:53 PM12/11/09
to fans
太好了……Adblock升级之后好像不能过滤Gmail广告了,现在我用了这个UserScript,又可以正常过滤了。。。
-----
wzyboy
Blog: http://wzyboy.tk (Blogger)
Twitter: @wzyboy
GV: 1(734)931-0***






2009/12/9 七夜 <fav...@gmail.com>

Giant Panda

unread,
Dec 11, 2009, 9:17:34 PM12/11/09
to fa...@googlegroups.com
强,用了,很舒服。
--
Protect animals, protect panda.
I'm panda, electronic panda.


2009/12/9 七夜 <fav...@gmail.com>

Al

unread,
Dec 11, 2009, 11:24:52 PM12/11/09
to fa...@googlegroups.com
厉害
-------
yours sincerely,
Edwin

Charles de Gaulle  - "The better I get to know men, the more I find myself loving dogs."

2009/12/12 Giant Panda <pa...@protectanimals.com>
332.gif

Al

unread,
Dec 13, 2009, 12:02:46 AM12/13/09
to fa...@googlegroups.com
有个问题,你点右侧的话 ,比如右上的reply to all 就会页面左移,右键提示则不动
-------
yours sincerely,
Edwin

Marie von Ebner-Eschenbach  - "Even a stopped clock is right twice a day."

2009/12/12 Al <zaw...@gmail.com>
332.gif

夏全仁

unread,
Dec 13, 2009, 12:06:58 AM12/13/09
to fa...@googlegroups.com
google 广告还不算讨厌。

国士无双

unread,
Dec 13, 2009, 7:01:08 AM12/13/09
to fa...@googlegroups.com
真强,正在使用

王春利

unread,
Dec 13, 2009, 7:17:46 AM12/13/09
to fa...@googlegroups.com

只是创建快捷方式的gmail后,打开桌面的gmail图标不能加载脚本
2009/12/13 国士无双 <mail...@gmail.com>
真强,正在使用

谷禹

unread,
May 13, 2011, 10:15:09 AM5/13/11
to fa...@googlegroups.com
比如这个帖子

2009/12/13 王春利 <wangchu...@gmail.com>

夜の猫さま

unread,
May 13, 2011, 12:47:28 PM5/13/11
to fa...@googlegroups.com
你故意捣乱呢吧?

==== 近道あればそれが王道。====
〖猫宅〗: http://www.newchen.com
==========================



2011/5/13 谷禹 <sysu...@gmail.com>
比如这个帖子

Reply all
Reply to author
Forward
0 new messages