Mercurial > addons > firefox-addons > feed-preview
comparison 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 |
comparison
equal
deleted
inserted
replaced
8:c271192aac9d | 9:fcd65cf3f634 |
---|---|
34 imgElement.setAttribute('src', feed.logo.url); | 34 imgElement.setAttribute('src', feed.logo.url); |
35 imgElement.setAttribute('alt', feed.logo.title); | 35 imgElement.setAttribute('alt', feed.logo.title); |
36 feedPreviewDocument.querySelector('#feed-header').prepend(logoNode); | 36 feedPreviewDocument.querySelector('#feed-header').prepend(logoNode); |
37 } | 37 } |
38 | 38 |
39 feedPreviewDocument.querySelector("#no-entries-hint").textContent = | |
40 browser.i18n.getMessage('noEntriesHint'); | |
41 | |
39 let entryTemplateElement = | 42 let entryTemplateElement = |
40 feedPreviewDocument.querySelector('#entry-template'); | 43 feedPreviewDocument.querySelector('#entry-template'); |
41 let entryTitleTemplateElement = | 44 let entryTitleTemplateElement = |
42 feedPreviewDocument.querySelector('#entry-title-template'); | 45 feedPreviewDocument.querySelector('#entry-title-template'); |
43 let entryTitleLinkedTemplateElement = | 46 let entryTitleLinkedTemplateElement = |
44 feedPreviewDocument.querySelector('#entry-title-linked-template'); | 47 feedPreviewDocument.querySelector('#entry-title-linked-template'); |
45 let entryFileListTemplateElement = | 48 let entryFileListTemplateElement = |
46 feedPreviewDocument.querySelector('#entry-files-list-template'); | 49 feedPreviewDocument.querySelector('#entry-files-list-template'); |
47 let entryFileTemplateElement = | 50 let entryFileTemplateElement = |
48 feedPreviewDocument.querySelector('#entry-file-template'); | 51 feedPreviewDocument.querySelector('#entry-file-template'); |
49 if (feed.entries.length === 0) { | |
50 let hintTemplateElement = | |
51 previewDocument.querySelector('#no-entries-hint-template'); | |
52 let hintNode = previewDocument.importNode(hintTemplateElement.content, | |
53 true); | |
54 hintNode.querySelector("#no-entries-hint").textContent = | |
55 browser.i18n.getMessage('noEntriesHint'); | |
56 | |
57 previewDocument.body.append(hintNode); | |
58 } | |
59 for (let entry of feed.entries) { | 52 for (let entry of feed.entries) { |
60 let entryNode = | 53 let entryNode = |
61 feedPreviewDocument.importNode(entryTemplateElement.content, | 54 feedPreviewDocument.importNode(entryTemplateElement.content, |
62 true); | 55 true); |
63 let titleElement; | 56 let titleElement; |