]> git.wh0rd.org Git - tt-rss.git/commitdiff
unpackVisibleHeadlines: do not iterate over all RROWs all the time
authorAndrew Dolgov <noreply@fakecake.org>
Sun, 22 Jan 2017 17:57:16 +0000 (20:57 +0300)
committerAndrew Dolgov <noreply@fakecake.org>
Sun, 22 Jan 2017 17:57:16 +0000 (20:57 +0300)
classes/feeds.php
js/viewfeed.js

index e0756b6640a6a43a88c83bd1891e109d242ece1b..4a34945cd713c5a40ff678f8c9f4e4dd975270a8 100755 (executable)
@@ -706,14 +706,9 @@ class Feeds extends Handler_Protected {
 
                                        $reply['content'] .= "<span id=\"CWRAP-$id\">";
 
-//                                     if (!$expand_cdm) {
-                                               $reply['content'] .= "<span id=\"CENCW-$id\" style=\"display : none\">";
-                                               $reply['content'] .= htmlspecialchars($line["content"]);
-                                               $reply['content'] .= "</span.";
-
-//                                     } else {
-//                                             $reply['content'] .= $line["content"];
-//                                     }
+                                       $reply['content'] .= "<span id=\"CENCW-$id\" class=\"cencw\" style=\"display : none\">";
+                                       $reply['content'] .= htmlspecialchars($line["content"]);
+                                       $reply['content'] .= "</span>";
 
                                        $reply['content'] .= "</span>";
 
index ac9d4225569e3fb77a0aa66d92aeae96e79075f9..1f597e226073f952ed13d6e31f0d7ec9f5a12d13 100755 (executable)
@@ -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);
                                }
                        }
                );