Mercurial > web-gnusto
changeset 88:f8d853a77c52
The window no longer auto-scrolls all the way to the bottom of the page unconditionally; if text has been displayed that the user needs to read, the viewport is only scrolled to the last point that we know the user has read up to, which is the last point that we took input from the user.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Thu, 22 May 2008 00:00:14 -0700 |
parents | e48403e2a3b5 |
children | 0e1eb40ac12b |
files | web-zui.js |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/web-zui.js Wed May 21 22:00:48 2008 -0700 +++ b/web-zui.js Thu May 22 00:00:14 2008 -0700 @@ -10,6 +10,7 @@ this._foreground = "default"; this._background = "default"; this._reverseVideo = false; + this._lastSeenY = 0; this._currStyles = ["z-roman"]; if (logfunc) { @@ -28,7 +29,7 @@ }, _scrollBottomWindow: function() { - window.scroll(0, document.body.scrollHeight); + window.scroll(0, self._lastSeenY); }, _finalize: function() { @@ -109,6 +110,10 @@ self._currentCallback = null; self._removeBufferedWindows(); + + // TODO: This may not be the most accurate calculation. + self._lastSeenY = document.height; + callback(keyCode); } } @@ -137,6 +142,7 @@ self._inputString = ""; self._currentCallback = null; finalInputString = finalInputString.entityify(); + self._lastSeenY = $("#current-input").get(0).offsetTop; $("#current-input").replaceWith( ('<span class="finished-input">' + finalInputString + '</span><br/>') @@ -169,6 +175,7 @@ _eraseBottomWindow: function() { $("#content").empty(); + this._lastSeenY = 0; }, setVersion: function(version) {