From ad326dbf78f824c3b26558a05893cec80e07f898 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 22 Jan 2017 20:57:16 +0300 Subject: [PATCH] unpackVisibleHeadlines: do not iterate over all RROWs all the time --- classes/feeds.php | 11 +++-------- js/viewfeed.js | 18 +++++++++--------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/classes/feeds.php b/classes/feeds.php index e0756b66..4a34945c 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -706,14 +706,9 @@ class Feeds extends Handler_Protected { $reply['content'] .= ""; -// if (!$expand_cdm) { - $reply['content'] .= ""; - $reply['content'] .= htmlspecialchars($line["content"]); - $reply['content'] .= ""; + $reply['content'] .= htmlspecialchars($line["content"]); + $reply['content'] .= ""; $reply['content'] .= ""; diff --git a/js/viewfeed.js b/js/viewfeed.js index ac9d4225..1f597e22 100755 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -1238,21 +1238,21 @@ function unpackVisibleHeadlines() { try { if (!isCdmMode() || !getInitParam("cdm_expanded")) return; - $$("#headlines-frame > div[id*=RROW]").each( + $$("#headlines-frame span.cencw[id]").each( 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) { - var cencw = $("CENCW-" + child.getAttribute("data-article-id")); + //console.log("unpacking: " + child.id); - if (cencw) { - cencw.innerHTML = htmlspecialchars_decode(cencw.innerHTML); - cencw.setAttribute('id', ''); + child.innerHTML = htmlspecialchars_decode(child.innerHTML); + child.removeAttribute('id'); - PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED_CDM, child); + PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED_CDM, row); - Element.show(cencw); - } + Element.show(child); } } ); -- 2.39.5