1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 13:45:56 +00:00

move to simpler CDM handling of encoded content (instead of CENCW... etc)

This commit is contained in:
Andrew Dolgov
2018-11-30 13:26:41 +03:00
parent da1a3c2cc5
commit c8c9a26f30
2 changed files with 21 additions and 22 deletions

View File

@@ -1018,24 +1018,28 @@ function postMouseOut(id) {
function unpackVisibleHeadlines() {
if (!isCdmMode() || !getInitParam("cdm_expanded")) return;
$$("#headlines-frame span.cencw[id]").each(
function (child) {
const row = $("RROW-" + child.id.replace("CENCW-", ""));
$$("#headlines-frame div[id*=RROW][data-content]").each((row) => {
//console.log('checking', row.id);
if (row && row.offsetTop <= $("headlines-frame").scrollTop +
$("headlines-frame").offsetHeight) {
if (row.offsetTop <= $("headlines-frame").scrollTop + $("headlines-frame").offsetHeight) {
console.log("unpacking: " + row.id);
//console.log("unpacking: " + child.id);
let content;
child.innerHTML = htmlspecialchars_decode(child.innerHTML);
child.removeAttribute('id');
PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED_CDM, row);
Element.show(child);
try {
content = JSON.parse(row.getAttribute("data-content"));
} catch (e) {
content = "Error decoding content: " + row.getAttribute("data-content");
}
row.select(".cdmContentInner")[0].innerHTML = content;
row.removeAttribute("data-content");
PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED_CDM, row);
} else {
throw $break;
}
);
});
}
function headlines_scroll_handler(e) {