From da165cbcd7324c7ba384cc3d0da4ef3080e12f9f Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Fri, 19 Jan 2024 16:38:13 +0100 Subject: [PATCH] allow multiple news items to be displayed --- htdocs/css/openwebrx.css | 11 ++++++++--- htdocs/lib/MetaPanel.js | 18 ++++++++++++++---- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/htdocs/css/openwebrx.css b/htdocs/css/openwebrx.css index ee63ff65..559eb810 100644 --- a/htdocs/css/openwebrx.css +++ b/htdocs/css/openwebrx.css @@ -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 { diff --git a/htdocs/lib/MetaPanel.js b/htdocs/lib/MetaPanel.js index a1cfccbe..ee524c68 100644 --- a/htdocs/lib/MetaPanel.js +++ b/htdocs/lib/MetaPanel.js @@ -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 '
  • ' + n + '
  • '; + })); $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) { '
    ' + '
    ' + '
    ' + - '
    ' + + '' + '
    ' + '
    ' + '
    ' +