summaryrefslogtreecommitdiff
path: root/js/Headlines.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2018-12-07 09:09:09 +0300
committerAndrew Dolgov <[email protected]>2018-12-07 09:09:09 +0300
commitc4b01dd547e16bb042bfba1df4ec716e1d2fbce3 (patch)
tree46943c67e3efa4afadc8a2f248c5f2fdae293812 /js/Headlines.js
parent8458dc2082cd7f579c83dc020db31b29386186aa (diff)
updateFloatingTitle: sync row marked/published status
Diffstat (limited to 'js/Headlines.js')
-rwxr-xr-xjs/Headlines.js19
1 files changed, 16 insertions, 3 deletions
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);