headlines_callback: async
This commit is contained in:
parent
0df398da2c
commit
a49f5e055e
19
feedlist.js
19
feedlist.js
|
@ -1,6 +1,6 @@
|
||||||
//var xmlhttp = Ajax.getTransport();
|
//var xmlhttp = Ajax.getTransport();
|
||||||
|
|
||||||
var feed_cur_page = 0;
|
var _feed_cur_page = 0;
|
||||||
|
|
||||||
function viewCategory(cat) {
|
function viewCategory(cat) {
|
||||||
active_feed_is_cat = true;
|
active_feed_is_cat = true;
|
||||||
|
@ -50,10 +50,10 @@ function viewNextFeedPage() {
|
||||||
try {
|
try {
|
||||||
if (!getActiveFeedId()) return;
|
if (!getActiveFeedId()) return;
|
||||||
|
|
||||||
feed_cur_page++;
|
_feed_cur_page++;
|
||||||
|
|
||||||
viewfeed(getActiveFeedId(), undefined, undefined, undefined,
|
viewfeed(getActiveFeedId(), undefined, undefined, undefined,
|
||||||
undefined, feed_cur_page);
|
undefined, _feed_cur_page);
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
exception_error(e, "viewFeedGoPage");
|
exception_error(e, "viewFeedGoPage");
|
||||||
|
@ -71,11 +71,11 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
|
||||||
page_offset = offset;
|
page_offset = offset;
|
||||||
} else {
|
} else {
|
||||||
page_offset = 0;
|
page_offset = 0;
|
||||||
feed_cur_page = 0;
|
_feed_cur_page = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getActiveFeedId() != feed) {
|
if (getActiveFeedId() != feed) {
|
||||||
feed_cur_page = 0;
|
_feed_cur_page = 0;
|
||||||
active_post_id = 0;
|
active_post_id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,13 +178,18 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
|
||||||
|
|
||||||
// xmlhttp.abort();
|
// xmlhttp.abort();
|
||||||
|
|
||||||
if (xmlhttp_ready(xmlhttp)) {
|
/* if (xmlhttp_ready(xmlhttp)) {
|
||||||
xmlhttp.open("GET", query, true);
|
xmlhttp.open("GET", query, true);
|
||||||
xmlhttp.onreadystatechange=headlines_callback;
|
xmlhttp.onreadystatechange=headlines_callback;
|
||||||
xmlhttp.send(null);
|
xmlhttp.send(null);
|
||||||
} else {
|
} else {
|
||||||
debug("xmlhttp busy (@feeds)");
|
debug("xmlhttp busy (@feeds)");
|
||||||
}
|
} */
|
||||||
|
|
||||||
|
new Ajax.Request(query, {
|
||||||
|
onComplete: function(transport) {
|
||||||
|
headlines_callback2(transport, feed, is_cat, _feed_cur_page);
|
||||||
|
} });
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
exception_error("viewfeed", e);
|
exception_error("viewfeed", e);
|
||||||
|
|
16
viewfeed.js
16
viewfeed.js
|
@ -45,9 +45,8 @@ function catchup_callback2(transport, callback) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function headlines_callback() {
|
function headlines_callback2(transport, active_feed_id, active_feed_is_cat, feed_cur_page) {
|
||||||
if (xmlhttp.readyState == 4) {
|
debug("headlines_callback2");
|
||||||
debug("headlines_callback");
|
|
||||||
var f = document.getElementById("headlines-frame");
|
var f = document.getElementById("headlines-frame");
|
||||||
try {
|
try {
|
||||||
if (feed_cur_page == 0) {
|
if (feed_cur_page == 0) {
|
||||||
|
@ -56,11 +55,11 @@ function headlines_callback() {
|
||||||
}
|
}
|
||||||
} catch (e) { };
|
} catch (e) { };
|
||||||
|
|
||||||
if (xmlhttp.responseXML) {
|
if (transport.responseXML) {
|
||||||
var headlines = xmlhttp.responseXML.getElementsByTagName("headlines")[0];
|
var headlines = transport.responseXML.getElementsByTagName("headlines")[0];
|
||||||
var counters = xmlhttp.responseXML.getElementsByTagName("counters")[0];
|
var counters = transport.responseXML.getElementsByTagName("counters")[0];
|
||||||
var articles = xmlhttp.responseXML.getElementsByTagName("article");
|
var articles = transport.responseXML.getElementsByTagName("article");
|
||||||
var runtime_info = xmlhttp.responseXML.getElementsByTagName("runtime-info");
|
var runtime_info = transport.responseXML.getElementsByTagName("runtime-info");
|
||||||
|
|
||||||
if (feed_cur_page == 0) {
|
if (feed_cur_page == 0) {
|
||||||
if (headlines) {
|
if (headlines) {
|
||||||
|
@ -143,7 +142,6 @@ function headlines_callback() {
|
||||||
|
|
||||||
notify("");
|
notify("");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function render_article(article) {
|
function render_article(article) {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue