Skip to content

Commit

Permalink
Backward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
devemlight committed Aug 15, 2018
1 parent 99559f4 commit eaa9675
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Polyglot.safariextension/injected.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit eaa9675

Please sign in to comment.