render feed icon markup on the client

This commit is contained in:
Andrew Dolgov 2021-02-19 17:40:11 +03:00
parent d445530fa0
commit 737cffc241
3 changed files with 10 additions and 8 deletions

View File

@ -298,11 +298,7 @@ class Feeds extends Handler_Protected {
$this->_mark_timestamp(" tags"); $this->_mark_timestamp(" tags");
if (self::_has_icon($feed_id)) { $line['has_icon'] = self::_has_icon($feed_id);
$line['feed_icon'] = "<img class=\"icon\" src=\"".ICONS_URL."/$feed_id.ico\" alt=\"\">";
} else {
$line['feed_icon'] = "<i class='icon-no-feed material-icons'>rss_feed</i>";
}
//setting feed headline background color, needs to change text color based on dark/light //setting feed headline background color, needs to change text color based on dark/light
$fav_color = $line['favicon_avg_color'] ?? false; $fav_color = $line['favicon_avg_color'] ?? false;

View File

@ -633,4 +633,9 @@ const Feeds = {
// //
}); });
}, },
renderIcon: function(feed_id, exists) {
return feed_id && exists ?
`<img class="icon" src="${App.escapeHtml(App.getInitParam("icons_url"))}/${feed_id}.ico">` :
`<i class='icon-no-feed material-icons'>rss_feed</i>`;
}
}; };

View File

@ -423,7 +423,7 @@ const Headlines = {
if (headlines.vfeed_group_enabled && hl.feed_title && this.vgroup_last_feed != hl.feed_id) { if (headlines.vfeed_group_enabled && hl.feed_title && this.vgroup_last_feed != hl.feed_id) {
const vgrhdr = `<div data-feed-id='${hl.feed_id}' class='feed-title'> const vgrhdr = `<div data-feed-id='${hl.feed_id}' class='feed-title'>
<div style='float : right'>${hl.feed_icon}</div> <div style='float : right'>${Feeds.renderIcon(hl.feed_id, hl.has_icon)}</div>
<a class="title" href="#" onclick="Feeds.open({feed:${hl.feed_id}})">${hl.feed_title} <a class="title" href="#" onclick="Feeds.open({feed:${hl.feed_id}})">${hl.feed_title}
<a class="catchup" title="${__('mark feed as read')}" onclick="Feeds.catchupFeedInGroup(${hl.feed_id})" href="#"><i class="icon-done material-icons">done_all</i></a> <a class="catchup" title="${__('mark feed as read')}" onclick="Feeds.catchupFeedInGroup(${hl.feed_id})" href="#"><i class="icon-done material-icons">done_all</i></a>
</div>` </div>`
@ -477,7 +477,8 @@ const Headlines = {
<i class="material-icons icon-score" title="${hl.score}" onclick="Article.setScore(${hl.id}, this)">${Article.getScorePic(hl.score)}</i> <i class="material-icons icon-score" title="${hl.score}" onclick="Article.setScore(${hl.id}, this)">${Article.getScorePic(hl.score)}</i>
<span style="cursor : pointer" title="${App.escapeHtml(hl.feed_title)}" onclick="Feeds.open({feed:${hl.feed_id}})"> <span style="cursor : pointer" title="${App.escapeHtml(hl.feed_title)}" onclick="Feeds.open({feed:${hl.feed_id}})">
${hl.feed_icon}</span> ${Feeds.renderIcon(hl.feed_id, hl.has_icon)}
</span>
</div> </div>
</div> </div>
@ -538,7 +539,7 @@ const Headlines = {
</div> </div>
<div class="right"> <div class="right">
<i class="material-icons icon-score" title="${hl.score}" onclick="Article.setScore(${hl.id}, this)">${Article.getScorePic(hl.score)}</i> <i class="material-icons icon-score" title="${hl.score}" onclick="Article.setScore(${hl.id}, this)">${Article.getScorePic(hl.score)}</i>
<span onclick="Feeds.open({feed:${hl.feed_id}})" style="cursor : pointer" title="${App.escapeHtml(hl.feed_title)}">${hl.feed_icon}</span> <span onclick="Feeds.open({feed:${hl.feed_id}})" style="cursor : pointer" title="${App.escapeHtml(hl.feed_title)}">${Feeds.renderIcon(hl.feed_id, hl.has_icon)}</span>
</div> </div>
</div> </div>
`; `;