apply CSS magic to DMR, too

This commit is contained in:
Jakob Ketterl 2021-01-19 20:54:35 +01:00
parent 6e416d0839
commit 6e60247026
2 changed files with 28 additions and 10 deletions

View File

@ -932,7 +932,8 @@ img.openwebrx-mirror-img
.openwebrx-meta-slot > * { .openwebrx-meta-slot > * {
flex: 0; flex: 0;
flex-basis: 1.125em; flex-basis: 1.2em;
line-height: 1.2em;
} }
.openwebrx-meta-slot, .openwebrx-meta-slot.muted:before { .openwebrx-meta-slot, .openwebrx-meta-slot.muted:before {
@ -982,10 +983,18 @@ img.openwebrx-mirror-img
background-image: url("../gfx/openwebrx-directcall.png"); background-image: url("../gfx/openwebrx-directcall.png");
} }
.openwebrx-meta-slot.active .openwebrx-meta-user-image.group { .openwebrx-meta-slot.active.group .openwebrx-meta-user-image {
background-image: url("../gfx/openwebrx-groupcall.png"); background-image: url("../gfx/openwebrx-groupcall.png");
} }
.openwebrx-meta-slot.group .openwebrx-dmr-target:not(:empty):before {
content: "Talkgroup: ";
}
.openwebrx-meta-slot.direct .openwebrx-dmr-target:not(:empty):before {
content: "Direct: ";
}
.openwebrx-dmr-timeslot-panel * { .openwebrx-dmr-timeslot-panel * {
cursor: pointer; cursor: pointer;
} }

View File

@ -24,12 +24,8 @@ DmrMetaSlot.prototype.update = function(data) {
if (data['sync'] && data['sync'] === "voice") { if (data['sync'] && data['sync'] === "voice") {
this.setId(data['additional'] && data['additional']['callsign'] || data['source']); this.setId(data['additional'] && data['additional']['callsign'] || data['source']);
this.setName(data['additional'] && data['additional']['fname']); this.setName(data['additional'] && data['additional']['fname']);
if (data['type'] === "group") { this.setMode(['group', 'direct'].includes(data['type']) ? data['type'] : undefined);
this.setTalkgroup(data['target']); this.setTarget(data['target']);
}
if (data['type'] === "direct") {
this.setDirect(data['target']);
}
this.el.addClass("active"); this.el.addClass("active");
} else { } else {
this.clear(); this.clear();
@ -48,6 +44,19 @@ DmrMetaSlot.prototype.setName = function(name) {
this.el.find('.openwebrx-dmr-name').text(name || ''); this.el.find('.openwebrx-dmr-name').text(name || '');
}; };
DmrMetaSlot.prototype.setMode = function(mode) {
var classes = ['group', 'direct'].filter(function(c){
return c !== mode;
});
this.el.removeClass(classes.join(' ')).addClass(mode);
}
DmrMetaSlot.prototype.setTarget = function(target) {
if (this.target === target) return;
this.target = target;
this.el.find('.openwebrx-dmr-target').text(target || '');
}
DmrMetaSlot.prototype.setTalkgroup = function(talkgroup) { DmrMetaSlot.prototype.setTalkgroup = function(talkgroup) {
if (this.talkgroup === talkgroup && this.targetMode === 'talkgroup') return; if (this.talkgroup === talkgroup && this.targetMode === 'talkgroup') return;
this.talkgroup = talkgroup; this.talkgroup = talkgroup;
@ -75,8 +84,8 @@ DmrMetaSlot.prototype.setDirect = function(call) {
DmrMetaSlot.prototype.clear = function() { DmrMetaSlot.prototype.clear = function() {
this.setId(); this.setId();
this.setName(); this.setName();
this.setTalkgroup(); this.setMode();
this.setDirect(); this.setTarget();
this.el.removeClass("active"); this.el.removeClass("active");
}; };