summaryrefslogtreecommitdiff
path: root/js/Article.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2020-10-21 07:19:15 +0300
committerAndrew Dolgov <[email protected]>2020-10-21 07:19:15 +0300
commite3da11bf6ddc90c11c1e6462c9287f446d20b363 (patch)
tree67f821fd02782885dcf5ad58af08c92218d65bbb /js/Article.js
parent8d75a542cdf594a67fd899bb38ee45c37096d550 (diff)
Revert "somewhat experimental: disable article packing/unpacking, render content immediately"
This reverts commit ab53591957d877908b89f6874e91c282bf59d165.
Diffstat (limited to 'js/Article.js')
-rw-r--r--js/Article.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/js/Article.js b/js/Article.js
index e97a6c8e6..76637cd69 100644
--- a/js/Article.js
+++ b/js/Article.js
@@ -180,6 +180,36 @@ const Article = {
${__('Originally from:')} <a target="_blank" rel="noopener noreferrer" href="${App.escapeHtml(hl.orig_feed[1])}">${hl.orig_feed[0]}</a>
</span>` : "";
},
+ unpack: function(row) {
+ if (row.hasAttribute("data-content")) {
+ console.log("unpacking: " + row.id);
+
+ const container = row.querySelector(".content-inner");
+
+ container.innerHTML = row.getAttribute("data-content").trim();
+
+ // blank content element might screw up onclick selection and keyboard moving
+ 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.querySelector(".content-inner").innerHTML = "&nbsp;";
+ }
+ },
view: function (id, no_expand) {
this.setActive(id);
Headlines.scrollToArticleId(id);
@@ -298,11 +328,14 @@ const Article = {
$$("div[id*=RROW][class*=active]").each((row) => {
row.removeClassName("active");
+ Article.pack(row);
});
const row = $("RROW-" + id);
if (row) {
+ Article.unpack(row);
+
row.removeClassName("Unread");
row.addClassName("active");