]> git.wh0rd.org Git - tt-rss.git/commitdiff
update cache when viewing unread articles
authorAndrew Dolgov <fox@madoka.spb.ru>
Thu, 22 Nov 2007 07:35:50 +0000 (08:35 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Thu, 22 Nov 2007 07:35:50 +0000 (08:35 +0100)
viewfeed.js

index f42f677ec559fd34cc2be533452ebdc4b02a21cf..4f40f8fb3757bf3281dfa2ee4a8ff4fb303739c9 100644 (file)
@@ -247,30 +247,38 @@ function showArticleInHeadlines(id) {
                var article_is_unread = crow.className.match("Unread");
                        
                crow.className = crow.className.replace("Unread", "");
-               
+
+               selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false);
+               markHeadline(id);
+       
                var upd_img_pic = document.getElementById("FUPDPIC-" + id);
-               
-               if (upd_img_pic && upd_img_pic.src.match("updated.png")) {
-                       upd_img_pic.src = "images/blank_icon.gif";
 
-                       var cache_prefix = "";
+               var cache_prefix = "";
                                
-                       if (activeFeedIsCat()) {
-                               cache_prefix = "C:";
-                       } else {
-                               cache_prefix = "F:";
-                       }
+               if (activeFeedIsCat()) {
+                       cache_prefix = "C:";
+               } else {
+                       cache_prefix = "F:";
+               }
+       
+               if (upd_img_pic && upd_img_pic.src.match("updated.png")) {
+                       upd_img_pic.src = "images/blank_icon.gif";
 
                        cache_invalidate(cache_prefix + getActiveFeedId());
 
                        cache_inject(cache_prefix + getActiveFeedId(),
                                document.getElementById("headlines-frame").innerHTML,
                                get_feed_unread(getActiveFeedId()));
-       
+
+               } else if (article_is_unread) {
+
+                       cache_invalidate(cache_prefix + getActiveFeedId());
+
+                       cache_inject(cache_prefix + getActiveFeedId(),
+                               document.getElementById("headlines-frame").innerHTML,
+                               get_feed_unread(getActiveFeedId())-1);
+
                }
-               
-               selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false);
-               markHeadline(id);
 
        } catch (e) {
                exception_error("showArticleInHeadlines", e);