infscroll: properly restore headline selections on load (closes #146)

This commit is contained in:
Andrew Dolgov 2007-09-05 17:10:35 +01:00
parent a7750ac600
commit c32cd48afe
2 changed files with 34 additions and 0 deletions

View 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;
}

View 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");
}