infscroll: properly restore headline selections on load (closes #146)
This commit is contained in:
parent
a7750ac600
commit
c32cd48afe
2 changed files with 34 additions and 0 deletions
25
functions.js
25
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;
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue