From 2cae2101795043bbfb3bc36900cd8e9fe7893871 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Tue, 1 Jun 2021 11:18:20 -0700 Subject: [PATCH] Improved translation page. --- public/translator.htm | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/public/translator.htm b/public/translator.htm index 35af8b42..7b1284e4 100644 --- a/public/translator.htm +++ b/public/translator.htm @@ -57,8 +57,8 @@
- - + + - - + + +
  - - + +
@@ -141,6 +141,8 @@ document.ondragover = ondragover; document.ondragleave = ondragleave; document.onkeypress = onkeypress; + document.onkeydown = onkeydown; + document.onkeyup = onkeyup; updateMainList(); loadServerTranslations(); QE('SaveServerButton', false); @@ -203,6 +205,21 @@ //if (e.key == ' ') { togglePause(); haltEvent(e); } } + function onkeydown(e) { + if (xxdialogMode) return; + if (e.key == 'F1') { setTranslation(); haltEvent(e); return false; } // Set translation + if (e.key == 'F2') { cancelTranslation(); haltEvent(e); return false; } // Cancel translation + if (e.key == 'F3') { saveServerTranslations(); haltEvent(e); return false; } // Save to server + if (e.key == 'F4') { saveToFile(); haltEvent(e); return false; } // Save to file + if (e.key == 'F5') { copySource(); haltEvent(e); return false; } // Copy source + } + + function onkeyup(e) { + if (xxdialogMode) return; + if (e.key == 'PageUp') { setTranslation(); prev(); haltEvent(e); return false; } // Save and move to previous + if (e.key == 'PageDown') { setTranslation(); next(); haltEvent(e); return false; } // Save and move to next + } + function deskAdjust() { } @@ -287,8 +304,8 @@ updateButtons(); } - function next() { select(selectedItem + 1, true); } - function prev() { select(selectedItem - 1, true); } + function next() { if (selectedItem < (translations.length - 1)) { select(selectedItem + 1, true); } } + function prev() { if (selectedItem > 0) { select(selectedItem - 1, true); } } function copySource() { Q('translatedTextArea').value = translations[selectedItem].en; Q('translatedTextArea').focus(); } function updateButtons() {