diff options
author | teramako | 2008-04-08 08:43:40 +0000 |
---|---|---|
committer | teramako | 2008-04-08 08:43:40 +0000 |
commit | 1f4c3d7cdadb776193c63d296aea7360ab654189 (patch) | |
tree | 211df2a8446de6e99c831a44e74382c015e9a2e2 /ime_controller.js | |
parent | 24c330777ce5dfbe2bd863e598781d9be7280be0 (diff) | |
download | vimperator-plugins-1f4c3d7cdadb776193c63d296aea7360ab654189.tar.bz2 |
lang/javascript/vimperator-plugins/trunk/ime_controller.js: add
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@9127 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'ime_controller.js')
-rw-r--r-- | ime_controller.js | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/ime_controller.js b/ime_controller.js new file mode 100644 index 0000000..8c50025 --- /dev/null +++ b/ime_controller.js @@ -0,0 +1,58 @@ +/** + * ==VimperatorPlugin== + * @name IME Controller Lite + * @description controll ime at into commandline-mode + * @description-ja コマンドラインモード移行時にIMEの制御を行う + * @author teramako teramako@gmail.com + * @namespace http://d.hatena.ne.jp/teramako/ + * @maxVersion 0.6pre + * @minVersion 0.6pre + * ==/VimperatorPlugin== + * + * Please set g:ex_ime_mode value. + * ex). + * :let g:ex_ime_mode = "inactive" + * + * available value is + * "auto" : No change + * "active" : Initially IME on + * "inactive" : Initially IME off + * "disabled" : Disable IME + * + * more detail: see http://developer.mozilla.org/en/docs/CSS:ime-mode + * + * default value is "inactive" + * + * TODO: 将来的にTEXTAREAモード時にもIMEのON/OFF切り替え機能をつける + */ + +if(!liberator.plugins) vimperator.plugins = {}; +liberator.plugins.imeController = (function(){ + var inputElement = document.getAnonymousElementByAttribute( + document.getElementById('liberator-commandline-command'),'anonid','input' + ); + function preExec(target,name,func){ + var original = target[name]; + target[name] = function(){ + func.apply(this,arguments); + return original.apply(target,arguments); + } + } + if (!globalVariables.ex_ime_mode){ + globalVariables.ex_ime_mode = 'inactive'; + } + preExec(commandline,'open',function(){ + liberator.plugins.imeController.set(); + }); + return { + set: function(mode){ + if(!mode) mode = globalVariables.ex_ime_mode ? globalVariables.ex_ime_mode : 'inactive'; + inputElement.style.imeMode = mode; + }, + reset: function(){ + keyElement.setAttribute('oncommand', original); + inputElement.style.imeMode = 'auto'; + } + }; +})(); +// vim: sw=4 ts=4 et: |