diff js/feed-preview.js @ 9:fcd65cf3f634

Simplify the hint shown if there are no entries Always create the element and hide it with CSS if there are entries.
author Guido Berhoerster <guido+feed-preview@berhoerster.name>
date Tue, 27 Nov 2018 16:05:14 +0100
parents 5d7c13e998e9
children ff5e5e3eba32
line wrap: on
line diff
--- a/js/feed-preview.js	Tue Nov 27 11:11:15 2018 +0100
+++ b/js/feed-preview.js	Tue Nov 27 16:05:14 2018 +0100
@@ -36,6 +36,9 @@
         feedPreviewDocument.querySelector('#feed-header').prepend(logoNode);
     }
 
+    feedPreviewDocument.querySelector("#no-entries-hint").textContent =
+            browser.i18n.getMessage('noEntriesHint');
+
     let entryTemplateElement =
             feedPreviewDocument.querySelector('#entry-template');
     let entryTitleTemplateElement =
@@ -46,16 +49,6 @@
             feedPreviewDocument.querySelector('#entry-files-list-template');
     let entryFileTemplateElement =
             feedPreviewDocument.querySelector('#entry-file-template');
-    if (feed.entries.length === 0) {
-        let hintTemplateElement =
-                previewDocument.querySelector('#no-entries-hint-template');
-        let hintNode = previewDocument.importNode(hintTemplateElement.content,
-                true);
-        hintNode.querySelector("#no-entries-hint").textContent =
-            browser.i18n.getMessage('noEntriesHint');
-
-        previewDocument.body.append(hintNode);
-    }
     for (let entry of feed.entries) {
         let entryNode =
                 feedPreviewDocument.importNode(entryTemplateElement.content,