diff options
Diffstat (limited to 'js/viewfeed.js')
-rw-r--r-- | js/viewfeed.js | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/js/viewfeed.js b/js/viewfeed.js index ada225cbf..095bfab22 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -20,8 +20,6 @@ function headlines_callback2(transport, offset, background, infscroll_req) { try { handle_rpc_json(transport); - loading_set_progress(25); - console.log("headlines_callback2 [offset=" + offset + "] B:" + background + " I:" + infscroll_req); var is_cat = false; @@ -60,6 +58,11 @@ function headlines_callback2(transport, offset, background, infscroll_req) { } } catch (e) { }; + $("headlines-frame").removeClassName("cdm"); + $("headlines-frame").removeClassName("normal"); + + $("headlines-frame").addClassName(isCdmMode() ? "cdm" : "normal"); + var headlines_count = reply['headlines-info']['count']; vgroup_last_feed = reply['headlines-info']['vgroup_last_feed']; @@ -136,8 +139,6 @@ function headlines_callback2(transport, offset, background, infscroll_req) { if (!hsp) hsp = new Element("DIV", {"id": "headlines-spacer"}); - fixHeadlinesOrder(getLoadedArticleIds()); - if (getInitParam("cdm_auto_catchup") == 1) { c.domNode.appendChild(hsp); } @@ -1239,6 +1240,29 @@ function headlines_scroll_handler(e) { unpackVisibleHeadlines(); + // set topmost child in the buffer as active + if (getInitParam("cdm_auto_catchup") == 1) { + var rows = $$("#headlines-frame > div[id*=RROW]"); + + for (var i = 0; i < rows.length; i++) { + var child = rows[i]; + + if ($("headlines-frame").scrollTop < child.offsetTop && + child.offsetTop - $("headlines-frame").scrollTop < 100) { + + if (_active_article_id) { + var row = $("RROW-" + _active_article_id); + if (row) row.removeClassName("active"); + } + + _active_article_id = child.id.replace("RROW-", ""); + showArticleInHeadlines(_active_article_id, true); + updateSelectedPrompt(); + break; + } + } + } + if (!_infscroll_disable) { if ((hsp && e.scrollTop + e.offsetHeight >= hsp.offsetTop - hsp.offsetHeight) || (e.scrollHeight != 0 && @@ -1274,6 +1298,7 @@ function headlines_scroll_handler(e) { //console.log("auto_catchup_batch: " + catchup_id_batch.toString()); } + }); if (catchup_id_batch.length > 0) { @@ -1418,6 +1443,8 @@ function cdmCollapseArticle(event, id, unmark) { if (id == getActiveArticleId()) { setActiveArticleId(0); } + + updateSelectedPrompt(); } if (event) Event.stop(event); @@ -1498,26 +1525,6 @@ function cdmExpandArticle(id, noexpand) { return false; } -function fixHeadlinesOrder(ids) { - try { - for (var i = 0; i < ids.length; i++) { - var e = $("RROW-" + ids[i]); - - if (e) { - if (i % 2 == 0) { - e.removeClassName("even"); - e.addClassName("odd"); - } else { - e.removeClassName("odd"); - e.addClassName("even"); - } - } - } - } catch (e) { - exception_error("fixHeadlinesOrder", e); - } -} - function getArticleUnderPointer() { return post_under_pointer; } @@ -1598,7 +1605,6 @@ function dismissSelectedArticles() { if (sel.length > 0) selectionToggleUnread(false); - fixHeadlinesOrder(tmp); } catch (e) { exception_error("dismissSelectedArticles", e); @@ -1623,8 +1629,6 @@ function dismissReadArticles() { } } - fixHeadlinesOrder(tmp); - } catch (e) { exception_error("dismissSelectedArticles", e); } |