summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2013-06-25 01:35:07 +0400
committerAndrew Dolgov <[email protected]>2013-06-25 01:35:07 +0400
commitd1343b844d96e808620a230ee8f39764acedb581 (patch)
tree732d5cb6f95ea8fe9c087f49dd6c7aeb1c229fac /js
parentb627f574f833c2f46b2bbe6e7dd24387d5a4ed62 (diff)
make floating title less cpu intensive
Diffstat (limited to 'js')
-rw-r--r--js/viewfeed.js32
1 files changed, 13 insertions, 19 deletions
diff --git a/js/viewfeed.js b/js/viewfeed.js
index 84230f61a..9c48fbcdb 100644
--- a/js/viewfeed.js
+++ b/js/viewfeed.js
@@ -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);
}