From 581303a74e5ffa2990a59ee5f8474ac5fc233a93 Mon Sep 17 00:00:00 2001 From: anekos Date: Tue, 2 Mar 2010 19:03:32 +0000 Subject: fmapc を実装 git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@36907 d0d07461-0603-4401-acd4-de1884942a52 --- feedSomeKeys_3.js | 50 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 9 deletions(-) (limited to 'feedSomeKeys_3.js') diff --git a/feedSomeKeys_3.js b/feedSomeKeys_3.js index 6cd5b8b..29772d4 100755 --- a/feedSomeKeys_3.js +++ b/feedSomeKeys_3.js @@ -39,7 +39,7 @@ let PLUGIN_INFO = feedSomeKeys 3 feed some defined key events into the Web content キーイベントをWebコンテンツ側に送る - 1.2.0 + 1.3.0 anekos new BSD License (Please read the source code comments of this plugin) 修正BSDライセンス (ソースコードのコメントを参照してください) @@ -79,7 +79,7 @@ lazy fmaps -u='http://code.google.com/p/vimperator-labs/issues/detail' u // }}} // INFO {{{ let INFO = - @@ -277,18 +277,27 @@ let INFO = function (values) (values && !values.some(function (value) !list.some(function (event) event === value))); - function list (filter) { + function clear (filter) { + let mode = modes.NORMAL; + mappings._user[mode] = [ + map + for each (map in mappings._user[mode]) + if (!map.feedSomeKeys) + ]; + } + + function gets (filter) { if (filter) filter = mappings._expandLeader(filter); - - liberator.log(filter); - - let maps = [ + return [ map for (map in mappings._mappingsIterator([modes.NORMAL], mappings._user)) if (map.feedSomeKeys && (!filter || map.names[0] == filter)) ]; + } + function list (filter) { + let maps = gets(filter); let template = modules.template; let list = @@ -303,7 +312,6 @@ let INFO = }
; - // TODO: Move this to an ItemList to show this automatically if (list.*.length() == list.text().length()) { liberator.echomsg("No mapping found"); return; @@ -383,12 +391,36 @@ let INFO = ].concat( multi ? [[['-separator', '-s'], commands.OPTION_STRING]] : [] - ) + ), + completer: function (context, args) { + if (multi) + return; + if (args.length > 1) + return; + context.title = ['name', 'rhs & url']; + context.completions = [ + [ + map.names[0], + map.feedSomeKeys.rhs + ' for ' + (map.matchingUrls ? map.matchingUrls : 'Global') + ] + for each (map in gets()) + ]; + } }, true ); }); + commands.addUserCommand( + ['fmapc'], + 'Clear fmappings', + function () { + clear(); + }, + {}, + true + ); + plugins.libly.$U.around( mappings, 'getCandidates', -- cgit v1.2.3