summaryrefslogtreecommitdiff
path: root/plugins/hotkeys_noscroll
diff options
context:
space:
mode:
authorMichael Kuhn <[email protected]>2019-03-11 11:29:10 +0100
committerMichael Kuhn <[email protected]>2019-03-11 12:01:27 +0100
commite74f7bde22c469ca90316f7bd69a0ba5233f8bff (patch)
tree1ccf7b38576f9780cbeff4372fea16697ac1d9f8 /plugins/hotkeys_noscroll
parent355723ca59a6bd92192aaf1ac606d846a3eb3359 (diff)
Refactor hotkeys to use keypress instead of keydown
keydown returns the "raw" key in event.which. Depending on the keyboard layout, this may not be what is wanted. For example, on a German keyboard, Shift+7 has to be pressed to get a slash. However, event.which will be 55, which corresponds to "7". In the keypress event, however, event.which will be 47, which corresponds to "/". Sadly, several important keys (such as escape and the arrow keys) do not trigger a keypress event. Therefore, they have to be handled using a keydown event. This change refactors the hotkey support to make use of keypress events whenever possible. This will make hotkeys work regardless of the user's keyboard layout. Escape and arrow keys are still handled via keydown events. There should be only one change in behavior: I could not make Ctrl+/ work and therefore rebound the help dialog to "?".
Diffstat (limited to 'plugins/hotkeys_noscroll')
-rw-r--r--plugins/hotkeys_noscroll/init.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/plugins/hotkeys_noscroll/init.php b/plugins/hotkeys_noscroll/init.php
index 18f5aedab..2038997f5 100644
--- a/plugins/hotkeys_noscroll/init.php
+++ b/plugins/hotkeys_noscroll/init.php
@@ -16,8 +16,8 @@ class Hotkeys_Noscroll extends Plugin {
function hook_hotkey_map($hotkeys) {
- $hotkeys["(40)|down"] = "next_article_noscroll";
- $hotkeys["(38)|up"] = "prev_article_noscroll";
+ $hotkeys["(40)|Down"] = "next_article_noscroll";
+ $hotkeys["(38)|Up"] = "prev_article_noscroll";
$hotkeys["n"] = "next_article_noscroll";
$hotkeys["p"] = "prev_article_noscroll";