From 5f95d20f4a315089d94c58bd1fd897bd7a52d61d Mon Sep 17 00:00:00 2001 From: "Stanislav Lechev [0xAF]" Date: Tue, 20 Aug 2024 02:27:50 +0300 Subject: [PATCH] add ctrl+0-9, ignore some keys if ctrl is pressed, move help descriptions on top --- htdocs/css/shortcuts.css | 5 +++ htdocs/lib/Shortcuts.js | 75 ++++++++++++++++++++++------------------ 2 files changed, 46 insertions(+), 34 deletions(-) diff --git a/htdocs/css/shortcuts.css b/htdocs/css/shortcuts.css index 8b658068..b5772fd7 100644 --- a/htdocs/css/shortcuts.css +++ b/htdocs/css/shortcuts.css @@ -60,8 +60,13 @@ /* flex-direction: row; */ } +.ks-item-txt { + color: silver; +} + .ks-item-kbd { text-wrap: nowrap; + color: silver; } a.kbc-button-xs, button.kbc-button-xs { diff --git a/htdocs/lib/Shortcuts.js b/htdocs/lib/Shortcuts.js index 9945852e..7dd8dbda 100644 --- a/htdocs/lib/Shortcuts.js +++ b/htdocs/lib/Shortcuts.js @@ -19,107 +19,107 @@ Shortcuts.init = function(target) {
-
${this.keycap('ArrowLeft')}|${this.keycap('ArrowRight')}
tune frequency
+
${this.keycap('ArrowLeft')}|${this.keycap('ArrowRight')}
-
${this.keycap('ArrowUp')}|${this.keycap('ArrowDown')}
zoom waterfall
+
${this.keycap('ArrowUp')}|${this.keycap('ArrowDown')}
-
${this.keycap('0')}..${this.keycap('9')}
select modulation
+
(${this.keycap('Control')}+)${this.keycap('0')}..${this.keycap('9')}
-
${this.keycap('[')}|${this.keycap(']')}
change tuning step
+
${this.keycap('[')}|${this.keycap(']')}
-
${this.keycap('Control')}+${this.keycap('ArrowUp')}|${this.keycap('ArrowDown')}
change volume
+
${this.keycap('Control')}+${this.keycap('ArrowUp')}|${this.keycap('ArrowDown')}
-
${this.keycap('Space')}
mute/unumte sound
+
${this.keycap('Space')}
-
${this.keycap('A')}
auto-set squelch
+
${this.keycap('A')}
-
${this.keycap('Control')}+${this.keycap('ArrowLeft')}|${this.keycap('ArrowRight')}
change squelch level
+
${this.keycap('Control')}+${this.keycap('ArrowLeft')}|${this.keycap('ArrowRight')}
-
${this.keycap('D')}
disable squelch
+
${this.keycap('D')}
-
${this.keycap('N')}
toggle noise reduction
+
${this.keycap('N')}
-
${this.keycap('Shift')}+${this.keycap('ArrowLeft')}|${this.keycap('ArrowRight')}
adjust bandpass offset
+
${this.keycap('Shift')}+${this.keycap('ArrowLeft')}|${this.keycap('ArrowRight')}
-
${this.keycap('Shift')}+${this.keycap('ArrowUp')}|${this.keycap('ArrowDown')}
adjust bandpass width
+
${this.keycap('Shift')}+${this.keycap('ArrowUp')}|${this.keycap('ArrowDown')}
-
${this.keycap('S')}
toggle scanner
+
${this.keycap('S')}
-
${this.keycap(',')}|${this.keycap('.')}
adjust waterfall min level
+
${this.keycap(',')}|${this.keycap('.')}
-
${this.keycap('<')}|${this.keycap('>')}
adjust waterfall max level
+
${this.keycap('<')}|${this.keycap('>')}
-
${this.keycap('Z')}
auto-set colors once
+
${this.keycap('Z')}
-
${this.keycap('X')}
auto-set colors
+
${this.keycap('X')}
-
${this.keycap('C')}
set default colors
+
${this.keycap('C')}
-
${this.keycap('R')}
toggle recorder
+
${this.keycap('R')}
-
${this.keycap('V')}
toggle spectrum
+
${this.keycap('V')}
-
${this.keycap('B')}
toggle bandplan
+
${this.keycap('B')}
-
${this.keycap('M')}
open map
+
${this.keycap('M')}
-
${this.keycap('F')}
open files browser
+
${this.keycap('F')}
-
${this.keycap('H')}
open documentation
+
${this.keycap('H')}
`); @@ -226,10 +226,11 @@ Shortcuts.handleKey = function(event) { case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '0': - // 0-9: Select modulation + // 0-9, ctrl+0-9: Select modulation var $modes = $('.openwebrx-demodulator-button'); var n = parseInt(event.key); n = n > 0? n - 1 : 9; + if (event.ctrlKey) n += 10; if (n < $modes.length) $modes[n].click(); break; @@ -250,11 +251,13 @@ Shortcuts.handleKey = function(event) { case 's': // S: Toggle scanner + if (event.ctrlKey) return; // leave it to the browser toggleScanner(); break; case 'd': // D: Turn off squelch + if (event.ctrlKey) return; // leave it to the browser var $squelchControl = $('#openwebrx-panel-receiver .openwebrx-squelch-slider'); if (!$squelchControl.prop('disabled')) { $squelchControl.val($squelchControl.attr('min')).change(); @@ -293,11 +296,13 @@ Shortcuts.handleKey = function(event) { case 'n': // N: Toggle noise reduction + if (event.ctrlKey) return; // leave it to the browser UI.toggleNR(); break; case 'r': // R: Toggle recorder + if (event.ctrlKey) return; // leave it to the browser UI.toggleRecording(); break; @@ -322,19 +327,21 @@ Shortcuts.handleKey = function(event) { break; case 'f': - // F: Open file browser - $('a.button[target="openwebrx-files"]')[0].click(); - break; + // F: Open file browser + if (event.ctrlKey) return; // leave it to the browser + $('a.button[target="openwebrx-files"]')[0].click(); + break; case 'h': - // H: Open documentation - $('a.button[target="openwebrx-help"]')[0].click(); - break; + // H: Open documentation + if (event.ctrlKey) return; // leave it to the browser + $('a.button[target="openwebrx-help"]')[0].click(); + break; case 'm': - // M: Open map - $('a.button[target="openwebrx-map"]')[0].click(); - break; + // M: Open map + $('a.button[target="openwebrx-map"]')[0].click(); + break; case '/': case '?': Shortcuts.overlay.slideToggle(100);