Mercurial > web-gnusto
changeset 65:f380e3b3785d
Finally got quotations in Curses and Troll looking decent, although it's potentially a somewhat fragile solution.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Fri, 16 May 2008 18:15:27 -0700 |
parents | 7bba1e9f167d |
children | 3df72ae19981 |
files | gnusto.css gnusto.html web-zui.js |
diffstat | 3 files changed, 43 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/gnusto.css Fri May 16 16:30:27 2008 -0700 +++ b/gnusto.css Fri May 16 18:15:27 2008 -0700 @@ -6,6 +6,19 @@ margin-bottom: 8px; } +.buffered-window { + width: 640px; + text-align: center; + margin: 0 auto; + font-family: monaco; + font-size: 10px; + top: 0px; + left: 0px; + position: fixed; + z-index: 0; + line-height: 12px; +} + #top-window { width: 640px; text-align: center; @@ -17,6 +30,7 @@ top: 0px; left: 0px; position: fixed; + z-index: 1; } #content {
--- a/gnusto.html Fri May 16 16:30:27 2008 -0700 +++ b/gnusto.html Fri May 16 18:15:27 2008 -0700 @@ -9,6 +9,7 @@ </head> <body> <div id="top-window"></div> +<div id="buffered-windows"></div> <div id="content"></div> </body> <script type="text/javascript" src="jquery-1.2.3.min.js"></script>
--- a/web-zui.js Fri May 16 16:30:27 2008 -0700 +++ b/web-zui.js Fri May 16 18:15:27 2008 -0700 @@ -92,6 +92,7 @@ var callback = self._currentCallback; self._currentCallback = null; + self._removeBufferedWindows(); callback(keyCode); } } @@ -124,6 +125,7 @@ ('<span class="finished-input">' + finalInputString + '</span><br/>') ); + self._removeBufferedWindows(); callback(finalInputString); } } @@ -139,6 +141,14 @@ _windowResize: function() { var contentLeft = $("#content").get(0).offsetLeft + "px"; $("#top-window").get(0).style.left = contentLeft; + $(".buffered-window").css({left: contentLeft}); + }, + + _removeBufferedWindows: function() { + var windows = $(".buffered-window"); + windows.fadeOut("slow", function() { windows.remove(); }); + // A more conservative alternative to the above is: + // $("#buffered-windows").empty(); }, _eraseBottomWindow: function() { @@ -248,6 +258,24 @@ $("#top-window").get(0), self); } else { + // Z-Machine games are peculiar in regards to the way they + // sometimes overlay quotations on top of the current text; + // we basically want to preserve any text that is already in + // the top window "below" the layer of the top window, so + // that anything it doesn't write over remains visible, at + // least (and this is an arbitrary decision on our part) + // until the user has entered some input. + + var newDiv = document.createElement("div"); + var html = $("#top-window").get(0).innerHTML; + newDiv.className = "buffered-window"; + newDiv.innerHTML = html; + $("#buffered-windows").append(newDiv); + + // Pretend the window was just resized, which will position + // the new buffered window properly on the x-axis. + self._windowResize(); + self._console.resize(numlines); } }