|
@@ -18,13 +18,13 @@ var kbdUtil = (function() {
|
|
|
};
|
|
|
|
|
|
function isMac() {
|
|
|
- return navigator && !!(/macintosh/i).exec(navigator.appVersion);
|
|
|
+ return navigator && !!(/mac/i).exec(navigator.platform);
|
|
|
}
|
|
|
function isWindows() {
|
|
|
- return navigator && !!(/windows/i).exec(navigator.appVersion);
|
|
|
+ return navigator && !!(/win/i).exec(navigator.platform);
|
|
|
}
|
|
|
function isLinux() {
|
|
|
- return navigator && !!(/linux/i).exec(navigator.appVersion);
|
|
|
+ return navigator && !!(/linux/i).exec(navigator.platform);
|
|
|
}
|
|
|
|
|
|
// Return true if a modifier which is not the specified char modifier (and is not shift) is down
|
|
@@ -152,12 +152,15 @@ var kbdUtil = (function() {
|
|
|
// Get a key ID from a keyboard event
|
|
|
// May be a string or an integer depending on the available properties
|
|
|
function getKey(evt){
|
|
|
- if (evt.key) {
|
|
|
- return evt.key;
|
|
|
+ if ('keyCode' in evt && 'key' in evt) {
|
|
|
+ return evt.key + ':' + evt.keyCode;
|
|
|
}
|
|
|
- else {
|
|
|
+ else if ('keyCode' in evt) {
|
|
|
return evt.keyCode;
|
|
|
}
|
|
|
+ else {
|
|
|
+ return evt.key;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// Get the most reliable keysym value we can get from a key event
|