diff --git a/Polyglot.safariextension/Info.plist b/Polyglot.safariextension/Info.plist index 7d8880b..249639b 100644 --- a/Polyglot.safariextension/Info.plist +++ b/Polyglot.safariextension/Info.plist @@ -13,9 +13,9 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleShortVersionString - 2.2.0 + 2.3.0 CFBundleVersion - 2.2.0 + 2.3.0 Chrome Context Menu Items diff --git a/Polyglot.safariextension/Settings.plist b/Polyglot.safariextension/Settings.plist index 966b782..e58a183 100644 --- a/Polyglot.safariextension/Settings.plist +++ b/Polyglot.safariextension/Settings.plist @@ -209,40 +209,56 @@ DefaultValue false + FalseValue + false Key useMetaKey Title Command + TrueValue + true Type CheckBox DefaultValue false + FalseValue + false Key useShiftKey Title Shift + TrueValue + true Type CheckBox DefaultValue true + FalseValue + false Key useCtrlKey Title Ctrl + TrueValue + true Type CheckBox DefaultValue false + FalseValue + false Key useAltKey Title Alt + TrueValue + true Type CheckBox diff --git a/Polyglot.safariextension/injected.js b/Polyglot.safariextension/injected.js index a2f0ce5..688a95a 100644 --- a/Polyglot.safariextension/injected.js +++ b/Polyglot.safariextension/injected.js @@ -35,18 +35,17 @@ function handleMouseUp(e) { function handleKeypress(e) { // Check if shortcut key is properly configured - if (settings.keyValue === '') { - return; - } + if (settings.keyValue !== '') { + const applyMeta = settings.useMetaKey === 'true' ? e.metaKey : true; + const applyShift = settings.useShiftKey === 'true' ? e.shiftKey : true; + const applyCtrl = settings.useCtrlKey === 'true' ? e.ctrlKey : true; + const applyAlt = settings.useAltKey === 'true' ? e.altKey : true; + const applyKey = settings.keyValue.charCodeAt(0) === e.keyCode; - const applyMeta = settings.useMetaKey === 'true' ? e.metaKey : true; - const applyShift = settings.useShiftKey === 'true' ? e.shiftKey : true; - const applyCtrl = settings.useCtrlKey === 'true' ? e.ctrlKey : true; - const applyAlt = settings.useAltKey === 'true' ? e.altKey : true; - const applyKey = settings.keyValue.charCodeAt(0) === e.keyCode; - if (applyMeta && applyShift && applyCtrl && applyAlt && applyKey) { - e.preventDefault(); - getSelectedText(); + if (applyMeta && applyShift && applyCtrl && applyAlt && applyKey) { + e.preventDefault(); + getSelectedText(); + } } } diff --git a/docs/manifest.plist b/docs/manifest.plist index 0ef0be8..dd64759 100644 --- a/docs/manifest.plist +++ b/docs/manifest.plist @@ -10,11 +10,11 @@ Developer Identifier 58XDWHK3JX CFBundleVersion - 2.2.0 + 2.3.0 CFBundleShortVersionString - 2.2.0 + 2.3.0 URL - https://github.com/uetchy/Polyglot/releases/download/v2.2.0/Polyglot.safariextz + https://github.com/uetchy/Polyglot/releases/download/v2.3.0/Polyglot.safariextz Update From Gallery