diff options
author | Andrew Dolgov <[email protected]> | 2013-03-29 19:31:10 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2013-03-29 19:31:10 +0400 |
commit | c409d34a3009005be41efbc6c8cdf994bddaae35 (patch) | |
tree | c494c0f8dcc3a239fc7aa4078372cc046d912da8 /js/viewfeed.js | |
parent | 8f49a2257b4d01ed3e709600bd5775b5a7a1e608 (diff) |
fix cdmExpandArticle not always removing active class; make moving between posts take expanded cdm margins into account
Diffstat (limited to 'js/viewfeed.js')
-rw-r--r-- | js/viewfeed.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/js/viewfeed.js b/js/viewfeed.js index 2434a8211..c030bf0c9 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -1150,7 +1150,9 @@ function cdmScrollToArticleId(id, force) { if (force || e.offsetTop+e.offsetHeight > (ctr.scrollTop+ctr.offsetHeight) || e.offsetTop < ctr.scrollTop) { - ctr.scrollTop = e.offsetTop; + + // expanded cdm has a 4px margin now + ctr.scrollTop = parseInt(e.offsetTop) - 4; } } catch (e) { @@ -1432,6 +1434,8 @@ function cdmExpandArticle(id) { if (!$("RROW-" + id)) return false; + var oldrow = $("RROW-" + getActiveArticleId()); + var elem = $("CICD-" + getActiveArticleId()); if (id == getActiveArticleId() && Element.visible(elem)) @@ -1448,9 +1452,10 @@ function cdmExpandArticle(id) { Element.hide(elem); Element.show("CEXC-" + getActiveArticleId()); Element.hide(collapse); - $("RROW-" + getActiveArticleId()).removeClassName("active"); } + if (oldrow) oldrow.removeClassName("active"); + setActiveArticleId(id); elem = $("CICD-" + id); @@ -1470,7 +1475,6 @@ function cdmExpandArticle(id) { Element.show(elem); Element.hide("CEXC-" + id); Element.show(collapse); - $("RROW-" + id).addClassName("active"); } var new_offset = $("RROW-" + id).offsetTop; @@ -1480,6 +1484,7 @@ function cdmExpandArticle(id) { toggleUnread(id, 0, true); toggleSelected(id); + $("RROW-" + id).addClassName("active"); } catch (e) { exception_error("cdmExpandArticle", e); |