summaryrefslogtreecommitdiff
path: root/viewfeed.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2007-08-24 05:59:12 +0100
committerAndrew Dolgov <[email protected]>2007-08-24 05:59:12 +0100
commita49f5e055e0076e689924a992e87ad3503e67b3d (patch)
treef4d33c86b984cc309b871cc75be7a7984a320751 /viewfeed.js
parent0df398da2c83693646605c91f29670405da2d22f (diff)
headlines_callback: async
Diffstat (limited to 'viewfeed.js')
-rw-r--r--viewfeed.js146
1 files changed, 72 insertions, 74 deletions
diff --git a/viewfeed.js b/viewfeed.js
index 30af548c0..197b7648b 100644
--- a/viewfeed.js
+++ b/viewfeed.js
@@ -45,104 +45,102 @@ function catchup_callback2(transport, callback) {
}
}
-function headlines_callback() {
- if (xmlhttp.readyState == 4) {
- debug("headlines_callback");
- var f = document.getElementById("headlines-frame");
- try {
- if (feed_cur_page == 0) {
- debug("resetting headlines scrollTop");
- f.scrollTop = 0;
- }
- } catch (e) { };
+function headlines_callback2(transport, active_feed_id, active_feed_is_cat, feed_cur_page) {
+ debug("headlines_callback2");
+ var f = document.getElementById("headlines-frame");
+ try {
+ if (feed_cur_page == 0) {
+ debug("resetting headlines scrollTop");
+ f.scrollTop = 0;
+ }
+ } catch (e) { };
- if (xmlhttp.responseXML) {
- var headlines = xmlhttp.responseXML.getElementsByTagName("headlines")[0];
- var counters = xmlhttp.responseXML.getElementsByTagName("counters")[0];
- var articles = xmlhttp.responseXML.getElementsByTagName("article");
- var runtime_info = xmlhttp.responseXML.getElementsByTagName("runtime-info");
+ if (transport.responseXML) {
+ var headlines = transport.responseXML.getElementsByTagName("headlines")[0];
+ var counters = transport.responseXML.getElementsByTagName("counters")[0];
+ var articles = transport.responseXML.getElementsByTagName("article");
+ var runtime_info = transport.responseXML.getElementsByTagName("runtime-info");
- if (feed_cur_page == 0) {
- if (headlines) {
- f.innerHTML = headlines.firstChild.nodeValue;
- } else {
- debug("headlines_callback: returned no data");
- f.innerHTML = "<div class='whiteBox'>" + __('Could not update headlines (missing XML data)') + "</div>";
-
- }
+ if (feed_cur_page == 0) {
+ if (headlines) {
+ f.innerHTML = headlines.firstChild.nodeValue;
} else {
- if (headlines) {
- debug("adding some more headlines...");
+ debug("headlines_callback: returned no data");
+ f.innerHTML = "<div class='whiteBox'>" + __('Could not update headlines (missing XML data)') + "</div>";
- var c = document.getElementById("headlinesList");
+ }
+ } else {
+ if (headlines) {
+ debug("adding some more headlines...");
- if (!c) {
- c = document.getElementById("headlinesInnerContainer");
- }
+ var c = document.getElementById("headlinesList");
- c.innerHTML = c.innerHTML + headlines.firstChild.nodeValue;
- } else {
- debug("headlines_callback: returned no data");
- notify_error("Error while trying to load more headlines");
+ if (!c) {
+ c = document.getElementById("headlinesInnerContainer");
}
- }
-
- if (articles) {
- for (var i = 0; i < articles.length; i++) {
- var a_id = articles[i].getAttribute("id");
- debug("found id: " + a_id);
- cache_inject(a_id, articles[i].firstChild.nodeValue);
- }
+ c.innerHTML = c.innerHTML + headlines.firstChild.nodeValue;
} else {
- debug("no cached articles received");
+ debug("headlines_callback: returned no data");
+ notify_error("Error while trying to load more headlines");
}
- if (counters) {
- debug("parsing piggybacked counters: " + counters);
- parse_counters(counters, false);
- } else {
- debug("counters container not found in reply");
- }
+ }
- if (runtime_info) {
- debug("parsing runtime info: " + runtime_info[0]);
- parse_runtime_info(runtime_info[0]);
- } else {
- debug("counters container not found in reply");
+ if (articles) {
+ for (var i = 0; i < articles.length; i++) {
+ var a_id = articles[i].getAttribute("id");
+ debug("found id: " + a_id);
+ cache_inject(a_id, articles[i].firstChild.nodeValue);
}
-
} else {
- debug("headlines_callback: returned no XML object");
- f.innerHTML = "<div class='whiteBox'>" + __('Could not update headlines (missing XML object)') + "</div>";
+ debug("no cached articles received");
}
- if (typeof correctPNG != 'undefined') {
- correctPNG();
+ if (counters) {
+ debug("parsing piggybacked counters: " + counters);
+ parse_counters(counters, false);
+ } else {
+ debug("counters container not found in reply");
}
- if (_cdm_wd_timeout) window.clearTimeout(_cdm_wd_timeout);
-
- if (!document.getElementById("headlinesList") &&
- getInitParam("cdm_auto_catchup") == 1) {
- debug("starting CDM watchdog");
- _cdm_wd_timeout = window.setTimeout("cdmWatchdog()", 5000);
- _cdm_wd_vishist = new Array();
+ if (runtime_info) {
+ debug("parsing runtime info: " + runtime_info[0]);
+ parse_runtime_info(runtime_info[0]);
} else {
- debug("not in CDM mode or watchdog disabled");
+ debug("counters container not found in reply");
}
- if (_tag_cdm_scroll) {
- try {
- document.getElementById("headlinesInnerContainer").scrollTop = _tag_cdm_scroll;
- _tag_cdm_scroll = false;
- debug("resetting headlinesInner scrollTop");
+ } else {
+ debug("headlines_callback: returned no XML object");
+ f.innerHTML = "<div class='whiteBox'>" + __('Could not update headlines (missing XML object)') + "</div>";
+ }
- } catch (e) { }
- }
+ if (typeof correctPNG != 'undefined') {
+ correctPNG();
+ }
- notify("");
+ if (_cdm_wd_timeout) window.clearTimeout(_cdm_wd_timeout);
+
+ if (!document.getElementById("headlinesList") &&
+ getInitParam("cdm_auto_catchup") == 1) {
+ debug("starting CDM watchdog");
+ _cdm_wd_timeout = window.setTimeout("cdmWatchdog()", 5000);
+ _cdm_wd_vishist = new Array();
+ } else {
+ debug("not in CDM mode or watchdog disabled");
}
+
+ if (_tag_cdm_scroll) {
+ try {
+ document.getElementById("headlinesInnerContainer").scrollTop = _tag_cdm_scroll;
+ _tag_cdm_scroll = false;
+ debug("resetting headlinesInner scrollTop");
+
+ } catch (e) { }
+ }
+
+ notify("");
}
function render_article(article) {