allow multiple news items to be displayed

This commit is contained in:
Jakob Ketterl 2024-01-19 16:38:13 +01:00
parent 84212a52de
commit da165cbcd7
2 changed files with 22 additions and 7 deletions

View file

@ -1341,7 +1341,11 @@ img.openwebrx-mirror-img
.rds-container {
width: 100%;
text-align: center;
overflow: hidden scroll;
overflow: hidden auto;
}
.rds-container > *, .rds-radiotext-plus > * {
margin: 2px 0;
}
.rds-container .rds-stationname {
@ -1364,8 +1368,9 @@ img.openwebrx-mirror-img
content: "📅 ";
}
.rds-container .rds-radiotext-plus .rds-rtplus-news:not(:empty):before {
content: "📰 ";
.rds-container .rds-radiotext-plus ul.rds-rtplus-news {
list-style-type: "📰 ";
padding-left: 1.5lh;
}
.rds-container .rds-radiotext-plus .rds-rtplus-weather:not(:empty):before {

View file

@ -414,7 +414,8 @@ WfmMetaPanel.prototype.update = function(data) {
if ('radiotext_plus' in data) {
// prefer displaying radiotext plus over radiotext
this.radiotext_plus = this.radiotext_plus || {
item_toggle: -1
item_toggle: -1,
news: []
};
var tags = {};
@ -452,7 +453,14 @@ WfmMetaPanel.prototype.update = function(data) {
}
if ('info.news' in tags) {
this.radiotext_plus.news = tags['info.news'];
var n = tags['info.news'];
var i = this.radiotext_plus.news.indexOf(n);
if (i >= 0) {
this.radiotext_plus.news.splice(i, 1);
}
this.radiotext_plus.news.push(n);
// limit the number of items
this.radiotext_plus.news = this.radiotext_plus.news.slice(-5);
}
if ('info.weather' in tags) {
@ -473,7 +481,9 @@ WfmMetaPanel.prototype.update = function(data) {
$el.find('.rds-rtplus-item').empty();
}
$el.find('.rds-rtplus-programme').text(this.radiotext_plus.programme || '');
$el.find('.rds-rtplus-news').text(this.radiotext_plus.news || '');
$el.find('.rds-rtplus-news').empty().html(this.radiotext_plus.news.map(function(n){
return '<li>' + n + '</li>';
}));
$el.find('.rds-rtplus-weather').text(this.radiotext_plus.weather || '');
if (this.radiotext_plus.homepage) {
$el.find('.rds-rtplus-homepage').html(
@ -505,7 +515,7 @@ WfmMetaPanel.prototype.setEnabled = function(enabled) {
'<div class="rds-radiotext-plus">' +
'<div class="rds-rtplus-programme rds-autoclear"></div>' +
'<div class="rds-rtplus-item rds-autoclear"></div>' +
'<div class="rds-rtplus-news rds-autoclear"></div>' +
'<ul class="rds-rtplus-news rds-autoclear"></ul>' +
'<div class="rds-rtplus-weather rds-autoclear"></div>' +
'<div class="rds-rtplus-homepage rds-autoclear"></div>' +
'</div>' +