From 59d55369cb76970ae1e09045c9a77b860fedec56 Mon Sep 17 00:00:00 2001 From: somebody Date: Sat, 30 Jul 2022 21:34:42 -0500 Subject: [PATCH] Add shortcuts Adds shortcuts to the UI. These shortcuts are: Ctrl-Z: Undo Ctrl-Y: Redo Ctrl-E: Retry --- static/application.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/static/application.js b/static/application.js index f8f415ca..b354f419 100644 --- a/static/application.js +++ b/static/application.js @@ -3275,6 +3275,32 @@ $(document).ready(function(){ return true; } }); + + // Shortcuts + $(window).keydown(function (ev) { + // Only ctrl prefixed (for now) + if (!ev.ctrlKey) return; + + let handled = true; + switch (ev.key) { + // Ctrl+Z - Back + case "z": + button_actback.click(); + break; + // Ctrl+Y - Forward + case "y": + button_actfwd.click(); + break; + // Ctrl+E - Retry + case "e": + button_actretry.click(); + break; + default: + handled = false; + } + + if (handled) ev.preventDefault(); + }); });