[mw-devel] MW3 r1200 - trunk/webclient

dez at sucs.org dez at sucs.org
Fri Oct 8 22:15:46 BST 2010


Author: dez
Date: 2010-10-08 22:15:46 +0100 (Fri, 08 Oct 2010)
New Revision: 1200

Modified:
   trunk/webclient/say.js
Log:
Who list is now sorted in alphabetical order


Modified: trunk/webclient/say.js
===================================================================
--- trunk/webclient/say.js	2010-10-08 16:58:02 UTC (rev 1199)
+++ trunk/webclient/say.js	2010-10-08 21:15:46 UTC (rev 1200)
@@ -173,9 +173,17 @@
 }
 
 
+function sortWho(a, b) {
+	var nameA=a.username.toLowerCase(), nameB=b.username.toLowerCase();
+	if (nameA < nameB) return -1;
+	if (nameA > nameB) return 1;
+	return 0;
+}
+
 function drawWhoList(data, stat)
 {
 	$("li").remove();
+	data.sort(sortWho);
 	for (person in data) {
 		$("#wholist").append("<li id=\"who_"+data[person].username+"\">"+data[person].username+"</li");
 	}




More information about the mw-devel mailing list