From eaa9675e33e7972952bfb7d8793e4deaabda7937 Mon Sep 17 00:00:00 2001 From: Sergey Sorokin Date: Wed, 15 Aug 2018 10:44:18 +0300 Subject: [PATCH] Backward compatibility --- Polyglot.safariextension/injected.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Polyglot.safariextension/injected.js b/Polyglot.safariextension/injected.js index e4ffa80..da62fb5 100644 --- a/Polyglot.safariextension/injected.js +++ b/Polyglot.safariextension/injected.js @@ -39,11 +39,14 @@ function handleMouseUp(e) { function handleKeypress(e) { // Check if shortcut key is properly configured if (settings.keyValue !== '') { + const keyValue = settings.keyValue + const keyCode = getEventCode(keyValue.charAt(0)) + const applyMeta = settings.useMetaKey ? e.metaKey : true const applyShift = settings.useShiftKey ? e.shiftKey : true const applyCtrl = settings.useCtrlKey ? e.ctrlKey : true const applyAlt = settings.useAltKey ? e.altKey : true - const applyKey = getEventCode(settings.keyValue.charAt(0)) === e.code + const applyKey = keyCode ? keyCode === e.code : keyValue.charCodeAt(0) === e.keyCode if (applyMeta && applyShift && applyCtrl && applyAlt && applyKey) { e.preventDefault()