diff options
author | anekos | 2010-04-10 15:16:47 +0000 |
---|---|---|
committer | anekos | 2010-04-10 15:16:47 +0000 |
commit | 669b8a5676a6ebf9212acfc22c4d5a01a85e1f89 (patch) | |
tree | 7aed46a5aa604a524c03acb6fffef979d9e53269 /option-selector.js | |
parent | 5d5e1c32fc054adb323b879da3b4a1874974ea02 (diff) | |
download | vimperator-plugins-669b8a5676a6ebf9212acfc22c4d5a01a85e1f89.tar.bz2 |
変則的なコマンドの利用をやめる
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@37181 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'option-selector.js')
-rwxr-xr-x | option-selector.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/option-selector.js b/option-selector.js index 8b52686..2ee38c9 100755 --- a/option-selector.js +++ b/option-selector.js @@ -38,7 +38,7 @@ let PLUGIN_INFO = <name>Option Selector</name> <description>Select a option of the select element.</description> <description lang="ja">select 要素の option を選択する。</description> - <version>1.1.0</version> + <version>1.1.1</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> @@ -56,21 +56,19 @@ let PLUGIN_INFO = (function () { - { - let targetElement = null; + function select () { + let targetElement = buffer.lastInputField; - commands.addUserCommand( - ['selectoption'], - 'Select a option of the select element', - function (args) { - targetElement.selectedIndex = parseInt(args[0], 10); + commandline.input( + 'Select a option of the select element: ', + function (arg) { + targetElement.selectedIndex = parseInt(arg, 10); let event = content.document.createEvent('Event'); event.initEvent('change', true, true); targetElement.dispatchEvent(event); targetElement.focus(); }, { - literal: 0, completer: function (context, args) { let elem = targetElement = buffer.lastInputField; if (!elem) @@ -82,9 +80,9 @@ let PLUGIN_INFO = for ([n, opt] in Iterator(Array.slice(elem.options))) ]; } - }, - true + } ); + events.feedkeys('<Tab>', true); // FIXME } autocommands.add( @@ -95,7 +93,7 @@ let PLUGIN_INFO = let action = mapping.action; mapping.action = function () { if (buffer.lastInputField instanceof HTMLSelectElement) - commandline.open(':', 'selectoption ', modes.EX) + select() else action.apply(action, arguments); }; |