Merge pull request #348 from Medical-Insight/fix-altgr-firefox

Fix altgr firefox
This commit is contained in:
Samuel 2014-03-12 16:51:20 +01:00
commit f1e6daf3c8
1 changed files with 9 additions and 6 deletions

View File

@ -18,13 +18,13 @@ var kbdUtil = (function() {
}; };
function isMac() { function isMac() {
return navigator && !!(/macintosh/i).exec(navigator.appVersion); return navigator && !!(/mac/i).exec(navigator.platform);
} }
function isWindows() { function isWindows() {
return navigator && !!(/windows/i).exec(navigator.appVersion); return navigator && !!(/win/i).exec(navigator.platform);
} }
function isLinux() { 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 // Return true if a modifier which is not the specified char modifier (and is not shift) is down
@ -152,11 +152,14 @@ var kbdUtil = (function() {
// Get a key ID from a keyboard event // Get a key ID from a keyboard event
// May be a string or an integer depending on the available properties // May be a string or an integer depending on the available properties
function getKey(evt){ function getKey(evt){
if (evt.key) { if ('keyCode' in evt && 'key' in evt) {
return evt.key; return evt.key + ':' + evt.keyCode;
}
else if ('keyCode' in evt) {
return evt.keyCode;
} }
else { else {
return evt.keyCode; return evt.key;
} }
} }