]> git.wh0rd.org Git - tt-rss.git/commitdiff
infscroll: properly restore headline selections on load (closes #146)
authorAndrew Dolgov <fox@bah.spb.su>
Wed, 5 Sep 2007 16:10:35 +0000 (17:10 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Wed, 5 Sep 2007 16:10:35 +0000 (17:10 +0100)
functions.js
viewfeed.js

index d8f7a235c8eee12700c9634a62943bb5ecc7a74b..47374ea4efbda6c538a76b7dec4b9bdc91e32a65 100644 (file)
@@ -1687,3 +1687,28 @@ function labelTest() {
        }
 }
 
+function isCdmMode() {
+       return !document.getElementById("headlinesList");
+}
+
+function getSelectedArticleIds2() {
+       var rows = new Array();
+       var cdm_mode = isCdmMode();
+
+       if (cdm_mode) {
+               rows = cdmGetSelectedArticles();
+       } else {        
+               rows = getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
+       }
+
+       var ids = new Array();
+
+       for (var i = 0; i < rows.length; i++) {
+               var chk = document.getElementById("RCHK-" + rows[i]);
+               if (chk && chk.checked) {
+                       ids.push(rows[i]);
+               }
+       }
+
+       return ids;
+}
index a1c99930827db11d05114da407bcf227592234f6..6a20ae3358317b33c5a825a513fc6fbdd908e1ef 100644 (file)
@@ -109,8 +109,17 @@ function headlines_callback2(transport, active_feed_id, is_cat, feed_cur_page) {
                                                if (!c) {
                                                        c = document.getElementById("headlinesInnerContainer");
                                                }
+
+                                               var ids = getSelectedArticleIds2();
        
                                                c.innerHTML = c.innerHTML + headlines.firstChild.nodeValue;
+
+                                               debug("restore selected ids: " + ids);
+
+                                               for (var i = 0; i < ids.length; i++) {
+                                                       markHeadline(ids[i]);
+                                               }
+
                                        } else {
                                                debug("no new headlines received");
                                        }