aboutsummaryrefslogtreecommitdiff
path: root/ext/mixed/js/document-util.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-09-08 10:53:41 -0400
committerGitHub <noreply@github.com>2020-09-08 10:53:41 -0400
commit36fc5abae543840484b3d8f7abff85f57de66ada (patch)
treed8ce5b59ca26e8b91957989a775cb75a76c3d44a /ext/mixed/js/document-util.js
parent0a5e832dfddcc6184410e8836cc8dea030457486 (diff)
Modifier key refactor (#784)
* Add functions for getting keyboard key information * Use os + DocumentUtil to get modifier key names * Remove keyboard modifier info from environment info
Diffstat (limited to 'ext/mixed/js/document-util.js')
-rw-r--r--ext/mixed/js/document-util.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/ext/mixed/js/document-util.js b/ext/mixed/js/document-util.js
index ba39942d..0b72ff9a 100644
--- a/ext/mixed/js/document-util.js
+++ b/ext/mixed/js/document-util.js
@@ -259,6 +259,46 @@ class DocumentUtil {
return false;
}
+ static getModifierKeys(os) {
+ switch (os) {
+ case 'win':
+ return [
+ ['alt', 'Alt'],
+ ['ctrl', 'Ctrl'],
+ ['shift', 'Shift'],
+ ['meta', 'Windows']
+ ];
+ case 'mac':
+ return [
+ ['alt', 'Opt'],
+ ['ctrl', 'Ctrl'],
+ ['shift', 'Shift'],
+ ['meta', 'Cmd']
+ ];
+ case 'linux':
+ case 'openbsd':
+ case 'cros':
+ case 'android':
+ return [
+ ['alt', 'Alt'],
+ ['ctrl', 'Ctrl'],
+ ['shift', 'Shift'],
+ ['meta', 'Super']
+ ];
+ default: // 'unknown', etc
+ return [
+ ['alt', 'Alt'],
+ ['ctrl', 'Ctrl'],
+ ['shift', 'Shift'],
+ ['meta', 'Meta']
+ ];
+ }
+ }
+
+ static isMetaKeySupported(os, browser) {
+ return !(browser === 'firefox' || browser === 'firefox-mobile') || os === 'mac';
+ }
+
// Private
_setImposterStyle(style, propertyName, value) {