From fa4988eca9145270ab921a1002f779b6e56a50b5 Mon Sep 17 00:00:00 2001 From: Eyal Gruss Date: Thu, 28 Nov 2024 15:10:41 +0200 Subject: [PATCH] altGraph --- resen/kaddish/script.js | 2 +- resen/pages.js | 2 +- resen/snark/script.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/resen/kaddish/script.js b/resen/kaddish/script.js index eb1397d..0ac2ac1 100644 --- a/resen/kaddish/script.js +++ b/resen/kaddish/script.js @@ -47,7 +47,7 @@ function update_caret(current) { const first = update_caret() document.addEventListener('keydown', event => { - if (event.altKey || event.ctrlKey || event.metaKey) + if (event.altKey || event.getModifierState('AltGraph') || event.ctrlKey || event.metaKey) return const chars = [...document.querySelectorAll('svg text:not(:empty)')] const current = chars.pop() diff --git a/resen/pages.js b/resen/pages.js index fb36957..c131e05 100644 --- a/resen/pages.js +++ b/resen/pages.js @@ -426,7 +426,7 @@ function is_shortcut(event, shortcut) { || event.code == 'Digit' + shortcut_key // For AZERTY keyboard || !event_key.match(/^[a-z]$/) && event.code == 'Key' + shortcut_key.toUpperCase()) // For Hebrew keyboard event_key = shortcut_key - return event_key == shortcut_key && event.altKey == shortcut.includes('alt') && (event.ctrlKey || event.metaKey) == shortcut.includes('ctrl') && event.shiftKey == shortcut.includes('shift') + return event_key == shortcut_key && (event.altKey || event.getModifierState('AltGraph')) == shortcut.includes('alt') && (event.ctrlKey || event.metaKey) == shortcut.includes('ctrl') && event.shiftKey == shortcut.includes('shift') } diff --git a/resen/snark/script.js b/resen/snark/script.js index f932f21..1e154ad 100644 --- a/resen/snark/script.js +++ b/resen/snark/script.js @@ -71,7 +71,7 @@ function click(event) { const containers = document.querySelectorAll('div[oncontextmenu*=toggle_fullscreen]') document.addEventListener('keydown', event => { - if (event.altKey || event.ctrlKey || event.metaKey || !event.key.match(/^[א-תa-zA-Z]$/) && event.key != 'Backspace' && event.key != 'CapsLock') + if (event.altKey || event.getModifierState('AltGraph') || event.ctrlKey || event.metaKey || !event.key.match(/^[א-תa-zA-Z]$/) && event.key != 'Backspace' && event.key != 'CapsLock') return const current = containers[1].classList.contains('fullscreen') | 0 const svgs = document.querySelectorAll('svg')