From c32cd48afe5c5b9c134d1e9678c11298630b10eb Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 5 Sep 2007 17:10:35 +0100 Subject: [PATCH] infscroll: properly restore headline selections on load (closes #146) --- functions.js | 25 +++++++++++++++++++++++++ viewfeed.js | 9 +++++++++ 2 files changed, 34 insertions(+) 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"); } -- 2.39.5