change available mode highlighting, refs #95

This commit is contained in:
Jakob Ketterl 2020-05-08 23:34:34 +02:00
parent af1cfee754
commit 1f565355ec
2 changed files with 9 additions and 7 deletions

View File

@ -453,8 +453,8 @@ input[type=range]:disabled {
margin-right: 5px; margin-right: 5px;
} }
.openwebrx-demodulator-button.disabled { .openwebrx-demodulator-button.same-mod {
color: #B6B6B6; color: #FFC;
} }
.openwebrx-square-button img .openwebrx-square-button img

View File

@ -233,7 +233,7 @@ DemodulatorPanel.prototype.squelchAvailable = function () {
DemodulatorPanel.prototype.updateButtons = function() { DemodulatorPanel.prototype.updateButtons = function() {
var $buttons = this.el.find(".openwebrx-demodulator-button"); var $buttons = this.el.find(".openwebrx-demodulator-button");
$buttons.removeClass("highlighted").removeClass('disabled'); $buttons.removeClass("highlighted").removeClass('same-mod');
var demod = this.getDemodulator() var demod = this.getDemodulator()
if (!demod) return; if (!demod) return;
this.el.find('[data-modulation=' + demod.get_modulation() + ']').addClass("highlighted"); 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); this.el.find('.openwebrx-secondary-demod-listbox').val(secondary_demod);
var mode = Modes.findByModulation(secondary_demod); var mode = Modes.findByModulation(secondary_demod);
if (mode) { if (mode) {
$buttons.filter(function(){ var self = this;
var mod = $(this).data('modulation'); mode.underlying.filter(function(m) {
return mod && mode.underlying.indexOf(mod) < 0; return m !== demod.get_modulation();
}).addClass('disabled'); }).forEach(function(m) {
self.el.find('[data-modulation=' + m + ']').addClass('same-mod')
});
} }
} else { } else {
this.el.find('.openwebrx-secondary-demod-listbox').val('none'); this.el.find('.openwebrx-secondary-demod-listbox').val('none');