From 0ef5cb723237024669511233e9304f919bcb267c Mon Sep 17 00:00:00 2001 From: anekos Date: Tue, 2 Mar 2010 19:59:29 +0000 Subject: fmapc と funmap の仕様修正 git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@36909 d0d07461-0603-4401-acd4-de1884942a52 --- feedSomeKeys_3.js | 46 ++++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 24 deletions(-) (limited to 'feedSomeKeys_3.js') diff --git a/feedSomeKeys_3.js b/feedSomeKeys_3.js index f0285ee..8402871 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.4.0 + 1.4.1 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,28 +277,16 @@ let INFO = function (values) (values && !values.some(function (value) !list.some(function (event) event === value))); - function clear (patternOrUrl) { + function unmap (filter, patternOrUrl, ignoreUrls) { let mode = modes.NORMAL; mappings._user[mode] = [ map for each (map in mappings._user[mode]) - if ( - !map.feedSomeKeys || - (patternOrUrl && !mappings._matchingUrlsTest(map, patternOrUrl)) - ) - ]; - } - - function unmap (filter, patternOrUrl) { - let mode = modes.NORMAL; - mappings._user[mode] = [ - map - for each (map in mappings._user[mode]) - if ( - !map.feedSomeKeys || - (filter && filter !== map.names[0]) || - (!mappings._matchingUrlsTest(map, patternOrUrl)) - ) + if (!( + map.feedSomeKeys && + (!filter || filter === map.names[0]) && + (ignoreUrls || mappings._matchingUrlsTest(map, patternOrUrl)) + )) ]; } @@ -442,11 +430,17 @@ let INFO = 'Clear fmappings', function (args) { let urls = args['-urls']; - clear(urls && RegExp(urls)); + if (args.bang) { + unmap(null, null, true); + } else { + unmap(null, urls && RegExp(urls), args['-ignoreurls']); + } }, { + bang: true, options: [ - [['-urls', '-u'], commands.OPTION_STRING, regexpValidator, urlCompleter] + [['-urls', '-u'], commands.OPTION_STRING, regexpValidator, urlCompleter], + [['-ignoreurls', '-iu'], commands.OPTION_STRING, regexpValidator, urlCompleter] ] }, true @@ -457,12 +451,16 @@ let INFO = 'Remove fmappings', function (args) { let urls = args['-urls']; - unmap(args.literalArg, urls && RegExp(urls)); + let name = args.literalArg; + if (!name) + return liberator.echoerr('E471: Argument required'); + unmap(name, urls && RegExp(urls), args['-ignoreurls']); }, { literal: 0, options: [ - [['-urls', '-u'], commands.OPTION_STRING, regexpValidator, urlCompleter] + [['-urls', '-u'], commands.OPTION_STRING, regexpValidator, urlCompleter], + [['-ignoreurls', '-iu'], commands.OPTION_STRING, regexpValidator, urlCompleter] ], completer: fmapCompleter }, -- cgit v1.2.3