Skip to content

Commit 1ff550f

Browse files
author
Kelven Yang
committed
English Windows + Japanese keyboard + Firefox/IE/Safari/Chrome keyboard mapping
1 parent 7bdaa21 commit 1ff550f

2 files changed

Lines changed: 73 additions & 26 deletions

File tree

‎console-proxy/js/ajaxviewer.js‎

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -435,67 +435,81 @@ AjaxViewer.prototype = {
435435
var charCodeMap = [];
436436
var shiftedCharCodeMap = [];
437437

438-
shiftedKeyCodeMap[50] = { code: 222, shift: 1 } ; // EN 2/@ -> JP 2/"
438+
shiftedKeyCodeMap[50] = { code: 222, shift: 1 } ; // JP SHIFT + 2 -> "
439439
shiftedCharCodeMap[64] = { code: 34, shift: 1 };
440440

441-
shiftedKeyCodeMap[54] = { code: 55, shift : 1 }; // EN 6/^ -> JP 6/&
441+
shiftedKeyCodeMap[54] = { code: 55, shift : 1 }; // JP SHIFT + 6 -> &
442442
shiftedCharCodeMap[94] = { code: 38, shift : 1 };
443443

444-
shiftedKeyCodeMap[55] = { code: 222, shift : 0 }; // EN '/' -> JP 7/'
444+
shiftedKeyCodeMap[55] = { code: 222, shift : 0 }; // JP SHIFT + 7 -> '
445445
shiftedCharCodeMap[38] = { code: 39, shift : 0 };
446446

447-
shiftedKeyCodeMap[56] = { code: 57, shift : 1 }; // EN 9/'(' -> JP 8/(
447+
shiftedKeyCodeMap[56] = { code: 57, shift : 1 }; // JP SHIFT + 8 -> (
448448
shiftedCharCodeMap[42] = { code: 40, shift : 1 };
449449

450-
shiftedKeyCodeMap[57] = { code: 48, shift : 1 }; // EN 0/')' -> JP 9/)
450+
shiftedKeyCodeMap[57] = { code: 48, shift : 1 }; // JP SHIFT + 9 -> )
451451
shiftedCharCodeMap[40] = { code: 41, shift : 1 };
452452

453-
shiftedKeyCodeMap[48] = { code: 192, shift : 1 }; // EN `/~)' -> JP 0/~
453+
shiftedKeyCodeMap[48] = { code: 192, shift : 1 }; // JP SHIFT + 0 -> ~
454454
shiftedCharCodeMap[41] = { code: 126, shift : 1 };
455455

456-
keyCodeMap[107] = { code: 107, shift : 1, defer : true }; // JP NUM +
457-
charCodeMap[43] = { code: 43, shift : 1, keyCode: 107 };
456+
shiftedKeyCodeMap[109] = { code: 107, shift : 0 }; // JP SHIFT + (-=), keycode/charcode(109, 95) from Firefox
457+
shiftedCharCodeMap[95] = { code: 61, shift : 0 };
458458

459-
// keyCodeMap[107] = { code: 54, shift : 1, defer : true }; // JP ^/_
460-
charCodeMap[61] = { code: 94, shift : 1, keyCode: 54 };
461-
shiftedKeyCodeMap[107] = { code: 109, shift : 1 };
462-
shiftedCharCodeMap[43] = { code: 95, shift : 1 };
463-
464-
shiftedKeyCodeMap[109] = { code: 107, shift : 0 };
459+
shiftedKeyCodeMap[189] = { code: 107, shift : 0 }; // JP SHIFT + (-=), keycode/charcode(109, 95) from Chrome/Safari/MSIE
465460
shiftedCharCodeMap[95] = { code: 61, shift : 0 };
466461

467-
shiftedKeyCodeMap[255] = { code: 220, shift : 1, charCode: 124 }; // EN \/| -> JP |
462+
if($.browser.mozilla) {
463+
keyCodeMap[107] = { code: 107, shift : 1, defer : true }; // JP NUM +, keycode/charcode (107, 43) from Firefox
464+
charCodeMap[43] = { code: 43, shift : 1, keyCode: 107 };
465+
charCodeMap[61] = { code: 94, shift : 1, keyCode: 54 }; // JP (-^), keycode/charcode (107, 61) from Firefox
466+
467+
shiftedKeyCodeMap[107] = { code: 109, shift : 1 }; // JP SHIFT + (-^)
468+
shiftedCharCodeMap[43] = { code: 95, shift : 1 };
469+
} else {
470+
keyCodeMap[187] = { code: 54, shift: 1}; // JP -^
471+
charCodeMap[61] = { code: 94, shift: 1};
472+
473+
shiftedKeyCodeMap[187] = { code: 109, shift : 1 }; // JP SHIFT + (-^)
474+
shiftedCharCodeMap[43] = { code: 95, shift : 1 };
475+
}
468476

469-
keyCodeMap[219] = { code: 50, shift : 1 }; // EN 2/@' -> JP @/`
477+
shiftedKeyCodeMap[255] = { code: 220, shift : 1, charCode: 124 }; // JP (|-, key before backspace)
478+
479+
keyCodeMap[219] = { code: 50, shift : 1 }; // JP @`
470480
charCodeMap[91] = { code: 64, shift : 1 };
471-
shiftedKeyCodeMap[219] = { code: 192, shift : 0 }; // EN `/~)' -> JP 0/~
481+
shiftedKeyCodeMap[219] = { code: 192, shift : 0 }; // JP SHIFT + (@`)
472482
shiftedCharCodeMap[123] = { code: 96, shift : 0 };
473483

474-
keyCodeMap[221] = { code: 219, shift : 0 }; // EN [/{' -> JP [/{
484+
keyCodeMap[221] = { code: 219, shift : 0 }; // JP [{
475485
charCodeMap[93] = { code: 91, shift : 0 };
476486
shiftedKeyCodeMap[221] = { code: 219, shift : 1 };
477487
shiftedCharCodeMap[125] = { code: 123, shift : 1 };
478488

479-
shiftedKeyCodeMap[59] = { code: 107, shift : 1 }; // EN =/+ -> JP ;/+
480-
shiftedCharCodeMap[58] = { code: 43, shift : 1 };
481-
482-
keyCodeMap[222] = { code: 59, shift : 1 }; // EN ;/:' -> JP :/*
489+
if($.browser.mozilla) {
490+
shiftedKeyCodeMap[59] = { code: 107, shift : 1 }; // JP ;+
491+
shiftedCharCodeMap[58] = { code: 43, shift : 1 };
492+
} else {
493+
shiftedKeyCodeMap[186] = { code: 107, shift : 1 }; // JP ;+
494+
shiftedCharCodeMap[58] = { code: 43, shift : 1 };
495+
}
496+
497+
keyCodeMap[222] = { code: 59, shift : 1 }; // JP :*
483498
charCodeMap[39] = { code: 58, shift : 1 };
484499
shiftedKeyCodeMap[222] = { code: 56, shift : 1 };
485500
shiftedCharCodeMap[34] = { code: 42, shift : 1 };
486501

487-
keyCodeMap[220] = { code: 221, shift : 0 }; // EN ]/}' -> JP ]/}
502+
keyCodeMap[220] = { code: 221, shift : 0 }; // JP ]}
488503
charCodeMap[92] = { code: 93, shift : 0 };
489504
shiftedKeyCodeMap[220] = { code: 221, shift : 1 };
490505
shiftedCharCodeMap[124] = { code: 125, shift : 1 };
491506

492-
keyCodeMap[193] = { code: 220, shift : 0, charCode: 92 }; // EN ]/}' -> JP ]/}
507+
keyCodeMap[193] = { code: 220, shift : 0, charCode: 92 }; // JP \-|
493508
shiftedKeyCodeMap[193] = { code: 109, shift : 0, charCode : 45 };
494509

495510
keyCodeMap[106] = { code: 56, shift : 1 }; // JP NUM *
496511
charCodeMap[42] = { code: 42, shift : 1 };
497512

498-
499513
keyCodeMap[110] = { code: 190, shift : 0 }; // JP NUM .
500514
charCodeMap[46] = { code: 46, shift : 0 };
501515

‎console-proxy/js/cloud.logger.js‎

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ Logger.prototype = {
5454
open: function() {
5555
if(this.logWin) {
5656
this.logWin.show();
57+
58+
this.log(Logger.LEVEL_SYS, "Logger is open in browser: " + this.objectToString($.browser));
5759
return;
5860
}
5961

@@ -165,7 +167,7 @@ Logger.prototype = {
165167
this.logWin.css("left", (($(document.body).width() - this.logWin.width()) / 2) + "px");
166168
this.dockIn();
167169

168-
this.log(Logger.LEVEL_SYS, "Logger started");
170+
this.log(Logger.LEVEL_SYS, "Logger is open in browser: " + this.objectToString($.browser));
169171
},
170172

171173
close: function() {
@@ -299,6 +301,37 @@ Logger.prototype = {
299301
}
300302

301303
return "LEVEL " + level;
304+
},
305+
306+
// this is a util function which actually can be put elsewhere instead of in this class
307+
objectToString : function(object) {
308+
if(object) {
309+
if(object instanceof Object) {
310+
var sb = ['{' ];
311+
312+
$.each(object, function(name, val) {
313+
sb.push('' + name + ': ');
314+
315+
if(val instanceof Object) {
316+
sb.push(this.objectToString(val));
317+
} else {
318+
sb.push('' + val);
319+
}
320+
321+
sb.push(',');
322+
});
323+
324+
if(sb[sb.length - 1] == ',' )
325+
sb.length = sb.length - 1;
326+
327+
sb.push('}');
328+
return sb.join("");
329+
} else {
330+
return '' + object;
331+
}
332+
} else {
333+
return 'N/A';
334+
}
302335
}
303336
};
304337

0 commit comments

Comments
 (0)