comparison rlgterm.js @ 64:e3082fd06520

Some status improvements. Status messages now consistently use the game's uname, and the table of choices puts the games in the right order.
author John "Elwin" Edwards <elwin@sdf.org>
date Wed, 20 Jun 2012 08:49:10 -0700
parents a077f9f84052
children e63c26dc0497
comparison
equal deleted inserted replaced
63:a077f9f84052 64:e3082fd06520
452 var row = document.createElement("div"); 452 var row = document.createElement("div");
453 var cell1 = document.createElement("div"); 453 var cell1 = document.createElement("div");
454 var cell2 = document.createElement("div"); 454 var cell2 = document.createElement("div");
455 var cell3 = document.createElement("div"); 455 var cell3 = document.createElement("div");
456 cell1.appendChild(document.createTextNode(reply.g[i].p)); 456 cell1.appendChild(document.createTextNode(reply.g[i].p));
457 cell2.appendChild(document.createTextNode(reply.g[i].g)); 457 var uname = reply.g[i].g;
458 if (uname in games)
459 cell2.appendChild(document.createTextNode(games[uname].name));
460 else {
461 debug(1, "Unrecognized game: " + uname);
462 continue;
463 }
458 var button = document.createElement("span"); 464 var button = document.createElement("span");
459 button.appendChild(document.createTextNode("Watch")); 465 button.appendChild(document.createTextNode("Watch"));
460 button.onclick = makeWatcher(reply.g[i].n); 466 button.onclick = makeWatcher(reply.g[i].n);
461 button.className = "ibutton"; 467 button.className = "ibutton";
462 cell3.appendChild(button); 468 cell3.appendChild(button);
490 return; 496 return;
491 var optdiv = document.getElementById("opttable"); 497 var optdiv = document.getElementById("opttable");
492 /* Don't remove the first child, it's the header. */ 498 /* Don't remove the first child, it's the header. */
493 while (optdiv.childNodes.length > 1) 499 while (optdiv.childNodes.length > 1)
494 optdiv.removeChild(optdiv.childNodes[1]); 500 optdiv.removeChild(optdiv.childNodes[1]);
495 for (var gname in reply.stat) { 501 for (var gname in games) {
496 if (!(gname in games)) 502 if (!(gname in reply.stat))
497 continue; 503 continue;
498 var acttext; 504 var acttext;
499 if (reply.stat[gname] == "s") 505 if (reply.stat[gname] == "s")
500 acttext = "Resume your game"; 506 acttext = "Resume your game";
501 else if (reply.stat[gname] == "0") 507 else if (reply.stat[gname] == "0")