/** * bookmarklet wo command ni suru plugin * * @author halt feits * @version 0.6.3 */ let PLUGIN_INFO = {NAME} convert bookmarklets to commands ブックマークレットをコマンドにする halt feits 0.6.3 2.0pre 2.0pre http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/commandBookmarklet.js bmlhatena-bookmark == GLOBAL VARIABLES == command_bookmarklet_prefix: This variable determines the prefix of a command name. == KNOWN ISSUES == When title has non-ASCII characters, it converts to unaccountable command. You should rewrite title of bookmarklet to ASCII characters, to escape this issue. ]]> bmlhatena-bookmark == GLOBAL VARIABLES == command_bookmarklet_prefix: コマンドの先頭に付加される文字列を規定します。 デフォルトは "bml" == KNOWN ISSUES == タイトルに ASCII 文字以外が含まれている場合、わけのわからないコマンドになります。 この問題を避けるためにブックマークレットのタイトルを ASCII 文字のみに書き換えることをおすすめします。 ]]> ; ( function () { let prefix = liberator.globalVariables.command_bookmarklet_prefix; if (prefix === undefined) prefix = 'bml'; let items = bookmarks.get('javascript:'); if (!items.length) { liberator.echoerr('No bookmarks set'); return; } items.forEach(function (item) { commands.addUserCommand( [toValidCommandName(item.title)], 'bookmarklet : ' + item.title, function () { liberator.open(item.url); }, { shortHelp: 'Bookmarklet' }, false ); }); function toValidCommandName(str) { str = prefix + escape(str.replace(/ +/g, '').toLowerCase()).replace(/[^a-zA-Z]+/g,''); return str.substr(0, str.length > 50 ? 50 : str.length); } } )(); // vim:sw=2 ts=2 et: ss='form'>
path: root/hatenabookmark_show.js
blob: e5ce846ec26c3ee6edfb4aa67f6e3a606c826b1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44