summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2013-05-16 09:53:34 +0400
committerAndrew Dolgov <[email protected]>2013-05-16 09:53:34 +0400
commit48be35ca063bb2fde1db3cbbc7ffaaf2f71a6e03 (patch)
treea998ec1052a9c411ed254684b56b7d8fb44ac314 /js
parent2700440178fa78f2908a6ae4114cf313cf1a0614 (diff)
while cdm_auto_catchup is enabled, after scrolling set active article to the topmost visible in the buffer so that n/p hotkeys would not reset scrolling position
Diffstat (limited to 'js')
-rw-r--r--js/viewfeed.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/js/viewfeed.js b/js/viewfeed.js
index dc8d3fe88..3981fd964 100644
--- a/js/viewfeed.js
+++ b/js/viewfeed.js
@@ -1240,6 +1240,30 @@ function headlines_scroll_handler(e) {
unpackVisibleHeadlines();
+ var active_found = false;
+
+ // 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 (!active_found && $("headlines-frame").scrollTop < child.offsetTop) {
+ active_found = true;
+
+ 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);
+ break;
+ }
+ }
+ }
+
if (!_infscroll_disable) {
if ((hsp && e.scrollTop + e.offsetHeight >= hsp.offsetTop - hsp.offsetHeight) ||
(e.scrollHeight != 0 &&
@@ -1275,6 +1299,7 @@ function headlines_scroll_handler(e) {
//console.log("auto_catchup_batch: " + catchup_id_batch.toString());
}
+
});
if (catchup_id_batch.length > 0) {