]> git.scottworley.com Git - reliable-chat/commitdiff
Start poking at the web client.
authorScott Worley <sworley@chkno.net>
Sun, 29 Jul 2012 04:25:27 +0000 (21:25 -0700)
committerScott Worley <sworley@chkno.net>
Sun, 29 Jul 2012 04:25:27 +0000 (21:25 -0700)
webclient/rc.css [new file with mode: 0644]
webclient/rc.html [new file with mode: 0644]
webclient/rc.js [new file with mode: 0644]

diff --git a/webclient/rc.css b/webclient/rc.css
new file mode 100644 (file)
index 0000000..bc5ea69
--- /dev/null
@@ -0,0 +1,4 @@
+html, body, #outer-table, #history { width: 99.9%; height: 100%; margin: 0; padding: 0 }
+#status { background-color: #eef }
+#say { width: 100% }
+#history { vertical-align: bottom }
diff --git a/webclient/rc.html b/webclient/rc.html
new file mode 100644 (file)
index 0000000..4948260
--- /dev/null
@@ -0,0 +1,18 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>Reliable Chat</title>
+ <link rel="stylesheet" title="Default style" href="rc.css" type="text/css"/>
+ <script type="text/javascript" src="rc.js"></script>
+</head>
+
+<body>
+       <table id="outer-table">
+               <tr><td id="history"></td></tr>
+               <tr><td id="status">&nbsp;</td></tr>
+               <tr><td><form name="input"><input id="say" onkeydown="return rckeydown(event)"></input></form></td></tr>
+       </table>
+</body>
+</html>
diff --git a/webclient/rc.js b/webclient/rc.js
new file mode 100644 (file)
index 0000000..13190c5
--- /dev/null
@@ -0,0 +1,11 @@
+function rckeydown(event) {
+       if (event.keyCode == 13) {
+               var d = document.createElement("div");
+               d.appendChild(document.createTextNode(document.input.say.value));
+               var h = document.getElementById("history");
+               h.appendChild(d);
+               window.scrollTo(0, document.body.scrollHeight);
+               document.input.say.value = "";
+               return false;
+       }
+}