From 1f565355eca3463d9840c42fc5e7e2d6b2de10a7 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Fri, 8 May 2020 23:34:34 +0200 Subject: [PATCH] change available mode highlighting, refs #95 --- htdocs/css/openwebrx.css | 4 ++-- htdocs/lib/DemodulatorPanel.js | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/css/openwebrx.css b/htdocs/css/openwebrx.css index dbc0f14..fd81097 100644 --- a/htdocs/css/openwebrx.css +++ b/htdocs/css/openwebrx.css @@ -453,8 +453,8 @@ input[type=range]:disabled { margin-right: 5px; } -.openwebrx-demodulator-button.disabled { - color: #B6B6B6; +.openwebrx-demodulator-button.same-mod { + color: #FFC; } .openwebrx-square-button img diff --git a/htdocs/lib/DemodulatorPanel.js b/htdocs/lib/DemodulatorPanel.js index 6670c73..bfd3619 100644 --- a/htdocs/lib/DemodulatorPanel.js +++ b/htdocs/lib/DemodulatorPanel.js @@ -233,7 +233,7 @@ DemodulatorPanel.prototype.squelchAvailable = function () { DemodulatorPanel.prototype.updateButtons = function() { var $buttons = this.el.find(".openwebrx-demodulator-button"); - $buttons.removeClass("highlighted").removeClass('disabled'); + $buttons.removeClass("highlighted").removeClass('same-mod'); var demod = this.getDemodulator() if (!demod) return; this.el.find('[data-modulation=' + demod.get_modulation() + ']').addClass("highlighted"); @@ -243,10 +243,12 @@ DemodulatorPanel.prototype.updateButtons = function() { this.el.find('.openwebrx-secondary-demod-listbox').val(secondary_demod); var mode = Modes.findByModulation(secondary_demod); if (mode) { - $buttons.filter(function(){ - var mod = $(this).data('modulation'); - return mod && mode.underlying.indexOf(mod) < 0; - }).addClass('disabled'); + var self = this; + mode.underlying.filter(function(m) { + return m !== demod.get_modulation(); + }).forEach(function(m) { + self.el.find('[data-modulation=' + m + ']').addClass('same-mod') + }); } } else { this.el.find('.openwebrx-secondary-demod-listbox').val('none');