add some async counters handling
This commit is contained in:
parent
dcf7fd08d1
commit
1341ea0dbe
14
functions.js
14
functions.js
|
@ -712,7 +712,8 @@ function parse_counters(reply, scheduled_call) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (row_needs_hl) {
|
if (row_needs_hl) {
|
||||||
new Effect.Highlight(feedr, {duration: 1, startcolor: "#fff7d5"});
|
new Effect.Highlight(feedr, {duration: 1, startcolor: "#fff7d5",
|
||||||
|
queue: { position:'end', scope: 'EFQ-' + id, limit: 1 } } );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
feedctr.className = "invisible";
|
feedctr.className = "invisible";
|
||||||
|
@ -790,6 +791,17 @@ function parse_counters_reply(xmlhttp, scheduled_call) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function all_counters_callback2(transport) {
|
||||||
|
try {
|
||||||
|
debug("<b>all_counters_callback2 IN: " + transport + "</b>");
|
||||||
|
parse_counters_reply(transport);
|
||||||
|
debug("<b>all_counters_callback2 OUT: " + transport + "</b>");
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
exception_error("all_counters_callback2", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function all_counters_callback() {
|
function all_counters_callback() {
|
||||||
if (xmlhttp_rpc.readyState == 4) {
|
if (xmlhttp_rpc.readyState == 4) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -165,20 +165,22 @@
|
||||||
|
|
||||||
print "<counters>";
|
print "<counters>";
|
||||||
|
|
||||||
|
$omode = $_GET["omode"];
|
||||||
|
|
||||||
|
if (!$omode) $omode = "tflc";
|
||||||
|
|
||||||
|
if (strchr($omode, "l")) getLabelCounters($link);
|
||||||
|
|
||||||
|
if (strchr($omode, "c")) {
|
||||||
|
if (get_pref($link, 'ENABLE_FEED_CATS')) {
|
||||||
|
getCategoryCounters($link);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($global_unread_caller != $global_unread) {
|
if ($global_unread_caller != $global_unread) {
|
||||||
|
|
||||||
$omode = $_GET["omode"];
|
|
||||||
|
|
||||||
if (!$omode) $omode = "tflc";
|
|
||||||
|
|
||||||
if (strchr($omode, "l")) getLabelCounters($link);
|
|
||||||
if (strchr($omode, "f")) getFeedCounters($link);
|
if (strchr($omode, "f")) getFeedCounters($link);
|
||||||
if (strchr($omode, "t")) getTagCounters($link);
|
if (strchr($omode, "t")) getTagCounters($link);
|
||||||
if (strchr($omode, "c")) {
|
|
||||||
if (get_pref($link, 'ENABLE_FEED_CATS')) {
|
|
||||||
getCategoryCounters($link);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getGlobalCounters($link, $global_unread);
|
getGlobalCounters($link, $global_unread);
|
||||||
|
|
116
viewfeed.js
116
viewfeed.js
|
@ -1,5 +1,4 @@
|
||||||
var active_post_id = false;
|
var active_post_id = false;
|
||||||
var _catchup_callback_func = false;
|
|
||||||
var last_article_view = false;
|
var last_article_view = false;
|
||||||
var active_real_feed_id = false;
|
var active_real_feed_id = false;
|
||||||
|
|
||||||
|
@ -33,6 +32,19 @@ function catchup_callback() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function catchup_callback2(transport, callback) {
|
||||||
|
try {
|
||||||
|
debug("catchup_callback2 " + transport + ", " + callback);
|
||||||
|
notify("");
|
||||||
|
all_counters_callback2(transport);
|
||||||
|
if (callback) {
|
||||||
|
setTimeout(callback, 10);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
exception_error("catchup_callback2", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function headlines_callback() {
|
function headlines_callback() {
|
||||||
if (xmlhttp.readyState == 4) {
|
if (xmlhttp.readyState == 4) {
|
||||||
debug("headlines_callback");
|
debug("headlines_callback");
|
||||||
|
@ -376,11 +388,6 @@ function toggleMark(id, client_only, no_effects) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (!xmlhttp_ready(xmlhttp_rpc)) {
|
|
||||||
printLockingError();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var query = "backend.php?op=rpc&id=" + id + "&subop=mark";
|
var query = "backend.php?op=rpc&id=" + id + "&subop=mark";
|
||||||
|
|
||||||
query = query + "&afid=" + getActiveFeedId();
|
query = query + "&afid=" + getActiveFeedId();
|
||||||
|
@ -443,9 +450,15 @@ function toggleMark(id, client_only, no_effects) {
|
||||||
if (!client_only) {
|
if (!client_only) {
|
||||||
debug(query);
|
debug(query);
|
||||||
|
|
||||||
xmlhttp_rpc.open("GET", query, true);
|
// xmlhttp_rpc.open("GET", query, true);
|
||||||
xmlhttp_rpc.onreadystatechange=all_counters_callback;
|
// xmlhttp_rpc.onreadystatechange=all_counters_callback;
|
||||||
xmlhttp_rpc.send(null);
|
// xmlhttp_rpc.send(null);
|
||||||
|
|
||||||
|
new Ajax.Request(query, {
|
||||||
|
onComplete: function(transport) {
|
||||||
|
all_counters_callback2(transport);
|
||||||
|
} });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -457,11 +470,6 @@ function togglePub(id, client_only, no_effects) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (!xmlhttp_ready(xmlhttp_rpc)) {
|
|
||||||
printLockingError();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var query = "backend.php?op=rpc&id=" + id + "&subop=publ";
|
var query = "backend.php?op=rpc&id=" + id + "&subop=publ";
|
||||||
|
|
||||||
query = query + "&afid=" + getActiveFeedId();
|
query = query + "&afid=" + getActiveFeedId();
|
||||||
|
@ -522,9 +530,10 @@ function togglePub(id, client_only, no_effects) {
|
||||||
new Ajax.Request(query); */
|
new Ajax.Request(query); */
|
||||||
|
|
||||||
if (!client_only) {
|
if (!client_only) {
|
||||||
xmlhttp_rpc.open("GET", query, true);
|
new Ajax.Request(query, {
|
||||||
xmlhttp_rpc.onreadystatechange=all_counters_callback;
|
onComplete: function(transport) {
|
||||||
xmlhttp_rpc.send(null);
|
all_counters_callback2(transport);
|
||||||
|
} });
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -609,10 +618,6 @@ function moveToPost(mode) {
|
||||||
|
|
||||||
function toggleUnread(id, cmode) {
|
function toggleUnread(id, cmode) {
|
||||||
try {
|
try {
|
||||||
if (!xmlhttp_ready(xmlhttp_rpc)) {
|
|
||||||
printLockingError();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var row = document.getElementById("RROW-" + id);
|
var row = document.getElementById("RROW-" + id);
|
||||||
if (row) {
|
if (row) {
|
||||||
|
@ -631,11 +636,12 @@ function toggleUnread(id, cmode) {
|
||||||
var query = "backend.php?op=rpc&subop=catchupSelected&ids=" +
|
var query = "backend.php?op=rpc&subop=catchupSelected&ids=" +
|
||||||
param_escape(id) + "&cmode=" + param_escape(cmode);
|
param_escape(id) + "&cmode=" + param_escape(cmode);
|
||||||
|
|
||||||
notify_progress("Loading, please wait...");
|
// notify_progress("Loading, please wait...");
|
||||||
|
|
||||||
xmlhttp_rpc.open("GET", query, true);
|
new Ajax.Request(query, {
|
||||||
xmlhttp_rpc.onreadystatechange=all_counters_callback;
|
onComplete: function(transport) {
|
||||||
xmlhttp_rpc.send(null);
|
all_counters_callback2(transport);
|
||||||
|
} });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -647,10 +653,10 @@ function toggleUnread(id, cmode) {
|
||||||
|
|
||||||
function selectionToggleUnread(cdm_mode, set_state, callback_func, no_error) {
|
function selectionToggleUnread(cdm_mode, set_state, callback_func, no_error) {
|
||||||
try {
|
try {
|
||||||
if (!xmlhttp_ready(xmlhttp_rpc)) {
|
/* if (!xmlhttp_ready(xmlhttp_rpc)) {
|
||||||
printLockingError();
|
printLockingError();
|
||||||
return;
|
return;
|
||||||
}
|
} */
|
||||||
|
|
||||||
var rows;
|
var rows;
|
||||||
|
|
||||||
|
@ -705,13 +711,20 @@ function selectionToggleUnread(cdm_mode, set_state, callback_func, no_error) {
|
||||||
var query = "backend.php?op=rpc&subop=catchupSelected&ids=" +
|
var query = "backend.php?op=rpc&subop=catchupSelected&ids=" +
|
||||||
param_escape(rows.toString()) + "&cmode=" + cmode;
|
param_escape(rows.toString()) + "&cmode=" + cmode;
|
||||||
|
|
||||||
_catchup_callback_func = callback_func;
|
// _catchup_callback_func = callback_func;
|
||||||
|
|
||||||
|
debug(callback_func);
|
||||||
|
|
||||||
notify_progress("Loading, please wait...");
|
notify_progress("Loading, please wait...");
|
||||||
|
|
||||||
xmlhttp_rpc.open("GET", query, true);
|
/* xmlhttp_rpc.open("GET", query, true);
|
||||||
xmlhttp_rpc.onreadystatechange=catchup_callback;
|
xmlhttp_rpc.onreadystatechange=catchup_callback;
|
||||||
xmlhttp_rpc.send(null);
|
xmlhttp_rpc.send(null); */
|
||||||
|
|
||||||
|
new Ajax.Request(query, {
|
||||||
|
onComplete: function(transport) {
|
||||||
|
catchup_callback2(transport, callback_func);
|
||||||
|
} });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -722,10 +735,6 @@ function selectionToggleUnread(cdm_mode, set_state, callback_func, no_error) {
|
||||||
|
|
||||||
function selectionToggleMarked(cdm_mode) {
|
function selectionToggleMarked(cdm_mode) {
|
||||||
try {
|
try {
|
||||||
if (!xmlhttp_ready(xmlhttp_rpc)) {
|
|
||||||
printLockingError();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var rows;
|
var rows;
|
||||||
|
|
||||||
|
@ -751,15 +760,18 @@ function selectionToggleMarked(cdm_mode) {
|
||||||
|
|
||||||
query = query + "&afid=" + getActiveFeedId();
|
query = query + "&afid=" + getActiveFeedId();
|
||||||
|
|
||||||
if (tagsAreDisplayed()) {
|
/* if (tagsAreDisplayed()) {
|
||||||
query = query + "&omode=tl";
|
query = query + "&omode=tl";
|
||||||
} else {
|
} else {
|
||||||
query = query + "&omode=flc";
|
query = query + "&omode=flc";
|
||||||
}
|
} */
|
||||||
|
|
||||||
xmlhttp_rpc.open("GET", query, true);
|
query = query + "&omode=lc";
|
||||||
xmlhttp_rpc.onreadystatechange=all_counters_callback;
|
|
||||||
xmlhttp_rpc.send(null);
|
new Ajax.Request(query, {
|
||||||
|
onComplete: function(transport) {
|
||||||
|
all_counters_callback2(transport);
|
||||||
|
} });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -770,10 +782,6 @@ function selectionToggleMarked(cdm_mode) {
|
||||||
|
|
||||||
function selectionTogglePublished(cdm_mode) {
|
function selectionTogglePublished(cdm_mode) {
|
||||||
try {
|
try {
|
||||||
if (!xmlhttp_ready(xmlhttp_rpc)) {
|
|
||||||
printLockingError();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var rows;
|
var rows;
|
||||||
|
|
||||||
|
@ -799,15 +807,18 @@ function selectionTogglePublished(cdm_mode) {
|
||||||
|
|
||||||
query = query + "&afid=" + getActiveFeedId();
|
query = query + "&afid=" + getActiveFeedId();
|
||||||
|
|
||||||
if (tagsAreDisplayed()) {
|
/* if (tagsAreDisplayed()) {
|
||||||
query = query + "&omode=tl";
|
query = query + "&omode=tl";
|
||||||
} else {
|
} else {
|
||||||
query = query + "&omode=flc";
|
query = query + "&omode=flc";
|
||||||
}
|
} */
|
||||||
|
|
||||||
xmlhttp_rpc.open("GET", query, true);
|
query = query + "&omode=lc";
|
||||||
xmlhttp_rpc.onreadystatechange=all_counters_callback;
|
|
||||||
xmlhttp_rpc.send(null);
|
new Ajax.Request(query, {
|
||||||
|
onComplete: function(transport) {
|
||||||
|
all_counters_callback2(transport);
|
||||||
|
} });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1125,7 +1136,7 @@ function cdmWatchdog() {
|
||||||
|
|
||||||
debug("cdmWatchdog, ids= " + ids.toString());
|
debug("cdmWatchdog, ids= " + ids.toString());
|
||||||
|
|
||||||
if (ids.length > 0 && xmlhttp_ready(xmlhttp_rpc)) {
|
if (ids.length > 0) {
|
||||||
|
|
||||||
for (var i = 0; i < ids.length; i++) {
|
for (var i = 0; i < ids.length; i++) {
|
||||||
var e = document.getElementById("RROW-" + ids[i]);
|
var e = document.getElementById("RROW-" + ids[i]);
|
||||||
|
@ -1137,9 +1148,10 @@ function cdmWatchdog() {
|
||||||
var query = "backend.php?op=rpc&subop=catchupSelected&ids=" +
|
var query = "backend.php?op=rpc&subop=catchupSelected&ids=" +
|
||||||
param_escape(ids.toString()) + "&cmode=0";
|
param_escape(ids.toString()) + "&cmode=0";
|
||||||
|
|
||||||
xmlhttp_rpc.open("GET", query, true);
|
new Ajax.Request(query, {
|
||||||
xmlhttp_rpc.onreadystatechange=all_counters_callback;
|
onComplete: function(transport) {
|
||||||
xmlhttp_rpc.send(null);
|
all_counters_callback2(transport);
|
||||||
|
} });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue