summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2020-04-17 07:37:56 +0300
committerAndrew Dolgov <[email protected]>2020-04-17 07:37:56 +0300
commitb3e4f0188e68ee7f61121b247d7202fb68d9c28e (patch)
tree3cc87ffa17931de4ca2271aa1161673e928a824c /js
parentafaac95d8d3891614b312cd1eb7e992a53cd2b5f (diff)
in combined non-expanded mode, pack headline rows as they are unfocused to save RAM
Diffstat (limited to 'js')
-rw-r--r--js/Article.js17
1 files changed, 15 insertions, 2 deletions
diff --git a/js/Article.js b/js/Article.js
index b9f35c706..ae390331f 100644
--- a/js/Article.js
+++ b/js/Article.js
@@ -178,11 +178,23 @@ define(["dojo/_base/declare"], function (declare) {
if (container.textContent.length == 0)
container.innerHTML += "&nbsp;";
+ // 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 = "&nbsp;";
+ }
+ },
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);