Article View: cn.comp.hacker
Article #13284油猴脚本Twitter Picture Preview支持中文推特圈、官方Twitter
From: RSS Feed For GFW Blog
Date: Thu, 15 Oct 2009 01:19
Date: Thu, 15 Oct 2009 01:19
43 lines
4634 bytes
4634 bytes
来源:[http://apt-blog.net/newer_script_twitter_picture_preview][1]
[1]: http://apt-blog.net/newer_script_twitter_picture_preview
### [油猴脚本:Twitter Picture Preview][2]
[2]: http://userscripts.org/scripts/show/55788
Feature: Adding preview thumbs right after a short url to an popular image-service site in twitter.
功能:给twitter内包含指向图片服务的网址加上该图片的缩略图。
客户端支持/Client Supports:
[twitter.com][3] / [itweet.net][4] / [twitese.appspot.com][5]
[3]: http://twitter.com
[4]: http://itweet.net
[5]: http://twitese.appspot.com
图片服务支持/Image-Service Supports:
twitpic / [flic.kr][6] / [moby.to][7] / yfrog / [ts1.in][8] / [hellotxt.com][9] / [twitxr.com][10] / [twitgoo.com][11]
[6]: http://flic.kr
[7]: http://moby.to
[8]: http://ts1.in
[9]: http://hellotxt.com
[10]: http://twitxr.com
[11]: http://twitgoo.com
维护了一下之前写的[油猴脚本:Twitpic in
itweet][12],从另外一个相同功能的脚本[TwitterPhotoShow][13]的代码,通过监控items容器的DOM的事件DOMNodeInserted、DOMSubtreeModified来相应内容的变化,这样就可以把原来的定时器什么一大堆的代码去掉了;
[12]: http://apt-blog.net/twitpic_in_itweet
[13]: http://userscripts.org/scripts/show/56189
同时利用了一下javascript的对象特性,原先的代码可能看起来还跟C类似的,重写一下语法看起来好像差很远了……改写的好处是添加新的图片服务处理就容易多了。比如一个处理器是这么写的:
1
2
3
4
5
6
7
img_processor['ts1in'] = {
reg: /ts1\.in\/(\d+)/,
func:function (url_key, url_elem) {
var src = "[http://ts1.in/thumb/][14]" + url_key[1];
append_image (src, url_elem);
}
};
[14]: http://ts1.in/thumb/
所以新版里面添加了一大堆从[TwitterPhotoShow][15]里面抄来,我都没见过的图片服务;虽然TwitterPhotoShow没有支持最近在推上很流行的flickr跟[moby.to][16],可能因为api相对麻烦一点吧!
[15]: http://userscripts.org/scripts/show/56189
[16]: http://moby.to
敬请订阅我们:http://feeds2.feedburner.com/chinagfwblog,在twitter跟随我们:http://twitter.com/cdt。翻墙工具介绍和下载:http://www.sesawe.org/和http://www.sesawwe.net/。![][17]
[17]: https://blogger.googleusercontent.com/tracker/5500297126185736776-1449972346783423626?l=www.chinagfw.org
Contentes HTML URL: http://www.chinagfw.org/2009/10/twitter-picture-previewtwitter.html
Send By Feed RSS2eMail BOT V2.65
Admin By Liuxing99
Technical Details
Message-ID:
<4ad6b22f@news.liuxing99.3322.org>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!Xbb.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!61.160.212.82.MISMATCH!www.shinco.com!news.liuxing99.3322.org!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 85629cb6ee,c72abe6ba83b1d2a,start X-Google-Attributes: gid85629cb6ee,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,GB Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!Xbb.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!61.160.212.82.MISMATCH!www.shinco.com!news.liuxing99.3322.org!not-for-mail From: RSS Feed For GFW Blog <gfwblog-list@szb66.vicp.net> Newsgroups: cn.comp.hacker Subject: 油猴脚本Twitter Picture Preview支持中文推特圈、官方Twitter Date: Thu, 15 Oct 2009 01:19:00 -0000 Organization: A poorly-installed InterNetNews site Lines: 43 Message-ID: <4ad6b22f@news.liuxing99.3322.org> NNTP-Posting-Host: 58.208.7.115 Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: base64 X-Trace: www.shinco.com 1255584324 9742 58.208.7.115 (15 Oct 2009 05:25:24 GMT) X-Complaints-To: news@www.shinco.com NNTP-Posting-Date: Thu, 15 Oct 2009 05:25:24 +0000 (UTC) Received-Path: <gfwblog-list@szb66.vicp.net> X-Feed-By: news.liuxing99.3322.org User-Agent: Feed RSS2eMail BOT V2.65 X-Gateway-Administrator: bianlule@bianlule.3322.org X-Gateway-From: dnews-gateway@news.liuxing99.3322.org