Mercurial > hg > rlgwebd
comparison shterm.js @ 76:a497ecd116d9
Improvements to the keyboard.
Add a number pad to the keyboard. Make it hidden by default for
RLG-Web.
author | John "Elwin" Edwards <elwin@sdf.org> |
---|---|
date | Sat, 23 Jun 2012 17:11:51 -0700 |
parents | d7eb63cd7a16 |
children | 789c094675f4 |
comparison
equal
deleted
inserted
replaced
75:2984604ce3e6 | 76:a497ecd116d9 |
---|---|
258 | 258 |
259 var charshifts = { '-': "5f", '=': "2b", '[': "7b", ']': "7d", '\\': "7c", | 259 var charshifts = { '-': "5f", '=': "2b", '[': "7b", ']': "7d", '\\': "7c", |
260 ';': "3a", '\'': "22", ',': "3c", '.': "3e", '/': "3f", '`': "7e" | 260 ';': "3a", '\'': "22", ',': "3c", '.': "3e", '/': "3f", '`': "7e" |
261 } | 261 } |
262 | 262 |
263 var kpkeys = { "KP1": "1b4f46", "KP2": "1b4f42", "KP3": "1b5b367e", | |
264 "KP4": "1b4f44", "KP5": "1b5b45", "KP6": "1b4f43", | |
265 "KP7": "1b4f48", "KP8": "1b4f41", "KP9": "1b5b357e" }; | |
266 | |
263 function vkey(c) { | 267 function vkey(c) { |
264 var keystr; | 268 var keystr; |
265 if (c.match(/^[a-z]$/)) { | 269 if (c.match(/^[a-z]$/)) { |
266 if (termemu.ctrlp()) { | 270 if (termemu.ctrlp()) { |
267 var n = c.charCodeAt(0) - 96; | 271 var n = c.charCodeAt(0) - 96; |
291 else if (c in charshifts) { | 295 else if (c in charshifts) { |
292 if (termemu.shiftp()) | 296 if (termemu.shiftp()) |
293 keystr = charshifts[c]; | 297 keystr = charshifts[c]; |
294 else | 298 else |
295 keystr = c.charCodeAt(0).toString(16); | 299 keystr = c.charCodeAt(0).toString(16); |
300 } | |
301 else if (c in kpkeys) { | |
302 keystr = kpkeys[c]; | |
296 } | 303 } |
297 else | 304 else |
298 return; | 305 return; |
299 //writeData("Sending " + keystr); | 306 //writeData("Sending " + keystr); |
300 var formdata = {"t": "d", "n": nsend++, "d": keystr}; | 307 var formdata = {"t": "d", "n": nsend++, "d": keystr}; |