in combined non-expanded mode, pack headline rows as they are unfocused to save RAM

This commit is contained in:
Andrew Dolgov 2020-04-17 07:37:56 +03:00
parent afaac95d8d
commit b3e4f0188e
1 changed files with 15 additions and 2 deletions

View File

@ -178,11 +178,23 @@ define(["dojo/_base/declare"], function (declare) {
if (container.textContent.length == 0)
container.innerHTML += " ";
// in expandable mode, save content for later, so that we can pack unfocused rows back
if (App.isCombinedMode() && $("main").hasClassName("expandable"))
row.setAttribute("data-content-original", row.getAttribute("data-content"));
row.removeAttribute("data-content");
PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED_CDM, row);
}
},
pack: function(row) {
if (row.hasAttribute("data-content-original")) {
console.log("packing", row.id);
row.setAttribute("data-content", row.getAttribute("data-content-original"));
row.removeAttribute("data-content-original");
row.innerHTML = " ";
}
},
view: function (id, noexpand) {
this.setActive(id);
@ -307,8 +319,9 @@ define(["dojo/_base/declare"], function (declare) {
setActive: function (id) {
console.log("setActive", id);
$$("div[id*=RROW][class*=active]").each((e) => {
e.removeClassName("active");
$$("div[id*=RROW][class*=active]").each((row) => {
row.removeClassName("active");
Article.pack(row);
});
const row = $("RROW-" + id);