2013-11-18 00:15:53 +04:00
|
|
|
(function () {
|
2013-11-19 02:53:12 +04:00
|
|
|
var specialKeys = {
|
2013-11-20 02:46:33 +04:00
|
|
|
191 : "?",
|
|
|
|
27 : "esc",
|
|
|
|
38 : "up",
|
|
|
|
40 : "down"
|
2013-11-19 02:53:12 +04:00
|
|
|
};
|
2013-11-18 00:15:53 +04:00
|
|
|
|
2013-11-18 01:07:26 +04:00
|
|
|
var ns = $.namespace('pskl.service.keyboard');
|
2013-11-18 00:15:53 +04:00
|
|
|
|
|
|
|
ns.KeycodeTranslator= {
|
|
|
|
toChar : function (keycode) {
|
|
|
|
if (keycode >= 48 && keycode <= 57) {
|
|
|
|
// key is 0-9
|
|
|
|
return (keycode - 48) + "";
|
|
|
|
} else if (keycode >= 65 && keycode <= 90) {
|
2013-11-20 02:46:33 +04:00
|
|
|
// key is a-z, use base 36 to get the string representation
|
2013-11-18 00:15:53 +04:00
|
|
|
return (keycode - 65 + 10).toString(36);
|
|
|
|
} else {
|
|
|
|
return specialKeys[keycode];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
})();
|