Mercurial > hg > rlgwebd
comparison rlgterm.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 | 2984604ce3e6 |
children | f8bb37f48d58 |
comparison
equal
deleted
inserted
replaced
75:2984604ce3e6 | 76:a497ecd116d9 |
---|---|
325 | 325 |
326 var charshifts = { '-': "5f", '=': "2b", '[': "7b", ']': "7d", '\\': "7c", | 326 var charshifts = { '-': "5f", '=': "2b", '[': "7b", ']': "7d", '\\': "7c", |
327 ';': "3a", '\'': "22", ',': "3c", '.': "3e", '/': "3f", '`': "7e" | 327 ';': "3a", '\'': "22", ',': "3c", '.': "3e", '/': "3f", '`': "7e" |
328 } | 328 } |
329 | 329 |
330 var kpkeys = { "KP1": "1b4f46", "KP2": "1b4f42", "KP3": "1b5b367e", | |
331 "KP4": "1b4f44", "KP5": "1b5b45", "KP6": "1b4f43", | |
332 "KP7": "1b4f48", "KP8": "1b4f41", "KP9": "1b5b357e" }; | |
333 | |
330 function vkey(c) { | 334 function vkey(c) { |
331 if (!session.playing) | 335 if (!session.playing) |
332 return; | 336 return; |
333 var keystr; | 337 var keystr; |
334 if (c.match(/^[a-z]$/)) { | 338 if (c.match(/^[a-z]$/)) { |
360 else if (c in charshifts) { | 364 else if (c in charshifts) { |
361 if (termemu.shiftp()) | 365 if (termemu.shiftp()) |
362 keystr = charshifts[c]; | 366 keystr = charshifts[c]; |
363 else | 367 else |
364 keystr = c.charCodeAt(0).toString(16); | 368 keystr = c.charCodeAt(0).toString(16); |
369 } | |
370 else if (c in kpkeys) { | |
371 keystr = kpkeys[c]; | |
365 } | 372 } |
366 else | 373 else |
367 return; | 374 return; |
368 var datareq = new XMLHttpRequest(); | 375 var datareq = new XMLHttpRequest(); |
369 var msgDict = {"id": session.id, "t": "d", "n": nsend++, "d": keystr}; | 376 var msgDict = {"id": session.id, "t": "d", "n": nsend++, "d": keystr}; |
758 document.getElementById("register").style.display = "block"; | 765 document.getElementById("register").style.display = "block"; |
759 document.getElementById("current").style.display = "none"; | 766 document.getElementById("current").style.display = "none"; |
760 } | 767 } |
761 } | 768 } |
762 | 769 |
763 function toggledebug() { | 770 function toggleBlock(id) { |
764 if (document.getElementById("debug").style.display != "block") | 771 var element = document.getElementById(id); |
765 document.getElementById("debug").style.display = "block"; | 772 if (!element) |
773 return; | |
774 if (element.style.display != "block") | |
775 element.style.display = "block"; | |
766 else | 776 else |
767 document.getElementById("debug").style.display = "none"; | 777 element.style.display = "none"; |
768 } | 778 } |
769 | 779 |
770 function debug(level, msg) { | 780 function debug(level, msg) { |
771 if (level < debugSuppress) | 781 if (level < debugSuppress) |
772 return; | 782 return; |