summaryrefslogtreecommitdiff
path: root/data/empathy-log-window.html
diff options
context:
space:
mode:
authorDanielle Madeley <danielle.madeley@collabora.co.uk>2011-08-16 13:55:56 +1000
committerDanielle Madeley <danielle.madeley@collabora.co.uk>2011-08-16 13:55:56 +1000
commit9d1f95bebe28683a23f56568539ee2c56655b80c (patch)
treed13df2a6b96485442567433aebddcd012218120d /data/empathy-log-window.html
parent6cf57d879945059cd974a3ee6d02d81edff47438 (diff)
downloadtelepathy-account-widgets-9d1f95bebe28683a23f56568539ee2c56655b80c.tar.gz
Reimplement scrollToRow
N.B. This has not been properly tested, because I'm not actually sure how to exhaust this codepath.
Diffstat (limited to 'data/empathy-log-window.html')
-rw-r--r--data/empathy-log-window.html25
1 files changed, 25 insertions, 0 deletions
diff --git a/data/empathy-log-window.html b/data/empathy-log-window.html
index 4decbce6..5a94b7e0 100644
--- a/data/empathy-log-window.html
+++ b/data/empathy-log-window.html
@@ -237,6 +237,31 @@ function hasChildRows (path, has_children)
else
toggle.style.display = 'none';
}
+
+function getOffset (node)
+{
+ var y = 0;
+
+ while (node != null && !isNaN(node.offsetTop))
+ {
+ y += node.offsetTop - node.scrollTop;
+ node = node.offsetParent;
+ }
+
+ return y;
+}
+
+function scrollToRow (path)
+{
+ var treeview = document.getElementById('treeview');
+ var node = treeview;
+
+ // walk the tree
+ for (var i = 0; i < path.length; i++)
+ node = getNodes(node)[path[i]];
+
+ window.scrollTo(0, getOffset(node));
+}
</script>
</head>