Google Docs Viewer 在线阅读

普遍适用的规则分享、讨论

Moderator: phoenix

Post Reply
User avatar
phoenix
Site Admin
Posts: 526
Joined: Dec 29 2007, 16:27

Google Docs Viewer 在线阅读

Post by phoenix »

如下规则将给 Google Docs Viewer 支持的文档类型的链接增加一个在线阅读的链接。

Code: Select all

[Patterns]
Name = "Add Google Docs Viewer 2009.11.02 [phoenix]"
Active = TRUE
Bounds = "<a\s*</a>"
Limit = 256
Match = "\1&*href=$AV((http://(^docs.google.com)*.(pdf|ppt|tiff))\2)"
Replace = "\1 <a title="Google Docs Viewer" href="http://docs.google.com/viewer?url=$ESC(\2)"><img src="http://docs.google.com/favicon.ico"></a>"
示例页面: http://www.catonmat.net/projects/cheat-sheets
Attachments
google_docs_viewer.png
google_docs_viewer.png (20.79 KiB) Viewed 13787 times
不夜侯
Posts: 101
Joined: Jul 29 2009, 16:22

Re: Google Docs Viewer 在线阅读

Post by 不夜侯 »

像源代码中href地址没有给出 http://www.cninfo.com.cn/ 前缀的,能否自动补全?
代码:

Code: Select all

<a href='../../finalpage/2009-03-27/50630322.PDF' target=_top>上海建工:2008年年度报告摘要</a>
示例地址:
http://www.cninfo.com.cn/gszx/dqbg600170.html
ddbb
Moderator
Posts: 425
Joined: Jan 07 2008, 13:30

Re: Google Docs Viewer 在线阅读

Post by ddbb »

我觉得如果你真要做的话 还是用JS来写比较方便

PROX我只会写一种情况的...如果考虑别的情况 我就不会写了.... :cry:
不夜侯
Posts: 101
Joined: Jul 29 2009, 16:22

Re: Google Docs Viewer 在线阅读

Post by 不夜侯 »

我用opera,对于那种情况修改右键更方便些。

Code: Select all

Copy link & Go to page, "http://docs.google.com/viewer?url=%c"
User avatar
phoenix
Site Admin
Posts: 526
Joined: Dec 29 2007, 16:27

Re: Google Docs Viewer 在线阅读

Post by phoenix »

不夜侯 wrote:像源代码中href地址没有给出 http://www.cninfo.com.cn/ 前缀的,能否自动补全?
代码:

Code: Select all

<a href='../../finalpage/2009-03-27/50630322.PDF' target=_top>上海建工:2008年年度报告摘要</a>
示例地址:
http://www.cninfo.com.cn/gszx/dqbg600170.html
jjoe 写过这种规则,见附件。
Attachments
funcRelativePathtoFull.zip
(2.66 KiB) Downloaded 896 times
User avatar
phoenix
Site Admin
Posts: 526
Joined: Dec 29 2007, 16:27

Re: Google Docs Viewer 在线阅读

Post by phoenix »

Google Docs Viewer 支持更多格式了,更新一下。

Code: Select all

[Patterns]
Name = "Add Google Docs Viewer 2011.02.18 [phoenix]"
Active = TRUE
Bounds = "<a\s*</a>"
Limit = 256
Match = "\1&*href=$AV((http://(^docs.google.com)*"
        ".(ai|doc|docx|dxf|eps|pages|pdf|ppt|pptx|ps|psd|svg|tiff|ttf|xls|xlsx|xps))\2)"
Replace = "\1 <a title="Google Docs Viewer" href="http://docs.google.com/viewer?url=$ESC(\2)"><img src="http://docs.google.com/favicon.ico"></a>"
Post Reply