diff options
author | anekos | 2010-03-04 14:34:31 +0000 |
---|---|---|
committer | anekos | 2010-03-04 14:34:31 +0000 |
commit | 2463ff2c08f9fa685cd50f1e6515c1e2e53893d5 (patch) | |
tree | dc115f2a15a7080bbb3c1f91bdb068b9d2cd1006 /feedSomeKeys_3.js | |
parent | d7b00958fb2b37c20159c67d3bbc7fea4646f969 (diff) | |
download | vimperator-plugins-2463ff2c08f9fa685cd50f1e6515c1e2e53893d5.tar.bz2 |
URLの補完候補に現在のバッファのURLとドメインを追加
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@36933 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'feedSomeKeys_3.js')
-rwxr-xr-x | feedSomeKeys_3.js | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/feedSomeKeys_3.js b/feedSomeKeys_3.js index c7736fd..fec1544 100755 --- a/feedSomeKeys_3.js +++ b/feedSomeKeys_3.js @@ -39,7 +39,7 @@ let PLUGIN_INFO = <name lang="ja">feedSomeKeys 3</name> <description>feed some defined key events into the Web content</description> <description lang="ja">キーイベントをWebコンテンツ側に送る</description> - <version>1.6.1</version> + <version>1.7.0</version> <author mail="anekos@snca.net" homepage="http://d.hatena.ne.jp/nokturnalmortum/">anekos</author> <license>new BSD License (Please read the source code comments of this plugin)</license> <license lang="ja">修正BSDライセンス (ソースコードのコメントを参照してください)</license> @@ -477,14 +477,21 @@ let INFO = <> ]; } - function urlCompleter (context, args) { - let maps = findMappings({all: true}); - let uniq = {}; - return [ - (uniq[map.matchingUrls] = 1, [map.matchingUrls.source, map.names]) - for each (map in maps) - if (map.matchingUrls && !uniq[map.matchingUrls]) - ]; + function urlCompleter ({currentURL}) { + return function (context, args) { + let maps = findMappings({all: true}); + let uniq = {}; + let result = [ + (uniq[map.matchingUrls] = 1, [map.matchingUrls.source, map.names]) + for each (map in maps) + if (map.matchingUrls && !uniq[map.matchingUrls]) + ]; + if (currentURL) { + result.unshift([util.escapeRegex(buffer.URL), 'Current URL']); + result.unshift([util.escapeRegex(content.document.domain), 'Current domain']); + } + return result; + }; } @@ -556,7 +563,7 @@ let INFO = <> { literal: 0, options: [ - [['-urls', '-u'], commands.OPTION_STRING, regexpValidator, urlCompleter], + [['-urls', '-u'], commands.OPTION_STRING, regexpValidator, urlCompleter({currentURL: true})], [['-desc', '-description'], commands.OPTION_STRING], [['-frame', '-f'], commands.OPTION_INT], [ @@ -593,7 +600,7 @@ let INFO = <> bang: true, completer: function (context) { context.title = ['URL Pattern']; - context.completions = urlCompleter(context); + context.completions = urlCompleter({})(context); } }, true @@ -615,7 +622,7 @@ let INFO = <> { literal: 0, options: [ - [['-urls', '-u'], commands.OPTION_STRING, regexpValidator, urlCompleter], + [['-urls', '-u'], commands.OPTION_STRING, regexpValidator, urlCompleter({})], [['-ignoreurls', '-iu'], commands.OPTION_NOARG] ], completer: fmapCompleter |