From d8cc9e73e3141671191b41ab356430c3d334adfa Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Fri, 19 Jan 2024 18:34:52 +0100 Subject: [PATCH] improve handling of homepage links --- htdocs/lib/MetaPanel.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/lib/MetaPanel.js b/htdocs/lib/MetaPanel.js index e5e5a9c6..1a2d7880 100644 --- a/htdocs/lib/MetaPanel.js +++ b/htdocs/lib/MetaPanel.js @@ -495,9 +495,14 @@ WfmMetaPanel.prototype.update = function(data) { })); $el.find('.rds-rtplus-weather').text(this.radiotext_plus.weather || ''); if (this.radiotext_plus.homepage) { - $el.find('.rds-rtplus-homepage').html( - '' + this.radiotext_plus.homepage + '' - ); + var url = this.radiotext_plus.homepage; + // prefix with a protcol if not present. we'll assume https, should be generally available these days. + if (url.indexOf('://') < 0) url = 'https://' + url; + // avoid updating the link if not necessary since that would prevent the user from clicking it + if ($el.find('.rds-rtplus-homepage a').attr('href') !== url) { + var link = $('').text(this.radiotext_plus.homepage); + $el.find('.rds-rtplus-homepage').html(link); + } } } else { $el.find('.rds-radiotext-plus .autoclear').empty();