English Windows + Japanese keyboard + Firefox/IE/Safari/Chrome keyboard mapping

This commit is contained in:
Kelven Yang 2011-05-16 14:19:44 -07:00
parent 7bdaa210a1
commit 1ff550f4a6
2 changed files with 73 additions and 26 deletions

View File

@ -435,67 +435,81 @@ AjaxViewer.prototype = {
var charCodeMap = [];
var shiftedCharCodeMap = [];
shiftedKeyCodeMap[50] = { code: 222, shift: 1 } ; // EN 2/@ -> JP 2/"
shiftedKeyCodeMap[50] = { code: 222, shift: 1 } ; // JP SHIFT + 2 -> "
shiftedCharCodeMap[64] = { code: 34, shift: 1 };
shiftedKeyCodeMap[54] = { code: 55, shift : 1 }; // EN 6/^ -> JP 6/&
shiftedKeyCodeMap[54] = { code: 55, shift : 1 }; // JP SHIFT + 6 -> &
shiftedCharCodeMap[94] = { code: 38, shift : 1 };
shiftedKeyCodeMap[55] = { code: 222, shift : 0 }; // EN '/' -> JP 7/'
shiftedKeyCodeMap[55] = { code: 222, shift : 0 }; // JP SHIFT + 7 -> '
shiftedCharCodeMap[38] = { code: 39, shift : 0 };
shiftedKeyCodeMap[56] = { code: 57, shift : 1 }; // EN 9/'(' -> JP 8/(
shiftedKeyCodeMap[56] = { code: 57, shift : 1 }; // JP SHIFT + 8 -> (
shiftedCharCodeMap[42] = { code: 40, shift : 1 };
shiftedKeyCodeMap[57] = { code: 48, shift : 1 }; // EN 0/')' -> JP 9/)
shiftedKeyCodeMap[57] = { code: 48, shift : 1 }; // JP SHIFT + 9 -> )
shiftedCharCodeMap[40] = { code: 41, shift : 1 };
shiftedKeyCodeMap[48] = { code: 192, shift : 1 }; // EN `/~)' -> JP 0/~
shiftedKeyCodeMap[48] = { code: 192, shift : 1 }; // JP SHIFT + 0 -> ~
shiftedCharCodeMap[41] = { code: 126, shift : 1 };
keyCodeMap[107] = { code: 107, shift : 1, defer : true }; // JP NUM +
charCodeMap[43] = { code: 43, shift : 1, keyCode: 107 };
shiftedKeyCodeMap[109] = { code: 107, shift : 0 }; // JP SHIFT + (-=), keycode/charcode(109, 95) from Firefox
shiftedCharCodeMap[95] = { code: 61, shift : 0 };
// keyCodeMap[107] = { code: 54, shift : 1, defer : true }; // JP ^/_
charCodeMap[61] = { code: 94, shift : 1, keyCode: 54 };
shiftedKeyCodeMap[107] = { code: 109, shift : 1 };
shiftedCharCodeMap[43] = { code: 95, shift : 1 };
shiftedKeyCodeMap[109] = { code: 107, shift : 0 };
shiftedKeyCodeMap[189] = { code: 107, shift : 0 }; // JP SHIFT + (-=), keycode/charcode(109, 95) from Chrome/Safari/MSIE
shiftedCharCodeMap[95] = { code: 61, shift : 0 };
shiftedKeyCodeMap[255] = { code: 220, shift : 1, charCode: 124 }; // EN \/| -> JP |
if($.browser.mozilla) {
keyCodeMap[107] = { code: 107, shift : 1, defer : true }; // JP NUM +, keycode/charcode (107, 43) from Firefox
charCodeMap[43] = { code: 43, shift : 1, keyCode: 107 };
charCodeMap[61] = { code: 94, shift : 1, keyCode: 54 }; // JP (-^), keycode/charcode (107, 61) from Firefox
shiftedKeyCodeMap[107] = { code: 109, shift : 1 }; // JP SHIFT + (-^)
shiftedCharCodeMap[43] = { code: 95, shift : 1 };
} else {
keyCodeMap[187] = { code: 54, shift: 1}; // JP -^
charCodeMap[61] = { code: 94, shift: 1};
shiftedKeyCodeMap[187] = { code: 109, shift : 1 }; // JP SHIFT + (-^)
shiftedCharCodeMap[43] = { code: 95, shift : 1 };
}
keyCodeMap[219] = { code: 50, shift : 1 }; // EN 2/@' -> JP @/`
shiftedKeyCodeMap[255] = { code: 220, shift : 1, charCode: 124 }; // JP (|-, key before backspace)
keyCodeMap[219] = { code: 50, shift : 1 }; // JP @`
charCodeMap[91] = { code: 64, shift : 1 };
shiftedKeyCodeMap[219] = { code: 192, shift : 0 }; // EN `/~)' -> JP 0/~
shiftedKeyCodeMap[219] = { code: 192, shift : 0 }; // JP SHIFT + (@`)
shiftedCharCodeMap[123] = { code: 96, shift : 0 };
keyCodeMap[221] = { code: 219, shift : 0 }; // EN [/{' -> JP [/{
keyCodeMap[221] = { code: 219, shift : 0 }; // JP [{
charCodeMap[93] = { code: 91, shift : 0 };
shiftedKeyCodeMap[221] = { code: 219, shift : 1 };
shiftedCharCodeMap[125] = { code: 123, shift : 1 };
shiftedKeyCodeMap[59] = { code: 107, shift : 1 }; // EN =/+ -> JP ;/+
shiftedCharCodeMap[58] = { code: 43, shift : 1 };
keyCodeMap[222] = { code: 59, shift : 1 }; // EN ;/:' -> JP :/*
if($.browser.mozilla) {
shiftedKeyCodeMap[59] = { code: 107, shift : 1 }; // JP ;+
shiftedCharCodeMap[58] = { code: 43, shift : 1 };
} else {
shiftedKeyCodeMap[186] = { code: 107, shift : 1 }; // JP ;+
shiftedCharCodeMap[58] = { code: 43, shift : 1 };
}
keyCodeMap[222] = { code: 59, shift : 1 }; // JP :*
charCodeMap[39] = { code: 58, shift : 1 };
shiftedKeyCodeMap[222] = { code: 56, shift : 1 };
shiftedCharCodeMap[34] = { code: 42, shift : 1 };
keyCodeMap[220] = { code: 221, shift : 0 }; // EN ]/}' -> JP ]/}
keyCodeMap[220] = { code: 221, shift : 0 }; // JP ]}
charCodeMap[92] = { code: 93, shift : 0 };
shiftedKeyCodeMap[220] = { code: 221, shift : 1 };
shiftedCharCodeMap[124] = { code: 125, shift : 1 };
keyCodeMap[193] = { code: 220, shift : 0, charCode: 92 }; // EN ]/}' -> JP ]/}
keyCodeMap[193] = { code: 220, shift : 0, charCode: 92 }; // JP \-|
shiftedKeyCodeMap[193] = { code: 109, shift : 0, charCode : 45 };
keyCodeMap[106] = { code: 56, shift : 1 }; // JP NUM *
charCodeMap[42] = { code: 42, shift : 1 };
keyCodeMap[110] = { code: 190, shift : 0 }; // JP NUM .
charCodeMap[46] = { code: 46, shift : 0 };

View File

@ -54,6 +54,8 @@ Logger.prototype = {
open: function() {
if(this.logWin) {
this.logWin.show();
this.log(Logger.LEVEL_SYS, "Logger is open in browser: " + this.objectToString($.browser));
return;
}
@ -165,7 +167,7 @@ Logger.prototype = {
this.logWin.css("left", (($(document.body).width() - this.logWin.width()) / 2) + "px");
this.dockIn();
this.log(Logger.LEVEL_SYS, "Logger started");
this.log(Logger.LEVEL_SYS, "Logger is open in browser: " + this.objectToString($.browser));
},
close: function() {
@ -299,6 +301,37 @@ Logger.prototype = {
}
return "LEVEL " + level;
},
// this is a util function which actually can be put elsewhere instead of in this class
objectToString : function(object) {
if(object) {
if(object instanceof Object) {
var sb = ['{' ];
$.each(object, function(name, val) {
sb.push('' + name + ': ');
if(val instanceof Object) {
sb.push(this.objectToString(val));
} else {
sb.push('' + val);
}
sb.push(',');
});
if(sb[sb.length - 1] == ',' )
sb.length = sb.length - 1;
sb.push('}');
return sb.join("");
} else {
return '' + object;
}
} else {
return 'N/A';
}
}
};