Google reader full feed changer支持多项XPath

又换回了Google Reader,自然少不了对付只输出摘要的Feed工具了,Google reader full feed changer是其中一个很好用的Greasemonkey脚本(煎蛋也介绍过Pipes),我在Newsfox是用

xpath: '//div[@class="post f"]/p | //div[@class="comments"][1] | //ol[@class="commentlist"]'

来获取煎蛋的正文合评论(我发觉我很喜欢拿煎蛋做例子-_-#),09-08-13 更新:针对改版后的煎蛋重写了这条表达式。

虽然Google reader full feed changer的作者主页说支持多项XPath的,结果我用

xpath:  ['//div[@class="post f"]/p', '//div[@class="comments"][1]','//ol[@class="commentlist"]']

死活不成功,又看了郁也风的《google reader full feed changer Mod》,按他的说法确实跟Newsfox的一样没错,很郁闷,仔细对比郁也风的修改版(我的JavaScript水平仅仅能看懂控制流),原来只要改一处地方,也就是把这一行

var contents = getFirstElementByXPath(SITE_INFO[i].xpath, htmldoc);

的“getFirstElementByXPath”改成“getElementsByXPath”,即

var contents = getElementsByXPath(SITE_INFO[i].xpath, htmldoc);

然后保存刷新页面就成功鸟,宽屏配合分栏来看评论还不错。

google_reader_full_feed_changer_multi_part_xpath

This entry was posted in 浏览器 and tagged , . Bookmark the permalink.

发表评论

您的电子邮箱不会被公开。 标记为 * 的区域必须填写

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">