From d9a818525d4f0b04447dfa13e741b107e341347e Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Sat, 2 May 2020 01:07:44 +0200 Subject: [PATCH] refactor demodulator classes, part 2 --- htdocs/lib/BookmarkBar.js | 3 +- htdocs/lib/DemodulatorPanel.js | 106 +++++++++++++++++++++------------ htdocs/lib/Modes.js | 2 +- 3 files changed, 70 insertions(+), 41 deletions(-) diff --git a/htdocs/lib/BookmarkBar.js b/htdocs/lib/BookmarkBar.js index 402e3d4..fadf00a 100644 --- a/htdocs/lib/BookmarkBar.js +++ b/htdocs/lib/BookmarkBar.js @@ -13,7 +13,8 @@ function BookmarkBar() { if (b.modulation) { me.getDemodulatorPanel().setMode(b.modulation); } else if (b.digital_modulation) { - me.getDemodulatorPanel().setDigiMode(b.digital_modulation); + // TODO: update bookmarks so they don't contain digital_modulation + me.getDemodulatorPanel().setMode(b.digital_modulation); } $bookmark.addClass('selected'); }); diff --git a/htdocs/lib/DemodulatorPanel.js b/htdocs/lib/DemodulatorPanel.js index 09c2cfd..8d37085 100644 --- a/htdocs/lib/DemodulatorPanel.js +++ b/htdocs/lib/DemodulatorPanel.js @@ -10,13 +10,22 @@ function DemodulatorPanel(el) { }); Modes.registerModePanel(this); - el.on('click', '.openwebrx-demodulator-button[data-modulation]', function() { - self.setMode($(this).data('modulation')); + el.on('click', '.openwebrx-demodulator-button', function() { + var modulation = $(this).data('modulation'); + if (modulation) { + self.setMode(modulation); + } else { + self.disableDigiMode(); + } }); el.on('change', '.openwebrx-secondary-demod-listbox', function() { - self.setDigiMode($(this).val()); + var value = $(this).val(); + if (value === 'none') { + self.disableDigiMode(); + } else { + self.setMode(value); + } }); - // TODO: disable digimodes }; DemodulatorPanel.prototype.render = function() { @@ -52,7 +61,7 @@ DemodulatorPanel.prototype.render = function() { html.push($( '
' + - '
DIG
' + + '
DIG
' + '