implement clear function for js8, too - refs #187

This commit is contained in:
Jakob Ketterl 2020-12-09 21:19:22 +01:00
parent aa66e69c15
commit 9e45cfd02a
4 changed files with 31 additions and 8 deletions

View File

@ -61,14 +61,7 @@
</div>
</div>
<div class="openwebrx-panel openwebrx-message-panel" id="openwebrx-panel-wsjt-message" style="display: none; width: 619px;" data-panel-name="wsjt-message"></div>
<table class="openwebrx-panel openwebrx-message-panel" id="openwebrx-panel-js8-message" style="display:none; width: 619px;" data-panel-name="js8-message">
<thead><tr>
<th>UTC</th>
<th class="decimal freq">Freq</th>
<th class="message">Message</th>
</tr></thead>
<tbody></tbody>
</table>
<div class="openwebrx-panel openwebrx-message-panel" id="openwebrx-panel-js8-message" style="display:none; width: 619px;" data-panel-name="js8-message"></div>
<div class="openwebrx-panel openwebrx-message-panel" id="openwebrx-panel-packet-message" style="display: none; width: 619px;" data-panel-name="aprs-message"></div>
<div class="openwebrx-panel openwebrx-message-panel" id="openwebrx-panel-pocsag-message" style="display: none; width: 619px;" data-panel-name="pocsag-message"></div>
<div class="openwebrx-panel openwebrx-meta-panel" id="openwebrx-panel-metadata-ysf" style="display: none;" data-panel-name="metadata-ysf">

View File

@ -100,7 +100,13 @@ Js8Thread.prototype.purgeOldMessages = function() {
return this.messages.length;
};
Js8Thread.prototype.purge = function() {
this.message = [];
this.el.remove();
};
Js8Threader = function(el){
MessagePanel.call(this, el);
this.threads = [];
this.tbody = $(el).find('tbody');
var me = this;
@ -109,6 +115,28 @@ Js8Threader = function(el){
}, 15000);
};
Js8Threader.prototype = new MessagePanel();
Js8Threader.prototype.render = function() {
$(this.el).append($(
'<table>' +
'<thead><tr>' +
'<th>UTC</th>' +
'<th class="decimal freq">Freq</th>' +
'<th class="message">Message</th>' +
'</tr></thead>' +
'<tbody></tbody>' +
'</table>'
));
};
Js8Threader.prototype.clearMessages = function() {
this.threads.forEach(function(t) {
t.purge();
});
this.threads = [];
};
Js8Threader.prototype.purgeOldMessages = function() {
this.threads = this.threads.filter(function(t) {
return t.purgeOldMessages();

View File

@ -1456,6 +1456,7 @@ function secondary_demod_init() {
$('#openwebrx-panel-wsjt-message').wsjtMessagePanel();
$('#openwebrx-panel-packet-message').packetMessagePanel();
$('#openwebrx-panel-pocsag-message').pocsagMessagePanel();
$('#openwebrx-panel-js8-message').js8();
}
function secondary_demod_push_data(x) {

View File

@ -126,6 +126,7 @@ class CompiledAssetsController(GzipMixin, ModificationAwareController):
"lib/ProgressBar.js",
"lib/Measurement.js",
"lib/FrequencyDisplay.js",
"lib/MessagePanel.js",
"lib/Js8Threads.js",
"lib/Modes.js",
],