From c4b01dd547e16bb042bfba1df4ec716e1d2fbce3 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 7 Dec 2018 09:09:09 +0300 Subject: updateFloatingTitle: sync row marked/published status --- js/Headlines.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'js') diff --git a/js/Headlines.js b/js/Headlines.js index 130aee381..17b5499c2 100755 --- a/js/Headlines.js +++ b/js/Headlines.js @@ -155,7 +155,7 @@ define(["dojo/_base/declare"], function (declare) { console.warn("scrollHandler", e); } }, - updateFloatingTitle: function (unread_only) { + updateFloatingTitle: function (status_only) { if (!App.isCombinedMode()/* || !App.getInitParam("cdm_expanded")*/) return; const hf = $("headlines-frame"); @@ -170,7 +170,7 @@ define(["dojo/_base/declare"], function (declare) { const header = row.select(".header")[0]; const id = row.getAttribute("data-article-id"); - if (unread_only || id != ft.getAttribute("data-article-id")) { + if (status_only || id != ft.getAttribute("data-article-id")) { if (id != ft.getAttribute("data-article-id")) { ft.setAttribute("data-article-id", id); @@ -187,6 +187,16 @@ define(["dojo/_base/declare"], function (declare) { else ft.removeClassName("Unread"); + if (row.hasClassName("marked")) + ft.addClassName("marked"); + else + ft.removeClassName("marked"); + + if (row.hasClassName("published")) + ft.addClassName("published"); + else + ft.removeClassName("published"); + PluginHost.run(PluginHost.HOOK_FLOATING_TITLE, row); } @@ -495,10 +505,11 @@ define(["dojo/_base/declare"], function (declare) { const row = $("RROW-" + id); if (row) { - row.toggleClassName("marked"); query.mark = row.hasClassName("marked") ? 1 : 0; + Headlines.updateFloatingTitle(true); + if (!client_only) xhrPost("backend.php", query, (transport) => { App.handleRpcJson(transport); @@ -514,6 +525,8 @@ define(["dojo/_base/declare"], function (declare) { row.toggleClassName("published"); query.pub = row.hasClassName("published") ? 1 : 0; + Headlines.updateFloatingTitle(true); + if (!client_only) xhrPost("backend.php", query, (transport) => { App.handleRpcJson(transport); -- cgit v1.2.3