diff options
author | anekos | 2010-02-09 20:35:34 +0000 |
---|---|---|
committer | anekos | 2010-02-09 20:35:34 +0000 |
commit | c085477091db5e1abadf6f59588312b5491a80ce (patch) | |
tree | fffeeb376ff3cf214a9e5b3acf4e16a8527619ac /morse.js | |
parent | 5c7ad1ebd7f150feee3ca70bacf42d6e2763e1f2 (diff) | |
download | vimperator-plugins-c085477091db5e1abadf6f59588312b5491a80ce.tar.bz2 |
文字毎に間を開けるように
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@36662 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'morse.js')
-rwxr-xr-x | morse.js | 19 |
1 files changed, 9 insertions, 10 deletions
@@ -210,6 +210,7 @@ let INFO = ctypes.void_t, ctypes.uint8_t, ctypes.uint8_t, ctypes.int32_t, ctypes.int32_t ); + let [short, long, interval] = [100, 400, 200]; function u (string) unescape(encodeURIComponent(string)); @@ -221,15 +222,15 @@ let INFO = keybd_event(0x91, 0x45, 3, 0); } - function bong () { - _bing(); - setTimeout(function () (next && next()), interval); - } - return function () { - let time = ch == '.' ? short : long; - _bing(); - setTimeout(bong, time); + if (ch == ' ') + return setTimeout(next, interval); + liberator.log(ch == '.' ? short : long); + _bing(); + setTimeout( + function () (_bing(), setTimeout(next, interval)), + ch == '.' ? short : long + ); }; } @@ -243,8 +244,6 @@ let INFO = return function (codes) bings(codes)(); } - - let morse = Morse(100, 500, 100); function toCode (text) Array.slice(text).map(function (c) codeTable[c.toLowerCase()] || '').join(' '); |