summaryrefslogtreecommitdiff
path: root/js/Headlines.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/Headlines.js')
-rwxr-xr-xjs/Headlines.js17
1 files changed, 12 insertions, 5 deletions
diff --git a/js/Headlines.js b/js/Headlines.js
index 43837f65b..3685cd7ba 100755
--- a/js/Headlines.js
+++ b/js/Headlines.js
@@ -547,8 +547,6 @@ define(["dojo/_base/declare"], function (declare) {
return;
const headlines_count = reply['headlines-info']['count'];
- Feeds.infscroll_disabled = parseInt(headlines_count) != 30;
-
console.log('received', headlines_count, 'headlines, infscroll disabled=', Feeds.infscroll_disabled);
//this.vgroup_last_feed = reply['headlines-info']['vgroup_last_feed'];
@@ -623,18 +621,27 @@ define(["dojo/_base/declare"], function (declare) {
if (hsp)
c.domNode.removeChild(hsp);
+ let headlines_appended = 0;
+
if (typeof reply['headlines']['content'] == 'string') {
$("headlines-frame").innerHTML = reply['headlines']['content'];
} else {
for (let i = 0; i < reply['headlines']['content'].length; i++) {
const hl = reply['headlines']['content'][i];
- $("headlines-frame").appendChild(this.render(reply['headlines'], hl));
+ if (!this.headlines[parseInt(hl.id)]) {
+ $("headlines-frame").appendChild(this.render(reply['headlines'], hl));
- this.headlines[parseInt(hl.id)] = hl;
+ this.headlines[parseInt(hl.id)] = hl;
+ ++headlines_appended;
+ }
}
}
+ console.log('appended', headlines_appended, 'headlines');
+
+ Feeds.infscroll_disabled = headlines_appended != 30;
+
if (!hsp) {
hsp = document.createElement("div");
hsp.id = "headlines-spacer";
@@ -1383,4 +1390,4 @@ define(["dojo/_base/declare"], function (declare) {
}
return Headlines;
-}); \ No newline at end of file
+});