]> git.wh0rd.org Git - tt-rss.git/commitdiff
make floating title less cpu intensive
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 24 Jun 2013 21:35:07 +0000 (01:35 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 24 Jun 2013 21:35:07 +0000 (01:35 +0400)
js/viewfeed.js

index 84230f61a11cee5ab02ee56fde7963ce73df2cb1..9c48fbcdb9d9bc21bdb17ea04effe9e6e3467841 100644 (file)
@@ -2216,30 +2216,24 @@ function openSelectedAttachment(elem) {
 function updateFloatingTitle() {
        try {
                var hf = $("headlines-frame");
+               var child = $("RROW-" + _active_article_id);
 
-               var elems = $$("#headlines-frame > div[id*=RROW]");
+               if (child && child.offsetTop + child.offsetHeight > hf.scrollTop) {
 
-               for (var i = 0; i < elems.length; i++) {
-                       var child = elems[i];
+                       var header = child.getElementsByClassName("cdmHeader")[0];
 
-                       if (child.offsetTop + child.offsetHeight > hf.scrollTop) {
-
-                               var header = child.getElementsByClassName("cdmHeader")[0];
-
-                               if (child.id != $("floatingTitle").getAttribute("rowid")) {
-                                       $("floatingTitle").setAttribute("rowid", child.id);
-                                       $("floatingTitle").innerHTML = header.innerHTML;
-                               }
-
-                               if (child.offsetTop < hf.scrollTop - header.offsetHeight - 100 &&
-                                               child.offsetTop + child.offsetHeight - hf.scrollTop > 100)
-                                       Element.show("floatingTitle");
-                               else
-                                       Element.hide("floatingTitle");
-
-                               break;
+                       if (child.id != $("floatingTitle").getAttribute("rowid")) {
+                               $("floatingTitle").setAttribute("rowid", child.id);
+                               $("floatingTitle").innerHTML = header.innerHTML;
                        }
+
+                       if (child.offsetTop < hf.scrollTop - header.offsetHeight - 100 &&
+                                       child.offsetTop + child.offsetHeight - hf.scrollTop > 100)
+                               Element.show("floatingTitle");
+                       else
+                               Element.hide("floatingTitle");
                }
+
        } catch (e) {
                exception_error("updateFloatingTitle", e);
        }