drsu
狐狸大王
狐狸大王
  • UID1387
  • 注册日期2004-12-25
  • 最后登录2008-12-20
  • 发帖数367
  • 经验10枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
阅读:6256回复:9

移除163边栏广告的greasemonkey脚本

楼主#
更多 发布于:2006-04-26 10:33
做了一个移除163边栏广告的脚本,

总结:

为安装有adblock的人提供的版本:
//
// Copyright (c) 2006, drsu
// Published under GPL License
//
// --------------------------------------------------------------------
//
// This is a Greasemonkey user script.
//
// To install, you need Greasemonkey: http://greasemonkey.mozdev.org/
// Then restart Firefox and revisit this script.
// Under Tools, there will be a new menu item to "Install User Script".
// Accept the default configuration and install.
//
// To uninstall, go to Tools/Manage User Scripts,
// select "163 Ad Remover", and click Uninstall.
//
// --------------------------------------------------------------------
//
// ==UserScript==
// @name          163 Ad Remover_lite
// @namespace     http://www.firefox.net.cn
// @description   Removes the ads in the right side of the news page in 163.com. For those people who have Adblock installed.
// @include       http://*.163.com/*
// @version       0.0.1
// ==/UserScript==
var allADs, thisAD;
allADs = document.evaluate("//div[contains(@class,'ad')]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0; i < allADs.snapshotLength; i++) {
    thisAD = allADs.snapshotItem(i);
    if (thisAD) {
    thisAD.parentNode.removeChild(thisAD);
	}

}


为没有安装adblock的人提供的版本:
//
// Copyright (c) 2006, drsu
// Published under GPL License
//
// --------------------------------------------------------------------
//
// This is a Greasemonkey user script.
//
// To install, you need Greasemonkey: http://greasemonkey.mozdev.org/
// Then restart Firefox and revisit this script.
// Under Tools, there will be a new menu item to "Install User Script".
// Accept the default configuration and install.
//
// To uninstall, go to Tools/Manage User Scripts,
// select "163 Ad Remover", and click Uninstall.
//
// --------------------------------------------------------------------
//
// ==UserScript==
// @name          163 Ad Remover_full
// @namespace     http://www.firefox.net.cn
// @description   Removes the ads in the right side of the news page in 163.com. For those people who did NOT have Adblock installed.
// @include       http://*.163.com/*
// @version       0.0.1
// ==/UserScript==
var allADs, thisAD;
allADs = document.evaluate("//span[@id='ADarctext']|//iframe[starts-with(@src,'http://adclient.163.com/')]|//div[contains(@class,'ad')]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0; i < allADs.snapshotLength; i++) {
    thisAD = allADs.snapshotItem(i);
    if (thisAD) {
    thisAD.parentNode.removeChild(thisAD);
	}

}


感谢 fiag和所有热心测试的人!!
fiag
管理员
管理员
  • UID1188
  • 注册日期2004-12-21
  • 最后登录2024-04-22
  • 发帖数4681
  • 经验686枚
  • 威望0点
  • 贡献值402点
  • 好评度51点
1楼#
发布于:2006-04-26 10:33
thisAD.parentNode.removeChild(ThisAD);

ThisAD -> thisAD

然后有效
xiaonanhai
非常火狐
非常火狐
  • UID3926
  • 注册日期2005-03-12
  • 最后登录2013-08-11
  • 发帖数830
  • 经验10枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
2楼#
发布于:2006-04-26 10:33
我试用了一下,基本没有效果。
右边的那些广告还是在。
drsu
狐狸大王
狐狸大王
  • UID1387
  • 注册日期2004-12-25
  • 最后登录2008-12-20
  • 发帖数367
  • 经验10枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
3楼#
发布于:2006-04-26 10:33
现在工作的基本正常,配合adblock,广告无踪.
呵呵
fiag
管理员
管理员
  • UID1188
  • 注册日期2004-12-21
  • 最后登录2024-04-22
  • 发帖数4681
  • 经验686枚
  • 威望0点
  • 贡献值402点
  • 好评度51点
4楼#
发布于:2006-04-26 10:33
"//div[contains(@class,'ad')]",
-->
"//iframe[starts-with(@src,'http://adclient.163.com/')]|//div[contains(@class,'ad')]",
可以多去掉哪些来自adclient.163.com的iframe内嵌帧广告,由于我没有用Adblock,如果不加这行文章中杂夹的广告还是会出现。

#add --> 去除“窄告”
-->
"//span[@id='ADarctext']|//iframe[starts-with(@src,'http://adclient.163.com/')]|//div[contains(@class,'ad')]"
drsu
狐狸大王
狐狸大王
  • UID1387
  • 注册日期2004-12-25
  • 最后登录2008-12-20
  • 发帖数367
  • 经验10枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
5楼#
发布于:2006-04-26 10:33
两个版本,都放在第一贴里了.
xiaonanhai
非常火狐
非常火狐
  • UID3926
  • 注册日期2005-03-12
  • 最后登录2013-08-11
  • 发帖数830
  • 经验10枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
6楼#
发布于:2006-04-26 10:33
刚才有重新copy下来试了一下,效果果然是不错啊。
leonary
千年狐狸
千年狐狸
  • UID4095
  • 注册日期2005-03-16
  • 最后登录2016-12-24
  • 发帖数1908
  • 经验11枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 社区居民
7楼#
发布于:2006-04-26 10:33
测试过了,好用
再狡猾的猎手也斗不过好狐狸
hanyi84
火狐狸
火狐狸
  • UID8220
  • 注册日期2005-08-25
  • 最后登录2011-03-26
  • 发帖数188
  • 经验10枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
8楼#
发布于:2006-04-26 10:33
这些代码写到哪里?嘿嘿~~~~
leonary
千年狐狸
千年狐狸
  • UID4095
  • 注册日期2005-03-16
  • 最后登录2016-12-24
  • 发帖数1908
  • 经验11枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 社区居民
9楼#
发布于:2006-04-26 10:33
首先安装greasemonkey扩展
然后新建一个文件,名字叫做"163.user.js",把楼主的代码写进去,再用FF打开,就会有安装提示了
再狡猾的猎手也斗不过好狐狸
游客

返回顶部