From 4b1d70935f7501dc53262e5fd0267734667dc9b2 Mon Sep 17 00:00:00 2001 From: anekos Date: Mon, 1 Mar 2010 12:22:09 +0000 Subject: Migemo フレンドリーにした。 git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@36877 d0d07461-0603-4401-acd4-de1884942a52 --- option-selector.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'option-selector.js') diff --git a/option-selector.js b/option-selector.js index ab90ead..8b52686 100755 --- a/option-selector.js +++ b/option-selector.js @@ -1,5 +1,5 @@ /* NEW BSD LICENSE {{{ -Copyright (c) 2009, anekos. +Copyright (c) 2009-2010, anekos. All rights reserved. Redistribution and use in source and binary forms, with or without modification, @@ -38,7 +38,7 @@ let PLUGIN_INFO = Option Selector Select a option of the select element. select 要素の option を選択する。 - 1.0.1 + 1.1.0 anekos new BSD License (Please read the source code comments of this plugin) 修正BSDライセンス (ソースコードのコメントを参照してください) @@ -63,7 +63,7 @@ let PLUGIN_INFO = ['selectoption'], 'Select a option of the select element', function (args) { - targetElement.value = args.string; + targetElement.selectedIndex = parseInt(args[0], 10); let event = content.document.createEvent('Event'); event.initEvent('change', true, true); targetElement.dispatchEvent(event); @@ -77,8 +77,10 @@ let PLUGIN_INFO = return; context.title = ['value', 'text']; - context.completions = - util.map(util.Array.itervalues(elem.options), function (opt) [opt.value, opt.textContent]); + context.completions = [ + [[n + ': ' + s for each (s in [opt.textContent, opt.value])], opt.textContent] + for ([n, opt] in Iterator(Array.slice(elem.options))) + ]; } }, true -- cgit v1.2.3