|
|
@ -6,7 +6,6 @@ define(["dojo/_base/declare"], function (declare) {
|
|
|
|
_headlines_scroll_timeout: 0,
|
|
|
|
_headlines_scroll_timeout: 0,
|
|
|
|
headlines: [],
|
|
|
|
headlines: [],
|
|
|
|
current_first_id: 0,
|
|
|
|
current_first_id: 0,
|
|
|
|
catchup_id_batch: [],
|
|
|
|
|
|
|
|
row_observer: new MutationObserver((mutations) => {
|
|
|
|
row_observer: new MutationObserver((mutations) => {
|
|
|
|
const modified = [];
|
|
|
|
const modified = [];
|
|
|
|
|
|
|
|
|
|
|
@ -45,6 +44,8 @@ define(["dojo/_base/declare"], function (declare) {
|
|
|
|
const ops = {
|
|
|
|
const ops = {
|
|
|
|
tmark: [],
|
|
|
|
tmark: [],
|
|
|
|
tpub: [],
|
|
|
|
tpub: [],
|
|
|
|
|
|
|
|
read: [],
|
|
|
|
|
|
|
|
unread: [],
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
modified.each(function(m) {
|
|
|
|
modified.each(function(m) {
|
|
|
@ -53,6 +54,9 @@ define(["dojo/_base/declare"], function (declare) {
|
|
|
|
|
|
|
|
|
|
|
|
if (m.old.published != m.new.published)
|
|
|
|
if (m.old.published != m.new.published)
|
|
|
|
ops.tpub.push(m.id);
|
|
|
|
ops.tpub.push(m.id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (m.old.unread != m.new.unread)
|
|
|
|
|
|
|
|
m.new.unread ? ops.unread.push(m.id) : ops.read.push(m.id);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (ops.tmark.length != 0)
|
|
|
|
if (ops.tmark.length != 0)
|
|
|
@ -67,7 +71,19 @@ define(["dojo/_base/declare"], function (declare) {
|
|
|
|
App.handleRpcJson(transport);
|
|
|
|
App.handleRpcJson(transport);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
if (ops.read.length != 0)
|
|
|
|
|
|
|
|
xhrPost("backend.php",
|
|
|
|
|
|
|
|
{ op: "rpc", method: "catchupSelected", ids: ops.read.toString(), cmode: 0}, (transport) => {
|
|
|
|
|
|
|
|
App.handleRpcJson(transport);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ops.unread.length != 0)
|
|
|
|
|
|
|
|
xhrPost("backend.php",
|
|
|
|
|
|
|
|
{ op: "rpc", method: "catchupSelected", ids: ops.unread.toString(), cmode: 1}, (transport) => {
|
|
|
|
|
|
|
|
App.handleRpcJson(transport);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
click: function (event, id, in_body) {
|
|
|
|
click: function (event, id, in_body) {
|
|
|
|
in_body = in_body || false;
|
|
|
|
in_body = in_body || false;
|
|
|
|
|
|
|
|
|
|
|
@ -188,11 +204,7 @@ define(["dojo/_base/declare"], function (declare) {
|
|
|
|
const row = rows[i];
|
|
|
|
const row = rows[i];
|
|
|
|
|
|
|
|
|
|
|
|
if ($("headlines-frame").scrollTop > (row.offsetTop + row.offsetHeight / 2)) {
|
|
|
|
if ($("headlines-frame").scrollTop > (row.offsetTop + row.offsetHeight / 2)) {
|
|
|
|
const id = row.getAttribute("data-article-id")
|
|
|
|
row.removeClassName("Unread");
|
|
|
|
|
|
|
|
|
|
|
|
if (this.catchup_id_batch.indexOf(id) == -1)
|
|
|
|
|
|
|
|
this.catchup_id_batch.push(id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -625,8 +637,7 @@ define(["dojo/_base/declare"], function (declare) {
|
|
|
|
selectionToggleUnread: function (params) {
|
|
|
|
selectionToggleUnread: function (params) {
|
|
|
|
params = params || {};
|
|
|
|
params = params || {};
|
|
|
|
|
|
|
|
|
|
|
|
const cmode = params.cmode || 2;
|
|
|
|
const cmode = params.cmode != undefined ? params.cmode : 2;
|
|
|
|
const callback = params.callback;
|
|
|
|
|
|
|
|
const no_error = params.no_error || false;
|
|
|
|
const no_error = params.no_error || false;
|
|
|
|
const ids = params.ids || Headlines.getSelected();
|
|
|
|
const ids = params.ids || Headlines.getSelected();
|
|
|
|
|
|
|
|
|
|
|
@ -653,16 +664,6 @@ define(["dojo/_base/declare"], function (declare) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const query = {
|
|
|
|
|
|
|
|
op: "rpc", method: "catchupSelected",
|
|
|
|
|
|
|
|
cmode: cmode, ids: ids.toString()
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
xhrPost("backend.php", query, (transport) => {
|
|
|
|
|
|
|
|
App.handleRpcJson(transport);
|
|
|
|
|
|
|
|
if (callback) callback(transport);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
selectionToggleMarked: function (ids) {
|
|
|
|
selectionToggleMarked: function (ids) {
|
|
|
|
ids = ids || Headlines.getSelected();
|
|
|
|
ids = ids || Headlines.getSelected();
|
|
|
@ -798,7 +799,7 @@ define(["dojo/_base/declare"], function (declare) {
|
|
|
|
const row = $("RROW-" + id);
|
|
|
|
const row = $("RROW-" + id);
|
|
|
|
|
|
|
|
|
|
|
|
if (row) {
|
|
|
|
if (row) {
|
|
|
|
const origClassName = row.className;
|
|
|
|
//const origClassName = row.className;
|
|
|
|
|
|
|
|
|
|
|
|
if (cmode == undefined) cmode = 2;
|
|
|
|
if (cmode == undefined) cmode = 2;
|
|
|
|
|
|
|
|
|
|
|
@ -813,12 +814,6 @@ define(["dojo/_base/declare"], function (declare) {
|
|
|
|
row.toggleClassName("Unread");
|
|
|
|
row.toggleClassName("Unread");
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (row.className != origClassName)
|
|
|
|
|
|
|
|
xhrPost("backend.php",
|
|
|
|
|
|
|
|
{op: "rpc", method: "catchupSelected", cmode: cmode, ids: id}, (transport) => {
|
|
|
|
|
|
|
|
App.handleRpcJson(transport);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
selectionRemoveLabel: function (id, ids) {
|
|
|
|
selectionRemoveLabel: function (id, ids) {
|
|
|
@ -1043,38 +1038,7 @@ define(["dojo/_base/declare"], function (declare) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Headlines.selectionToggleUnread({callback: Feeds.reloadCurrent, no_error: 1});
|
|
|
|
Headlines.selectionToggleUnread({ids: rows, cmode: 0});
|
|
|
|
},
|
|
|
|
|
|
|
|
catchupBatched: function (callback) {
|
|
|
|
|
|
|
|
console.log("catchupBatched, size=", this.catchup_id_batch.length);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.catchup_id_batch.length > 0) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// make a copy of the array
|
|
|
|
|
|
|
|
const batch = this.catchup_id_batch.slice();
|
|
|
|
|
|
|
|
const query = {
|
|
|
|
|
|
|
|
op: "rpc", method: "catchupSelected",
|
|
|
|
|
|
|
|
cmode: 0, ids: batch.toString()
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
xhrPost("backend.php", query, (transport) => {
|
|
|
|
|
|
|
|
const reply = App.handleRpcJson(transport);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (reply) {
|
|
|
|
|
|
|
|
const batch = reply.ids;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
batch.each(function (id) {
|
|
|
|
|
|
|
|
const elem = $("RROW-" + id);
|
|
|
|
|
|
|
|
if (elem) elem.removeClassName("Unread");
|
|
|
|
|
|
|
|
Headlines.catchup_id_batch.remove(id);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (callback) callback();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (callback) callback();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
catchupRelativeTo: function (below, id) {
|
|
|
|
catchupRelativeTo: function (below, id) {
|
|
|
|
|
|
|
|
|
|
|
|