vimperator2.0preで動くようにhatenabookmark_show.jsを直してみた
直したのは、
- liberaotr.hogehoge を liberator.modules.hogehoge に
- コマンドのargが文字列じゃなくなったっぽいので、arg.toString()で文字列を取り出すように
- encodeURIComponent()を使わないように
ってとこくらい。
Index: hatenabookmark_show.js =================================================================== --- hatenabookmark_show.js (リビジョン 26319) +++ hatenabookmark_show.js (作業コピー) @@ -3,7 +3,7 @@ // License: Creative Commons // Maintainer: Trapezoid <trapezoid.g@gmail.com> - http://unsigned.g.hatena.ne.jp/Trapezoid // -// show hatena bookmark comments script for Vimperator 0.6 +// show hatena bookmark comments script for Vimperator 2.0pre (function(){ function showComments(url){ @@ -26,17 +26,17 @@ showString += tagString + (bookmark.tags.length > 0 && bookmark.comment ? "<br/> ":"") + bookmark.comment + "</dd>"; }); showString += "</dl></div>"; - liberator.commandline.echo(showString, liberator.commandline.HL_NORMAL, liberator.commandline.FORCE_MULTILINE); + liberator.modules.commandline.echo(showString, liberator.modules.commandline.HL_NORMAL, liberator.modules.commandline.FORCE_MULTILINE); } - liberator.commands.addUserCommand(["hbinfo"], "show hatena bookmark comments", + liberator.modules.commands.addUserCommand(["hbinfo"], "show hatena bookmark comments", function(arg,special){ var clipboard = readFromClipboard(); if(special) arg = window.content.document.getSelection() || clipboard; - showComments(arg?encodeURIComponent(arg):liberator.buffer.URL); - },{ completer: liberator.completion.url } + showComments(arg.toString() || liberator.modules.buffer.URL); + },{ completer: liberator.modules.completion.url } ); - liberator.mappings.addUserMap([liberator.modes.VISUAL], [",h"], "show hatena bookmark comments", + liberator.modules.mappings.addUserMap([liberator.modules.modes.VISUAL], [",h"], "show hatena bookmark comments", function(count){ showComments(window.content.document.getSelection()); },{ noremap: true }
ああ、今夜こそCodeReposのアカウント申請しよ。
追記:2008.12.19
vimpの更新履歴をざっとみたところ、arg.toString()じゃなくてarg.stringでいいみたい。