From 8f75b06835aa714e57501efe9d82ec9ffc285a62 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 7 Dec 2018 21:11:50 +0300 Subject: implement feed grouping display, remove unneeded server vgrlf passing --- js/Feeds.js | 5 ----- js/Headlines.js | 29 ++++++++++++++++++++++++----- 2 files changed, 24 insertions(+), 10 deletions(-) (limited to 'js') diff --git a/js/Feeds.js b/js/Feeds.js index 3d6bc713e..a896727a7 100644 --- a/js/Feeds.js +++ b/js/Feeds.js @@ -340,11 +340,6 @@ define(["dojo/_base/declare"], function (declare) { if (offset != 0) { query.skip = offset; - - // to prevent duplicate feed titles when showing grouped vfeeds - if (Headlines.vgroup_last_feed != undefined) { - query.vgrlf = Headlines.vgroup_last_feed; - } } else if (!is_cat && feed == this.getActive() && !params.method) { query.m = "ForceUpdate"; } diff --git a/js/Headlines.js b/js/Headlines.js index 376adbfd1..85467936c 100755 --- a/js/Headlines.js +++ b/js/Headlines.js @@ -248,6 +248,22 @@ define(["dojo/_base/declare"], function (declare) { if (hl.published) row_class += " published"; if (hl.unread) row_class += " Unread"; + + if (headlines.vfeed_group_enabled && hl.feed_title && this.vgroup_last_feed != hl.feed_id) { + let vgrhdr = `
+
${hl.feed_icon}
+ ${hl.feed_title} + ${__('mark feed as read')} +
` + + const tmp = document.createElement("div"); + tmp.innerHTML = vgrhdr; + + $("headlines-frame").appendChild(tmp.firstChild); + + this.vgroup_last_feed = hl.feed_id; + } + if (App.isCombinedMode()) { row_class += App.getInitParam("cdm_expanded") ? " expanded" : " expandable"; @@ -343,11 +359,13 @@ define(["dojo/_base/declare"], function (declare) { `; } - const tmp = document.createElement("div"); - tmp.innerHTML = row; - dojo.parser.parse(tmp); + if (row != null) { + const tmp = document.createElement("div"); + tmp.innerHTML = row; + dojo.parser.parse(tmp); - $("headlines-frame").appendChild(tmp.firstChild); + $("headlines-frame").appendChild(tmp.firstChild); + } }, onLoaded: function (transport, offset) { const reply = App.handleRpcJson(transport); @@ -390,11 +408,12 @@ define(["dojo/_base/declare"], function (declare) { console.log('received', headlines_count, 'headlines, infscroll disabled=', Feeds.infscroll_disabled); - this.vgroup_last_feed = reply['headlines-info']['vgroup_last_feed']; + //this.vgroup_last_feed = reply['headlines-info']['vgroup_last_feed']; this.current_first_id = reply['headlines']['first_id']; if (offset == 0) { this.loaded_article_ids = []; + this.vgroup_last_feed = undefined; dojo.html.set($("toolbar-headlines"), reply['headlines']['toolbar'], -- cgit v1.2.3