1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-14 06:15:54 +00:00

unpackVisibleHeadlines: do not iterate over all RROWs all the time

This commit is contained in:
Andrew Dolgov
2017-01-22 20:57:16 +03:00
parent 70c5b2bfcc
commit ad326dbf78
2 changed files with 12 additions and 17 deletions

View File

@@ -706,14 +706,9 @@ class Feeds extends Handler_Protected {
$reply['content'] .= "<span id=\"CWRAP-$id\">"; $reply['content'] .= "<span id=\"CWRAP-$id\">";
// if (!$expand_cdm) { $reply['content'] .= "<span id=\"CENCW-$id\" class=\"cencw\" style=\"display : none\">";
$reply['content'] .= "<span id=\"CENCW-$id\" style=\"display : none\">";
$reply['content'] .= htmlspecialchars($line["content"]); $reply['content'] .= htmlspecialchars($line["content"]);
$reply['content'] .= "</span."; $reply['content'] .= "</span>";
// } else {
// $reply['content'] .= $line["content"];
// }
$reply['content'] .= "</span>"; $reply['content'] .= "</span>";

View File

@@ -1238,21 +1238,21 @@ function unpackVisibleHeadlines() {
try { try {
if (!isCdmMode() || !getInitParam("cdm_expanded")) return; if (!isCdmMode() || !getInitParam("cdm_expanded")) return;
$$("#headlines-frame > div[id*=RROW]").each( $$("#headlines-frame span.cencw[id]").each(
function(child) { function(child) {
if (child.offsetTop <= $("headlines-frame").scrollTop + var row = $("RROW-" + child.id.replace("CENCW-", ""));
if (row && row.offsetTop <= $("headlines-frame").scrollTop +
$("headlines-frame").offsetHeight) { $("headlines-frame").offsetHeight) {
var cencw = $("CENCW-" + child.getAttribute("data-article-id")); //console.log("unpacking: " + child.id);
if (cencw) { child.innerHTML = htmlspecialchars_decode(child.innerHTML);
cencw.innerHTML = htmlspecialchars_decode(cencw.innerHTML); child.removeAttribute('id');
cencw.setAttribute('id', '');
PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED_CDM, child); PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED_CDM, row);
Element.show(cencw); Element.show(child);
}
} }
} }
); );