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

arthur at sucs.org arthur at sucs.org
Thu Oct 7 20:21:36 BST 2010


Author: arthur
Date: 2010-10-07 20:21:35 +0100 (Thu, 07 Oct 2010)
New Revision: 1181

Modified:
   trunk/webclient/say.js
   trunk/webclient/templates/front.html
Log:
quick crude who listing in the chat window


Modified: trunk/webclient/say.js
===================================================================
--- trunk/webclient/say.js	2010-10-07 15:33:53 UTC (rev 1180)
+++ trunk/webclient/say.js	2010-10-07 19:21:35 UTC (rev 1181)
@@ -80,9 +80,25 @@
 	return false;
 }
 
+function drawWho(data, stat)
+{
+	var text = "Who List: ";
+	var count = 0;
+	for (person in data) {
+		if (count > 0) text+=", ";
+		text += data[person].username;
+		count++;
+	}
+	addmsg("who", text);
+}
+
+function sendCmdHandle(cmd, handle)
+{
+	$.getJSON("send.php", {send: cmd}, handle);
+}
+
 function sendCmd(cmd)
 {
-	addmsg("cmd", cmd);
 	$.getJSON("send.php", {send: cmd});
 }
 

Modified: trunk/webclient/templates/front.html
===================================================================
--- trunk/webclient/templates/front.html	2010-10-07 15:33:53 UTC (rev 1180)
+++ trunk/webclient/templates/front.html	2010-10-07 19:21:35 UTC (rev 1181)
@@ -2,6 +2,12 @@
 	<input type="hidden" name="action" value="logout">
 	<input type="submit" name="submit" value="Logout" onclick="sendCmd('quit');">
 </form>
+<form action="{$self}" method="post" id="whoform">
+	<input type="hidden" name="action" value="Who">
+{literal}
+<input type="submit" name="submit" value="Who" onclick="sendCmdHandle('who', drawWho); return false;">
+{/literal}
+</form>
 <h1>Milliways</h1>
 
 <div id="textlist">




More information about the mw-devel mailing list