[mw-devel] MW3 r1218 - in trunk/webclient: . templates

dez at sucs.org dez at sucs.org
Sun Oct 10 18:34:33 BST 2010


Author: dez
Date: 2010-10-10 18:34:33 +0100 (Sun, 10 Oct 2010)
New Revision: 1218

Modified:
   trunk/webclient/mw.css
   trunk/webclient/say.js
   trunk/webclient/templates/front.html
Log:
Adds "Escape" button to allow web users to use colours
Switches to using a table for layout


Modified: trunk/webclient/mw.css
===================================================================
--- trunk/webclient/mw.css	2010-10-10 15:44:38 UTC (rev 1217)
+++ trunk/webclient/mw.css	2010-10-10 17:34:33 UTC (rev 1218)
@@ -1,3 +1,6 @@
+textarea {
+	margin: 0;
+}
 p {
 	margin: 0;
 }
@@ -2,3 +5,10 @@
 
-#textlist, #sayit, #textlist table, #wholist {
+#milliways {
+	width: 100%;
+	height: 90%;
+	min-width: 40em;
+	min-height: 20em;
+}
+
+#textlist, #sayit, #textlist table, #wholist, #milliways {
 	font-family: Monaco, "Lucida Sans Typewriter", "Lucida Console", monospace;
@@ -9,13 +19,12 @@
 
 #wholist {
 	float: right;
-	width: 13%;
-	min-width: 11em;
+	width: 11em;
 	border: 1px solid black;
 	list-style: none;
 	margin: 0;
 	padding: 5px;;
-	height: 70%;
+	height: 100%;
 	overflow: auto;
 	background-color: #000000;
 	color: #d6d6d6;
@@ -40,14 +49,14 @@
 }
 
 #textlist {
-	height: 70%;
-	width: 82%;
+	height: 100%;
+	width: 100%;
 }
 
 #sayit {
-	height: 10%;
-	width: 83%;
-	margin-top: 0.5em;
+	height: 4em;
+	width: 100%;
+	margin-top: 2px;
 }
 
 form {
@@ -56,7 +65,8 @@
 }
 
 form#logoutform {
-	float: right;
+	text-align: center;
+	padding: 5px;
 }
 
 .msgpoll {

Modified: trunk/webclient/say.js
===================================================================
--- trunk/webclient/say.js	2010-10-10 15:44:38 UTC (rev 1217)
+++ trunk/webclient/say.js	2010-10-10 17:34:33 UTC (rev 1218)
@@ -114,19 +114,16 @@
 		});
 	}
 
-function sendSay()
+function sendSay(text)
 {
-	var text = $('#sayit').val();
-
 	if (text.substr(0, 1)=="."||text.substr(0, 1)=="!"||text.substr(0, 1)=="/") {
 		cmdParser(text);
-		$('#sayit').val("");
+		
 		return false;
 	}
 
 	var what = "say "+text;
 	$.getJSON("send.php", {send: what}, function(data, stats) {
-			$('#sayit').val("");
 		});
 	return false;
 }
@@ -254,11 +251,37 @@
 	else return true;
 	if (keycode == 13)
 	{
-		sendSay();
+		var text = $('#sayit').val();
+		$('#sayit').val("");
+		sendSay(text);
 		return false;
 	}
 	else
 	return true;
 }
 
+function insertEscape() {
+var myField=document.getElementById("sayit");
+var myValue="\033";
+  //IE support
+  if (document.selection) {
+    myField.focus();
+    sel = document.selection.createRange();
+    sel.text = myValue;
+  }
+  //MOZILLA/NETSCAPE support
+  else if (myField.selectionStart || myField.selectionStart == '0') {
+    var startPos = myField.selectionStart;
+    var endPos = myField.selectionEnd;
+    myField.value = myField.value.substring(0, startPos)
+                  + myValue
+                  + myField.value.substring(endPos, myField.value.length);
+    myField.selectionStart = startPos+1;
+  } else {
+    myField.value += myValue;
+  }
+myField.focus();
+}
+
+
 $(document).ready(function(){waitForMsg();});

Modified: trunk/webclient/templates/front.html
===================================================================
--- trunk/webclient/templates/front.html	2010-10-10 15:44:38 UTC (rev 1217)
+++ trunk/webclient/templates/front.html	2010-10-10 17:34:33 UTC (rev 1218)
@@ -1,18 +1,30 @@
-<form action="{$self}" method="post" id="logoutform">
-	<input type="hidden" name="action" value="logout">
-	<input type="submit" name="submit" value="Logout" onclick="sendCmd('quit');">
-</form>
 <h1>Milliways</h1>
 
+<table id="milliways" cellspacing="2" cellpadding="0" border="0">
+<tr style="height: 0;">
+<td></td>
+<td style="width: 10px;">
+<td style="width: 12em;">
+</tr>
+<tr><td>
+<div id="textlist"><p class="welcome">Milliways III - Web Edition</p></div>
+</td><td colspan="2">
 <ul id="wholist">
 </ul>
-
-<div id="textlist">
-<p class="welcome">Milliways III - Web Edition</p>
-</div>
+</td></tr>
+<tr><td style="height: 4em;" colspan="2">
 <form action="" id="sayform">
-	<textarea name="sayit" id="sayit" cols="80" rows="3" onKeyPress="return submitenter(this,event)"></textarea>
+	<textarea name="sayit" id="sayit" onKeyPress="return submitenter(this,event)"></textarea>
 </form>
+</td><td>
+<form action="{$self}" method="post" id="logoutform">
+	<input type="hidden" name="action" value="logout">
+	<input type="button" name="escape" value="Escape" onclick="insertEscape();"><br />
+	<input type="submit" name="submit" value="Logout" onclick="sendCmd('quit');">
+</form>
+</td></tr>
+</table>
+
 <script language="javascript" type="text/javascript">
 pageInit();
 var sayit = document.getElementById("sayit");    




More information about the mw-devel mailing list