async headlines_callback fixes

This commit is contained in:
Andrew Dolgov 2007-08-24 06:45:42 +01:00
parent 29dfb258c9
commit 6c3b019894
2 changed files with 124 additions and 117 deletions

View File

@ -83,30 +83,18 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
closeInfoBox(true); closeInfoBox(true);
} }
debug("IS_CAT_STORED: " + activeFeedIsCat() + ", IS_CAT: " + is_cat); // debug("IS_CAT_STORED: " + activeFeedIsCat() + ", IS_CAT: " + is_cat);
var fe = document.getElementById("FEEDR-" + getActiveFeedId());
if (fe) {
fe.className = fe.className.replace("Selected", "");
}
setActiveFeedId(feed);
if (is_cat != undefined) {
active_feed_is_cat = is_cat;
}
if (subop == "MarkAllRead") { if (subop == "MarkAllRead") {
var feedlist = document.getElementById('feedList'); var feedlist = document.getElementById('feedList');
var next_unread_feed = getRelativeFeedId(feedlist, var next_unread_feed = getRelativeFeedId(feedlist,
getActiveFeedId(), "next", true); feed, "next", true);
if (!next_unread_feed) { if (!next_unread_feed) {
next_unread_feed = getRelativeFeedId(feedlist, next_unread_feed = getRelativeFeedId(feedlist,
-1, "next", true); -3, "next", true);
} }
var show_next_feed = getInitParam("on_catchup_show_next_feed") == "1"; var show_next_feed = getInitParam("on_catchup_show_next_feed") == "1";
@ -117,7 +105,7 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
} }
} }
if (activeFeedIsCat()) { if (is_cat) {
query = query + "&cat=1"; query = query + "&cat=1";
} }
@ -129,13 +117,6 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
var timestamp = Math.round(date.getTime() / 1000); var timestamp = Math.round(date.getTime() / 1000);
query = query + "&ts=" + timestamp query = query + "&ts=" + timestamp
if (!activeFeedIsCat()) {
var feedr = document.getElementById("FEEDR-" + getActiveFeedId());
if (feedr && !feedr.className.match("Selected")) {
feedr.className = feedr.className + "Selected";
}
}
disableContainerChildren("headlinesToolbar", false); disableContainerChildren("headlinesToolbar", false);
Form.enable("main_toolbar_form"); Form.enable("main_toolbar_form");

View File

@ -45,9 +45,32 @@ function catchup_callback2(transport, callback) {
} }
} }
function headlines_callback2(transport, active_feed_id, active_feed_is_cat, feed_cur_page) { function headlines_callback2(transport, active_feed_id, is_cat, feed_cur_page) {
try {
debug("headlines_callback2 [page=" + feed_cur_page + "]"); debug("headlines_callback2 [page=" + feed_cur_page + "]");
var feeds = document.getElementById("feedList").getElementsByTagName("LI");
for (var i = 0; i < feeds.length; i++) {
if (feeds[i].id && feeds[i].id.match("FEEDR-")) {
feeds[i].className = feeds[i].className.replace("Selected", "");
}
}
setActiveFeedId(active_feed_id);
if (is_cat != undefined) {
active_feed_is_cat = is_cat;
}
if (!is_cat) {
var feedr = document.getElementById("FEEDR-" + active_feed_id);
if (feedr && !feedr.className.match("Selected")) {
feedr.className = feedr.className + "Selected";
}
}
var f = document.getElementById("headlines-frame"); var f = document.getElementById("headlines-frame");
try { try {
if (feed_cur_page == 0) { if (feed_cur_page == 0) {
@ -154,6 +177,9 @@ function headlines_callback2(transport, active_feed_id, active_feed_is_cat, feed
_feed_cur_page = feed_cur_page; _feed_cur_page = feed_cur_page;
notify(""); notify("");
} catch (e) {
exception_error("headlines_callback2", e);
}
} }
function render_article(article) { function render_article(article) {