]> git.wh0rd.org Git - tt-rss.git/commitdiff
fix cdmExpandArticle not always removing active class; make moving between posts...
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Fri, 29 Mar 2013 15:31:10 +0000 (19:31 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Fri, 29 Mar 2013 15:31:10 +0000 (19:31 +0400)
js/viewfeed.js

index 2434a82118515b1f15f52da114905f13e9c5711b..c030bf0c95c9b55c15ab2d7afed83d0f11099bd0 100644 (file)
@@ -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);