diff options
author | Andrew Dolgov <[email protected]> | 2007-05-15 06:41:48 +0100 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2007-05-15 06:41:48 +0100 |
commit | 5a94a953ea07e301aad6d88cc2424053e0c388cb (patch) | |
tree | a65c0ce52ac6b3bf183c218e561a5994582d7e77 | |
parent | fed4387da18b4aedf6b246d4f964b23c46b9dba9 (diff) |
piggy-back counters to view reply
-rw-r--r-- | backend.php | 5 | ||||
-rw-r--r-- | viewfeed.js | 17 |
2 files changed, 21 insertions, 1 deletions
diff --git a/backend.php b/backend.php index 393246732..634d5ae34 100644 --- a/backend.php +++ b/backend.php @@ -301,6 +301,7 @@ $feed_id = db_escape_string($_GET["feed"]); $cids = split(",", db_escape_string($_GET["cids"])); $mode = db_escape_string($_GET["mode"]); + $omode = db_escape_string($_GET["omode"]); print "<reply>"; @@ -319,6 +320,10 @@ } } + print "<counters>"; + getAllCounters($link, $omode); + print "</counters>"; + print "</reply>"; } diff --git a/viewfeed.js b/viewfeed.js index 4cba45ef8..88448f318 100644 --- a/viewfeed.js +++ b/viewfeed.js @@ -123,7 +123,14 @@ function article_callback() { setTimeout('updateFeedList(false, false)', 50); _reload_feedlist_after_view = false; } else { - update_all_counters(); + var counters = xmlhttp.responseXML.getElementsByTagName("counters")[0]; + + if (counters) { + debug("parsing piggybacked counters: " + counters); + parse_counters(counters, false); + } else { + update_all_counters(); + } } notify(""); @@ -194,6 +201,14 @@ function view(id, feed_id, skip_history) { debug("additional ids: " + cids_to_request.toString()); + /* additional info for piggyback counters */ + + if (tagsAreDisplayed()) { + query = query + "&omode=lt"; + } else { + query = query + "&omode=flc"; + } + var date = new Date(); var timestamp = Math.round(date.getTime() / 1000); query = query + "&ts=" + timestamp; |