headlines_callback: async

This commit is contained in:
Andrew Dolgov 2007-08-24 05:59:12 +01:00
parent 0df398da2c
commit a49f5e055e
2 changed files with 94 additions and 91 deletions

View File

@ -1,6 +1,6 @@
//var xmlhttp = Ajax.getTransport();
var feed_cur_page = 0;
var _feed_cur_page = 0;
function viewCategory(cat) {
active_feed_is_cat = true;
@ -50,10 +50,10 @@ function viewNextFeedPage() {
try {
if (!getActiveFeedId()) return;
feed_cur_page++;
_feed_cur_page++;
viewfeed(getActiveFeedId(), undefined, undefined, undefined,
undefined, feed_cur_page);
undefined, _feed_cur_page);
} catch (e) {
exception_error(e, "viewFeedGoPage");
@ -71,11 +71,11 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
page_offset = offset;
} else {
page_offset = 0;
feed_cur_page = 0;
_feed_cur_page = 0;
}
if (getActiveFeedId() != feed) {
feed_cur_page = 0;
_feed_cur_page = 0;
active_post_id = 0;
}
@ -178,13 +178,18 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
// xmlhttp.abort();
if (xmlhttp_ready(xmlhttp)) {
/* if (xmlhttp_ready(xmlhttp)) {
xmlhttp.open("GET", query, true);
xmlhttp.onreadystatechange=headlines_callback;
xmlhttp.send(null);
} else {
debug("xmlhttp busy (@feeds)");
}
} */
new Ajax.Request(query, {
onComplete: function(transport) {
headlines_callback2(transport, feed, is_cat, _feed_cur_page);
} });
} catch (e) {
exception_error("viewfeed", e);

View File

@ -45,9 +45,8 @@ function catchup_callback2(transport, callback) {
}
}
function headlines_callback() {
if (xmlhttp.readyState == 4) {
debug("headlines_callback");
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) {
@ -56,11 +55,11 @@ function headlines_callback() {
}
} 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) {
@ -143,7 +142,6 @@ function headlines_callback() {
notify("");
}
}
function render_article(article) {
try {