aboutsummaryrefslogtreecommitdiff
path: root/p/scripts
diff options
context:
space:
mode:
authorGravatar Olexandr Shaposhnyk <118913884+oshaposhnyk@users.noreply.github.com> 2024-11-13 14:00:39 +0200
committerGravatar GitHub <noreply@github.com> 2024-11-13 13:00:39 +0100
commit846e19afde7583bd8f3b873577211cc8cb9e83f1 (patch)
tree2a56d14ae6944a01812fe1f9c1935b9ac3747363 /p/scripts
parente9ce099277bd5cb0257b9535cfaed42d87670b88 (diff)
[Feature] 6975: Redirect to shortcut page on pressing '?' (#6981)
* [Feature] 6975: Redirect to shortcut page on pressing '?' * [Feature] 6975: Redirect to shortcut page on pressing '?' * Simplify code * Re-order for performance * Remove shift key --------- Co-authored-by: Olexandr Shaposhnyk <oshaposhnyk@intelliboard.net> Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Diffstat (limited to 'p/scripts')
-rw-r--r--p/scripts/main.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js
index f35fa35df..3d1022872 100644
--- a/p/scripts/main.js
+++ b/p/scripts/main.js
@@ -973,8 +973,7 @@ function init_shortcuts() {
});
document.addEventListener('keydown', ev => {
- if (ev.target.closest('input, textarea') ||
- ev.ctrlKey || ev.metaKey || (ev.altKey && ev.shiftKey)) {
+ if (ev.ctrlKey || ev.metaKey || (ev.altKey && ev.shiftKey) || ev.target.closest('input, select, textarea')) {
return;
}
@@ -1080,6 +1079,10 @@ function init_shortcuts() {
ev.preventDefault();
return;
}
+ if (ev.key === '?') {
+ window.location.href = context.urls.shortcuts.replace(/&amp;/g, '&');
+ return;
+ }
if (ev.altKey || ev.shiftKey) {
return;