From: Andrew Dolgov Date: Wed, 5 Sep 2007 16:10:35 +0000 (+0100) Subject: infscroll: properly restore headline selections on load (closes #146) X-Git-Tag: 1.2.15~9 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=c32cd48afe5c5b9c134d1e9678c11298630b10eb;p=tt-rss.git infscroll: properly restore headline selections on load (closes #146) --- diff --git a/functions.js b/functions.js index d8f7a235..47374ea4 100644 --- a/functions.js +++ b/functions.js @@ -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; +} diff --git a/viewfeed.js b/viewfeed.js index a1c99930..6a20ae33 100644 --- a/viewfeed.js +++ b/viewfeed.js @@ -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"); }