digest: do not show catchup/loadmore prompt when there's nothing to load

master
Andrew Dolgov 14 years ago
parent b8a1b2ae94
commit 58226f869c

@ -47,9 +47,8 @@ function catchup_feed(feed_id, callback) {
} }
} }
function catchup_visible_articles(callback) { function get_visible_article_ids() {
try { try {
var elems = $("headlines-content").getElementsByTagName("LI"); var elems = $("headlines-content").getElementsByTagName("LI");
var ids = []; var ids = [];
@ -59,6 +58,18 @@ function catchup_visible_articles(callback) {
} }
} }
return ids;
} catch (e) {
exception_error("get_visible_article_ids", e);
}
}
function catchup_visible_articles(callback) {
try {
var ids = get_visible_article_ids();
if (confirm(__("Mark %d displayed articles as read?").replace("%d", ids.length))) { if (confirm(__("Mark %d displayed articles as read?").replace("%d", ids.length))) {
var query = "?op=rpc&subop=catchupSelected" + var query = "?op=rpc&subop=catchupSelected" +
@ -565,6 +576,9 @@ function parse_headlines(transport, replace, no_effects) {
} }
} }
var ids = get_visible_article_ids();
if (ids.length > 0) {
if (pr) { if (pr) {
$('headlines-content').appendChild(pr); $('headlines-content').appendChild(pr);
if (!no_effects) new Effect.ScrollTo(inserted); if (!no_effects) new Effect.ScrollTo(inserted);
@ -579,6 +593,9 @@ function parse_headlines(transport, replace, no_effects) {
"id=\"H-LOADING-IMG\" src='images/indicator_tiny.gif'>" + "id=\"H-LOADING-IMG\" src='images/indicator_tiny.gif'>" +
"</div></li>"; "</div></li>";
} }
} else {
// FIXME : display some kind of "nothing to see here" prompt here
}
if (replace && !no_effects) if (replace && !no_effects)
new Effect.Appear('headlines-content', {duration : 0.3}); new Effect.Appear('headlines-content', {duration : 0.3});

Loading…
Cancel
Save