常用的3个bookmarklet: Mt it + del.icio.us it + FlickR it


MovableType/FlickR/del.icio.us是我最常用的3个blog工具:MT用于写一些篇幅稍长的文章,del.icio.us是link blog,用于收藏随时看到的网页资料,FlickR是图片blog,用于看图说话。

而这3个服务恰好都被FeedBurner支持:形成了一个我的个人专辑

这3个服务都不约而同的提供了方便的JavaScipt快捷键,称之为:bookmarklet。将他们的添加到链接栏上以后,可以将当成一个发布/编辑快捷键使用:可以将当前网页的标题/链接/图片转贴到del.icio.us/mt/flickr上。后2个服务我都是在安装并熟悉使用了bookmarklet后,才开始大量使用的,看来发布的易用性是决定用户使用频度的关键因素。

del.icio.us it
delicious-it.png
安装位于张贴URL界面下面:http://del.icio.us/post/,而且不止一个,还有很多组合。

Hacking: 原来的bookmarklet有一个IE的escape函数对多字节缺省使用Unicode方式导致的问题(目前已经解决)
javascript:location.href='http://del.icio.us/chedong?url='+escape(location.href)+'&title='+escape(document.title)
比如收藏标题为中文的时候:中文在IE中缺省被编码成为%u4EBA
http://del.icio.us/chedong?url=http%3A//www.chedong.com/blog/archives/000646.html&title=Lilina%uFF1ARSS%u805A%u5408%u5668%u6784%u5EFA%u4E2A%u4EBA%u95E8%u6237%28Write%20once%2C%20publish%20anywhere%29
而del.icio.us在服务器端又没有很好的解析,所以标题成了Lilina%uFF1ARSS%u805A%u5408%u5668%u6784%u5EFA%u4E2A%u4EBA%u95E8%u6237%28Write%20once%2C%20publish%20anywhere%29

正确的解决方法是用encodeURI代替escape函数:这个函数从IE 5.5+ Mozilla开始支持:
javascript:location.href='http://del.icio.us/chedong?url='+escape(location.href)+'&title='+encodeURI(document.title)

这样看到的中文标题就是:%EF%BC 这样的双字节编码了,del.icio.us会在服务器端urldecode回来
http://del.icio.us/chedong?url=http%3A//www.chedong.com/blog/archives/000646.html&title=Lilina%EF%BC%9ARSS%E8%81%9A%E5%90%88%E5%99%A8%E6%9E%84%E5%BB%BA%E4%B8%AA%E4%BA%BA%E9%97%A8%E6%88%B7(Write%20once,%20publish%20anywhere)

del.icio.us的网页标题/扩展部分的评论注释在250个字节内,我一般尽量充分利用这2个区域。希望别人看到时也能尽量多的得到一些辅助信息。

MT it
mt-it.png

安装:在主菜单的右下角,mt.cgi?__mode=bookmarklets 称之为QuickPost
QuickPost
Setting up QuickPost to post to Movable Type allows you to perform one-click posting and publishing without ever entering through the main Movable Type interface.

为什么同样使用escape函数,del.icio.us中的问题在MT中没有出现呢?MT it的代码如下:
javascript:d=document;w=window;t='';if(d.selection){t=d.selection.createRange().text}else%20if(d.getSelection){t=d.getSelection()}else%20if(w.getSelection){t=w.getSelection();}void(w.open('http://www.chedong.com/cgi-bin/mt/mt.cgi?is_bm=1&bm_show=category,excerpt,text_more&__mode=view&_type=entry&link_title='+escape(d.title)+'&link_href='+escape(d.location.href)+'&text='+escape(t),'_blank','scrollbars=yes,width=400,height=650,status=yes,resizable=yes,scrollbars=yes'))

我在MT的代码中找到了答案:MT是在服务器端进行URLDecode处理时,能够对%u4EBA这样的编码进行识别 具体位于:extlib/CGI/Util.pm
# unescape URL-encoded data
sub unescape {
shift() if @_ > 1 and (ref($_[0]) || (defined $_[1] && $_[0] eq $CGI::DefaultClass));
my $todecode = shift;
return undef unless defined($todecode);
$todecode =~ tr/+/ /; # pluses become spaces
$EBCDIC = "\t" ne "\011";
if ($EBCDIC) {
$todecode =~ s/%([0-9a-fA-F]{2})/chr $A2E[hex($1)]/ge;
} else {
$todecode =~ s/%(?:([0-9a-fA-F]{2})|u([0-9a-fA-F]{4}))/
defined($1)? chr hex($1) : utf8_chr(hex($2))/ge;
}
return $todecode;
}

FlickR it
flickr-it.png
FlickR的Bookmarklet隐藏最深:位于Account >> Uploading Tools >> 右下角的"Send To Flickr" Bookmarklet

FlickR it能将当前页面中所有的图片剥离出来,让你点选图片后即可上传到FlickR:强啊……
javascript:t='';for(var n=0;n<document.images.length;n++){t+='<a href=/ onclick=\'document.f.url.value=document.images['+n+'].src;document.f.submit();return false;\'><img border=0 src='+document.images[n].src+'></a><br>'};if(t!=''){document.write('<p>Click an image to add it to your photostream</p><form name=f action=http://www.flickr.com/tools/sendto.gne method=get><input type=hidden name=url></form>'+t+'');void(document.close())}else{alert('No images!')}

参考:
escape() encodeURI() 和 encodeURIComponent()的比较

作者:车东 发表于:2005-05-29 00:05 最后更新于:2007-04-15 19:04
版权声明:可以转载,转载时请务必以超链接形式标明文章 的原始出处和作者信息及本版权声明

Comments

flickr的那个功能的确好,图片上传得速度也非常快
如果能一步提交多个图片并且同时可以加入tag就更棒了

flickr的bookmarklet不能图片命名是很大的遗憾,在flickr里,我还是喜欢用那个XP的发送到WEB注册表工具.

至少学了几个javascript,分析得很好!

你好,车东
借这里问一下关于MovableType.
前几天在安装 MT, 一切设置步骤似乎都没问题。但到最后总是模版加载不上来。在运行mt-load.cgi 后,总是提示Can't find default template list; where is 'default-templates.pl'?

我反复检查了这个文件,确实是存在于那个文件夹,检查了文件名大小写、以及FTP上传模式等等,都没问题,但就是提示找不到模版。

我搜索了Google, 发现很多人有同样问题,如果搜索“Can't find default template list; where is 'default-templates.pl'” 这句话,会出来很多结果,但都没有给出明确解决办法。有的说 figure it out, 但怎么解决的却没说。


这是一个同样问题的帖子:
When running mt-load.cgi, you get the following error message:

An error occurred while loading data:

Can't find default template list; where is 'default-templates.pl'?

Solution

Make sure that lib/MT/default-templates.pl was uploaded to your server, and in AsciiMode.

The files are also case sensitive, so make sure it is lib/MT/default-templates.pl, not lib/mt/default-templates.pl, or Lib/Mt/Default-templates.pl.


中文也搜索了,但好像大家没有类似问题,没搜到相关内容。

能否看一下怎么回事呢?
Thanks!

回复:Jesse:
一个安装备忘 http://www.chedong.com/blog/archives/000001.html

车东

受益良多
现在才知道flickr还有bookmark的

flickr的bookmarklet不能改title和tag比较郁闷,这点上明显不如wists

回复: Tangos
大家玩的都够深的啊……

车东

车东同志,你好。我通过google搜索到你写的这些知识。基本上都看不懂。我想请教一个问题。在使用一些bookmarklet时,总要等着两个网页依次打开。相当的不方便,尤其是在使用在线翻译时,这种缺点更明显。仿佛没有一点优势。请问有没有解决的办法。如果有的话,麻烦给我解决一下。多谢!

"后2个服务我都是在安装并熟悉使用了bookmarklet后,才开始大量使用的,看来发布的易用性是决定用户使用频度的关键因素。"

我现在也是在链接栏加上post to Del.icio.us和Sub with Bloglines以后才经常使用他们的.

最喜欢这种能提高工作效率的文章了. bookmark该页, 现在凌晨5点, 太累了, 睡后接着看.

发表一个评论

(如果你此前从未在此 Blog 上发表过评论,则你的评论必须在 Blog 主人验证后才能显示,请你耐心等候。)