阅读:3157回复:4
[分享]GreaseMonkey 脚本- 抹掉译言网文章中的Tag链接
文章正文中的Tag链接,对我来说有点华而不实,看起来有点不爽。
所以把它们干掉了。 这样把正文复制到邮件也会干净一些。 代码如下。 // ==UserScript== // @name YeeYan Tag Cleaner // @author fiag // @namespace https://www.firefox.net.cn/forum/ // @include http://www.yeeyan.com/* // @include http://feed.yeeyan.com/* // ==/UserScript== var article_body = document.getElementById('article_body'); if(article_body) { var results; results = document.evaluate("//a[@class='bodytag']/em", article_body, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); for (var j = 0; j < results.snapshotLength; j++) { var e = results.snapshotItem(j); var text = e.textContent; var txtNode = document.createTextNode(text); e.parentNode.parentNode.insertBefore(txtNode, e.parentNode.nextSibling); e.parentNode.parentNode.removeChild(e.parentNode); } } |
|
1楼#
发布于:2008-08-20 15:03
挺有用
顺便问问有没有这样的脚本: Google或baidu搜索之后用网页快照会加亮关键字 想把加亮去掉 |
|
2楼#
发布于:2008-08-20 15:03
Endif:挺有用 很容易,写了一个百度快照的 兼容 Google.cn 快照 // ==UserScript== // @name Cache Highlight Remover // @namespace https://www.firefox.net.cn/forum/ // @include http://cache.baidu.com/* // @include http://203.208.35.101/* // ==/UserScript== var allItems, thisItem; allItems = document.evaluate( '//b[@style]', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); for (var i = 0; i < allItems.snapshotLength; i++) { thisItem = allItems.snapshotItem(i); // 使用 thisItem var style = thisItem.getAttribute('style'); if(style == 'color: black; background-color: rgb(255, 255, 102);') { var text = thisItem.textContent; var txtNode = document.createTextNode(text); thisItem.parentNode.insertBefore(txtNode, thisItem.nextSibling); thisItem.parentNode.removeChild(thisItem); } } |
|
3楼#
发布于:2008-08-20 15:03
谢谢楼上
不过只能清除黄色标记,无法清除兰色标记(比方搜索”施瓦辛格“,”施瓦“上的黄色没有了,”辛格“上的兰色还在。 |
|
4楼#
发布于:2008-08-20 15:03
能写个脚本实现类似CUSTOM GOOGLE里的在GOOGLE搜索时可点击百度搜索当前搜索的关键字
最好能在百度里也点击GOOGLE搜索 |
|
|