From e08443c1bf2b2ab456ca1ec460f9059cad3536b6 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 29 Sep 2006 05:55:07 +0100 Subject: [PATCH] show new page on page catchup --- viewfeed.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/viewfeed.js b/viewfeed.js index 08b66a3cd..8c0e03a74 100644 --- a/viewfeed.js +++ b/viewfeed.js @@ -1,4 +1,13 @@ var active_post_id = false; +var _catchup_callback_func = false; + +function catchup_callback() { + if (xmlhttp_rpc.readyState == 4) { + debug("catchup_callback"); + setTimeout("viewCurrentFeed()", 100); + all_counters_callback(); + } +} function headlines_callback() { if (xmlhttp.readyState == 4) { @@ -199,7 +208,7 @@ function toggleUnread(id, cmode) { } } -function selectionToggleUnread(cdm_mode, set_state) { +function selectionToggleUnread(cdm_mode, set_state, callback_func) { try { if (!xmlhttp_ready(xmlhttp_rpc)) { printLockingError(); @@ -244,8 +253,10 @@ function selectionToggleUnread(cdm_mode, set_state) { var query = "backend.php?op=rpc&subop=catchupSelected&ids=" + param_escape(rows.toString()) + "&cmode=" + cmode; + _catchup_callback_func = callback_func; + xmlhttp_rpc.open("GET", query, true); - xmlhttp_rpc.onreadystatechange=all_counters_callback; + xmlhttp_rpc.onreadystatechange=catchup_callback; xmlhttp_rpc.send(null); } @@ -357,11 +368,11 @@ function catchupPage() { if (document.getElementById("headlinesList")) { selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', true, 'Unread', true); - selectionToggleUnread(); + selectionToggleUnread(false, false, 'viewCurrentFeed()'); selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false); } else { cdmSelectArticles('all'); - selectionToggleUnread(true, false) + selectionToggleUnread(true, false, 'viewCurrentFeed()') cdmSelectArticles('none'); } }