From 79074013cb86f097b73d840b759d26f548f14cfd Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 20 Mar 2013 13:23:24 +0400 Subject: [PATCH] tweak moveToPost behaviour in unexpanded mode --- js/viewfeed.js | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/js/viewfeed.js b/js/viewfeed.js index 4bb26187..4c6d9036 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -559,16 +559,23 @@ function moveToPost(mode, noscroll) { var prev_article = $("RROW-" + prev_id); var ctr = $("headlines-frame"); - if (!noscroll && article && article.offsetTop < ctr.scrollTop) { - scrollArticle(-ctr.offsetHeight/3); - } else if (!noscroll && prev_article && - prev_article.offsetTop < ctr.scrollTop) { + if (!getInitParam("cdm_expanded")) { cdmExpandArticle(prev_id); - scrollArticle(-ctr.offsetHeight/3); - } else if (prev_id) { - cdmExpandArticle(prev_id); - cdmScrollToArticleId(prev_id, noscroll); + cdmScrollToArticleId(prev_id, true); + } else { + + if (!noscroll && article && article.offsetTop < ctr.scrollTop) { + scrollArticle(-ctr.offsetHeight/3); + } else if (!noscroll && prev_article && + prev_article.offsetTop < ctr.scrollTop) { + cdmExpandArticle(prev_id); + scrollArticle(-ctr.offsetHeight/3); + } else if (prev_id) { + cdmExpandArticle(prev_id); + cdmScrollToArticleId(prev_id, noscroll); + } } + } else if (prev_id) { correctHeadlinesOffset(prev_id); view(prev_id, getActiveFeedId()); @@ -1365,7 +1372,10 @@ function cdmExpandArticle(id) { } setActiveArticleId(id); - cdmScrollToArticleId(id, true); + + if (!getInitParam("cdm_expanded")) { + cdmScrollToArticleId(id, true); + } elem = $("CICD-" + id);