move pocsag message panel

This commit is contained in:
Jakob Ketterl 2020-12-09 19:53:37 +01:00
parent 5474973752
commit 9bf4b149aa
3 changed files with 40 additions and 19 deletions

View File

@ -70,13 +70,7 @@
<tbody></tbody> <tbody></tbody>
</table> </table>
<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-packet-message" style="display: none; width: 619px;" data-panel-name="aprs-message"></div>
<table class="openwebrx-panel openwebrx-message-panel" id="openwebrx-panel-pocsag-message" style="display: none; width: 619px;" data-panel-name="pocsag-message"> <div class="openwebrx-panel openwebrx-message-panel" id="openwebrx-panel-pocsag-message" style="display: none; width: 619px;" data-panel-name="pocsag-message"></div>
<thead><tr>
<th class="address">Address</th>
<th class="message">Message</th>
</tr></thead>
<tbody></tbody>
</table>
<div class="openwebrx-panel openwebrx-meta-panel" id="openwebrx-panel-metadata-ysf" style="display: none;" data-panel-name="metadata-ysf"> <div class="openwebrx-panel openwebrx-meta-panel" id="openwebrx-panel-metadata-ysf" style="display: none;" data-panel-name="metadata-ysf">
<div class="openwebrx-meta-frame"> <div class="openwebrx-meta-frame">
<div class="openwebrx-meta-slot"> <div class="openwebrx-meta-slot">

View File

@ -191,3 +191,40 @@ $.fn.packetMessagePanel = function() {
}; };
return this.data('panel'); return this.data('panel');
}; };
PocsagMessagePanel = function(el) {
MessagePanel.call(this, el);
this.initClearTimer();
}
PocsagMessagePanel.prototype = new MessagePanel();
PocsagMessagePanel.prototype.render = function() {
$(this.el).append($(
'<table>' +
'<thead><tr>' +
'<th class="address">Address</th>' +
'<th class="message">Message</th>' +
'</tr></thead>' +
'<tbody></tbody>' +
'</table>'
));
};
PocsagMessagePanel.prototype.pushMessage = function(msg) {
var $b = $(this.el).find('tbody');
$b.append($(
'<tr>' +
'<td class="address">' + msg.address + '</td>' +
'<td class="message">' + msg.message + '</td>' +
'</tr>'
));
$b.scrollTop($b[0].scrollHeight);
};
$.fn.pocsagMessagePanel = function() {
if (!this.data('panel')) {
this.data('panel', new PocsagMessagePanel(this));
};
return this.data('panel');
};

View File

@ -805,7 +805,7 @@ function on_ws_recv(evt) {
divlog(json['value'], true); divlog(json['value'], true);
break; break;
case 'pocsag_data': case 'pocsag_data':
update_pocsag_panel(json['value']); $('#openwebrx-panel-pocsag-message').pocsagMessagePanel().pushMessage(json['value']);
break; break;
case 'backoff': case 'backoff':
divlog("Server is currently busy: " + json['reason'], true); divlog("Server is currently busy: " + json['reason'], true);
@ -941,17 +941,6 @@ function update_metadata(meta) {
} }
function update_pocsag_panel(msg) {
var $b = $('#openwebrx-panel-pocsag-message').find('tbody');
$b.append($(
'<tr>' +
'<td class="address">' + msg.address + '</td>' +
'<td class="message">' + msg.message + '</td>' +
'</tr>'
));
$b.scrollTop($b[0].scrollHeight);
}
function clear_metadata() { function clear_metadata() {
$(".openwebrx-meta-panel .openwebrx-meta-autoclear").text(""); $(".openwebrx-meta-panel .openwebrx-meta-autoclear").text("");
$(".openwebrx-meta-slot").removeClass("active").removeClass("sync"); $(".openwebrx-meta-slot").removeClass("active").removeClass("sync");
@ -1466,6 +1455,7 @@ function secondary_demod_init() {
.mouseleave(secondary_demod_canvas_container_mouseleave); .mouseleave(secondary_demod_canvas_container_mouseleave);
$('#openwebrx-panel-wsjt-message').wsjtMessagePanel(); $('#openwebrx-panel-wsjt-message').wsjtMessagePanel();
$('#openwebrx-panel-packet-message').packetMessagePanel(); $('#openwebrx-panel-packet-message').packetMessagePanel();
$('#openwebrx-panel-pocsag-message').pocsagMessagePanel();
} }
function secondary_demod_push_data(x) { function secondary_demod_push_data(x) {