[tor-commits] [flashproxy/master] Scroll to the bottom of debug output.
dcf at torproject.org
dcf at torproject.org
Mon Apr 9 04:08:42 UTC 2012
commit e7bef861f811115c27551bc5f5394cbd2dde5303
Author: David Fifield <david at bamsoftware.com>
Date: Thu Mar 15 22:13:49 2012 -0700
Scroll to the bottom of debug output.
---
flashproxy.js | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/flashproxy.js b/flashproxy.js
index ae31484..67620f7 100644
--- a/flashproxy.js
+++ b/flashproxy.js
@@ -99,8 +99,14 @@ function FlashProxy()
this.puts = function(s) {
if (this.debug_div) {
+ var at_bottom;
+
+ /* http://www.w3.org/TR/cssom-view/#element-scrolling-members */
+ at_bottom = (this.debug_div.scrollTop + this.debug_div.clientHeight == this.debug_div.scrollHeight);
this.debug_div.appendChild(document.createTextNode(s));
this.debug_div.appendChild(document.createElement("br"));
+ if (at_bottom)
+ this.debug_div.scrollTop = this.debug_div.scrollHeight;
}
};
More information about the tor-commits
mailing list