aboutsummaryrefslogtreecommitdiff
path: root/ext/mixed/js/dom.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mixed/js/dom.js')
-rw-r--r--ext/mixed/js/dom.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/ext/mixed/js/dom.js b/ext/mixed/js/dom.js
index 31ba33d6..0e8f4462 100644
--- a/ext/mixed/js/dom.js
+++ b/ext/mixed/js/dom.js
@@ -63,6 +63,20 @@ class DOM {
}
}
+ static getActiveModifiers(event) {
+ const modifiers = new Set();
+ if (event.altKey) { modifiers.add('alt'); }
+ if (event.ctrlKey) { modifiers.add('ctrl'); }
+ if (event.metaKey) { modifiers.add('meta'); }
+ if (event.shiftKey) { modifiers.add('shift'); }
+ return modifiers;
+ }
+
+ static getKeyFromEvent(event) {
+ const key = event.key;
+ return (typeof key === 'string' ? (key.length === 1 ? key.toUpperCase() : key) : '');
+ }
+
static getFullscreenElement() {
return (
document.fullscreenElement ||