阅读:6256回复:9
移除163边栏广告的greasemonkey脚本
做了一个移除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和所有热心测试的人!! |
|
1楼#
发布于:2006-04-26 10:33
thisAD.parentNode.removeChild(ThisAD); ThisAD -> thisAD 然后有效 |
|
2楼#
发布于:2006-04-26 10:33
我试用了一下,基本没有效果。
右边的那些广告还是在。 |
|
3楼#
发布于:2006-04-26 10:33
现在工作的基本正常,配合adblock,广告无踪.
呵呵 |
|
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')]" |
|
5楼#
发布于:2006-04-26 10:33
两个版本,都放在第一贴里了.
|
|
6楼#
发布于:2006-04-26 10:33
刚才有重新copy下来试了一下,效果果然是不错啊。
|
|
7楼#
发布于:2006-04-26 10:33
测试过了,好用
|
|
|
8楼#
发布于:2006-04-26 10:33
这些代码写到哪里?嘿嘿~~~~
|
|
9楼#
发布于:2006-04-26 10:33
首先安装greasemonkey扩展
然后新建一个文件,名字叫做"163.user.js",把楼主的代码写进去,再用FF打开,就会有安装提示了 |
|
|