Browse Source

remove empty feed title link when single feed

So themes can use `.feed:empty`
Jordan Galby 8 months ago
parent
commit
85d864a8a6
1 changed files with 11 additions and 7 deletions
  1. 11 7
      js/Headlines.js

+ 11 - 7
js/Headlines.js

@@ -421,6 +421,15 @@ define(["dojo/_base/declare"], function (declare) {
 				this.vgroup_last_feed = hl.feed_id;
 			}
 
+			// If feed_title is empty, don't emit an empty <a></a>,
+			// so css `.feed:empty { display: none; }` works
+			let feed_title_link = "";
+			if (hl.feed_title) {
+				feed_title_link =
+					`<a href="#" style="background-color: ${hl.feed_bg_color}"
+						onclick="Feeds.open({feed:${hl.feed_id}})">${hl.feed_title}</a>`;
+			}
+
 			if (App.isCombinedMode()) {
 				row_class += App.getInitParam("cdm_expanded") ? " expanded" : " expandable";
 
@@ -446,10 +455,7 @@ define(["dojo/_base/declare"], function (declare) {
 									${hl.cdm_excerpt ? hl.cdm_excerpt : ""}
 								</span>
 								
-								<div class="feed">
-									<a href="#" style="background-color: ${hl.feed_bg_color}"
-										onclick="Feeds.open({feed:${hl.feed_id}})">${hl.feed_title}</a>
-								</div>
+								<div class="feed">${feed_title_link}</div>
 								
 								<span class="updated" title="${hl.imported}">${hl.updated}</span>
 								
@@ -505,9 +511,7 @@ define(["dojo/_base/declare"], function (declare) {
 						<span class="HLLCTR-${hl.id}">${hl.labels}</span>
 					</span>
 				</div>
-                <span class="feed">
-                	<a style="background : ${hl.feed_bg_color}" href="#" onclick="Feeds.open({feed:${hl.feed_id}})">${hl.feed_title}</a>
-                </span>
+				<span class="feed">${feed_title_link}</span>
 				<div title="${hl.imported}">
 				  <span class="updated">${hl.updated}</span>
 				</div>