[mw-devel] MW3 r1188 - trunk/webclient

dez at sucs.org dez at sucs.org
Thu Oct 7 22:38:16 BST 2010


Author: dez
Date: 2010-10-07 22:38:16 +0100 (Thu, 07 Oct 2010)
New Revision: 1188

Modified:
   trunk/webclient/mw.css
   trunk/webclient/say.js
Log:
Switches who list formatting to tabular format, closely matching output of .who for non-wizards in the CLI client


Modified: trunk/webclient/mw.css
===================================================================
--- trunk/webclient/mw.css	2010-10-07 20:45:40 UTC (rev 1187)
+++ trunk/webclient/mw.css	2010-10-07 21:38:16 UTC (rev 1188)
@@ -1,13 +1,25 @@
+#textlist, #sayit, table {
+	font-family: Monaco, monospace;
+	font-size: 10pt;
+}
+
 #textlist, #sayit {
 	clear: both;
-	font-family: Monaco, monospace;
-	font-size: 10pt;
 	border: 1px solid black;
 	padding: 0.5em;
 	overflow: auto;
 	white-space: pre-wrap;
 }
 
+table {
+	margin: 0;
+	padding: 0;
+}
+
+th {
+	text-align: left;
+}
+
 #textlist {
 	height: 70%;
 	width: 97%;
@@ -52,7 +64,7 @@
 /* * Term Colours (Silver on Black)                * */
 /* ************************************************* */
 
-#textlist {
+#textlist, table {
 	background: #000000;
 	color: #d6d6d6;
 }

Modified: trunk/webclient/say.js
===================================================================
--- trunk/webclient/say.js	2010-10-07 20:45:40 UTC (rev 1187)
+++ trunk/webclient/say.js	2010-10-07 21:38:16 UTC (rev 1188)
@@ -101,15 +101,33 @@
 	return false;
 }
 
+function drawTime(time) {
+	days = time/86400;
+	hours = (time%86400)/3600;
+	minutes = ((time%86400)%3600)/60;
+	seconds = ((time%86400)%3600)%60;
+	text = "";
+	if (days>=2) text += parseInt(days)+"d";
+	if (hours>=1) text += parseInt(hours)+"h";
+	if (minutes>=1&&days<2) text += parseInt(minutes)+"m";
+	if (hours<1) text += seconds+"s";
+	return text;
+}
+
 function drawWho(data, stat)
 {
 	var text = "Who List: ";
 	var count = 0;
+	text = "<hr /><table cellspacing=\"0\" cellpadding=\"0\"><tbody>";
+	text += "<tr><th style=\"width: 10em;\">Name</th><th style=\"width: 6em;\">Idle</th><th>What...</th></tr>";
 	for (person in data) {
-		if (count > 0) text+=", ";
-		text += data[person].username;
-		count++;
+		line = "";
+		line += "<td>"+data[person].username+"</td>";
+		line += "<td>"+drawTime(data[person].idle)+"</td>";
+		line += "<td>Room "+data[person].channel+"</td>";
+		text += "<tr>"+line+"</tr>";
 	}
+	text += "</tbody></table><hr />";
 	addmsg("who", text);
 }
 




More information about the mw-devel mailing list