feature detection based activation of the rds panel

This commit is contained in:
Jakob Ketterl 2024-01-20 01:01:48 +01:00
parent d8cc9e73e3
commit fcf07b98af
3 changed files with 4 additions and 12 deletions

View file

@ -149,7 +149,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="openwebrx-panel openwebrx-meta-panel" id="openwebrx-panel-metadata-wfm" style="display: none;" data-panel-name="metadata-wfm"></div> <div class="openwebrx-panel openwebrx-meta-panel disabled" id="openwebrx-panel-metadata-wfm" style="display: none;" data-panel-name="metadata-wfm"></div>
<div class="openwebrx-panel" id="openwebrx-panel-log" data-panel-name="debug" style="width: 619px;"> <div class="openwebrx-panel" id="openwebrx-panel-log" data-panel-name="debug" style="width: 619px;">
<div class="openwebrx-panel-inner nano" id="openwebrx-log-scroll"> <div class="openwebrx-panel-inner nano" id="openwebrx-log-scroll">
<div class="nano-content"> <div class="nano-content">

View file

@ -175,7 +175,7 @@ DemodulatorPanel.prototype.updatePanels = function() {
var showing = 'openwebrx-panel-metadata-' + modulation; var showing = 'openwebrx-panel-metadata-' + modulation;
var metaPanels = $(".openwebrx-meta-panel"); var metaPanels = $(".openwebrx-meta-panel");
metaPanels.each(function (_, p) { metaPanels.each(function (_, p) {
toggle_panel(p.id, p.id === showing); toggle_panel(p.id, p.id === showing && !p.classList.contains('disabled'));
}); });
metaPanels.metaPanel().each(function() { metaPanels.metaPanel().each(function() {
this.clear(); this.clear();

View file

@ -10,10 +10,6 @@ MetaPanel.prototype.isSupported = function(data) {
return this.modes.includes(data.protocol); return this.modes.includes(data.protocol);
}; };
MetaPanel.prototype.isEnabled = function() {
return true;
};
MetaPanel.prototype.clear = function() { MetaPanel.prototype.clear = function() {
this.el.find(".openwebrx-meta-slot").removeClass("active").removeClass("sync"); this.el.find(".openwebrx-meta-slot").removeClass("active").removeClass("sync");
}; };
@ -521,7 +517,7 @@ WfmMetaPanel.prototype.setEnabled = function(enabled) {
if (enabled === this.enabled) return; if (enabled === this.enabled) return;
this.enabled = enabled; this.enabled = enabled;
if (enabled) { if (enabled) {
$(this.el).html( $(this.el).removeClass('disabled').html(
'<div class="rds-container">' + '<div class="rds-container">' +
'<div class="rds-identifier rds-autoclear"></div>' + '<div class="rds-identifier rds-autoclear"></div>' +
'<div class="rds-stationname rds-autoclear"></div>' + '<div class="rds-stationname rds-autoclear"></div>' +
@ -538,14 +534,10 @@ WfmMetaPanel.prototype.setEnabled = function(enabled) {
'</div>' '</div>'
); );
} else { } else {
$(this.el).emtpy() $(this.el).addClass('disabled').emtpy()
} }
}; };
WfmMetaPanel.prototype.isEnabled = function() {
return this.enabled;
};
WfmMetaPanel.prototype.clear = function() { WfmMetaPanel.prototype.clear = function() {
$(this.el).find('.rds-autoclear').empty(); $(this.el).find('.rds-autoclear').empty();
this.pi = ''; this.pi = '';