[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [flashproxy/js] Scroll to the bottom of debug output.



commit e7bef861f811115c27551bc5f5394cbd2dde5303
Author: David Fifield <david@xxxxxxxxxxxxxxx>
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;
         }
     };
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits