summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend.php19
-rw-r--r--functions.php14
-rw-r--r--viewfeed.js27
3 files changed, 40 insertions, 20 deletions
diff --git a/backend.php b/backend.php
index 521472051..761fc0dc0 100644
--- a/backend.php
+++ b/backend.php
@@ -363,8 +363,8 @@
print "]]></headlines>";
- print "<headlines-count value=\"$headlines_count\"/>";
- print "<vgroup-last-feed value=\"$vgroup_last_feed\"/>";
+ //print "<headlines-count value=\"$headlines_count\"/>";
+ //print "<vgroup-last-feed value=\"$vgroup_last_feed\"/>";
$headlines_unread = ccache_find($link, $returned_feed, $_SESSION["uid"],
$cat_view, true);
@@ -374,8 +374,19 @@
}
- print "<headlines-unread value=\"$headlines_unread\"/>";
- printf("<disable-cache value=\"%d\"/>", $disable_cache);
+ //print "<headlines-unread value=\"$headlines_unread\"/>";
+ //printf("<disable-cache value=\"%d\"/>", $disable_cache);
+
+ print "<headlines-info><![CDATA[";
+
+ $info = array("count" => (int) $headlines_count,
+ "vgroup_last_feed" => $vgroup_last_feed,
+ "unread" => (int) $headlines_unread,
+ "disable_cache" => (bool) $disable_cache);
+
+ print json_encode($info);
+
+ print "]]></headlines-info>";
if ($_REQUEST["debug"]) $timing_info = print_checkpoint("10", $timing_info);
diff --git a/functions.php b/functions.php
index abc52b43e..d5b3c436d 100644
--- a/functions.php
+++ b/functions.php
@@ -6842,10 +6842,16 @@
print "</div>]]>";
print "</headlines>";
- print "<headlines-count value=\"0\"/>";
- print "<vgroup-last-feed value=\"0\"/>";
- print "<headlines-unread value=\"0\"/>";
- print "<disable-cache value=\"1\"/>";
+ print "<headlines-info><![CDATA[";
+
+ $info = array("count" => 0,
+ "vgroup_last_feed" => '',
+ "unread" => 0,
+ "disable_cache" => true);
+
+ print json_encode($info);
+
+ print "]]></headlines-info>";
}
diff --git a/viewfeed.js b/viewfeed.js
index 1e9a11a16..5a0bf77ed 100644
--- a/viewfeed.js
+++ b/viewfeed.js
@@ -107,18 +107,21 @@ function headlines_callback2(transport, feed_cur_page) {
} catch (e) { };
if (transport.responseXML) {
- var headlines = transport.responseXML.getElementsByTagName("headlines")[0];
- var headlines_count_obj = transport.responseXML.getElementsByTagName("headlines-count")[0];
- var headlines_unread_obj = transport.responseXML.getElementsByTagName("headlines-unread")[0];
- var disable_cache_obj = transport.responseXML.getElementsByTagName("disable-cache")[0];
+ var response = transport.responseXML;
- var vgroup_last_feed_obj = transport.responseXML.getElementsByTagName("vgroup-last-feed")[0];
+ var headlines = response.getElementsByTagName("headlines")[0];
+ var headlines_info = response.getElementsByTagName("headlines-info")[0];
- var headlines_count = headlines_count_obj.getAttribute("value");
- var headlines_unread = headlines_unread_obj.getAttribute("value");
- var disable_cache = disable_cache_obj.getAttribute("value") != "0";
+ if (headlines_info)
+ headlines_info = JSON.parse(headlines_info.firstChild.nodeValue);
+ else
+ console.log("didn't find headlines-info object in response");
- vgroup_last_feed = vgroup_last_feed_obj.getAttribute("value");
+ var headlines_count = headlines_info.count;
+ var headlines_unread = headlines_info.unread;
+ var disable_cache = headlines_info.disable_cache;
+
+ vgroup_last_feed = headlines_info.vgroup_last_feed;
if (headlines_count == 0) {
_infscroll_disable = 1;
@@ -126,9 +129,9 @@ function headlines_callback2(transport, feed_cur_page) {
_infscroll_disable = 0;
}
- var counters = transport.responseXML.getElementsByTagName("counters")[0];
- var articles = transport.responseXML.getElementsByTagName("article");
- var runtime_info = transport.responseXML.getElementsByTagName("runtime-info");
+ var counters = response.getElementsByTagName("counters")[0];
+ var articles = response.getElementsByTagName("article");
+ var runtime_info = response.getElementsByTagName("runtime-info");
if (feed_cur_page == 0) {
if (headlines) {