Some status improvements.
Status messages now consistently use the game's uname, and the table of choices puts the games in the right order.
This commit is contained in:
parent
4c27e44ef8
commit
f711cdb591
2 changed files with 10 additions and 4 deletions
12
rlgterm.js
12
rlgterm.js
|
|
@ -454,7 +454,13 @@ function getcurrent() {
|
||||||
var cell2 = document.createElement("div");
|
var cell2 = document.createElement("div");
|
||||||
var cell3 = document.createElement("div");
|
var cell3 = document.createElement("div");
|
||||||
cell1.appendChild(document.createTextNode(reply.g[i].p));
|
cell1.appendChild(document.createTextNode(reply.g[i].p));
|
||||||
cell2.appendChild(document.createTextNode(reply.g[i].g));
|
var uname = reply.g[i].g;
|
||||||
|
if (uname in games)
|
||||||
|
cell2.appendChild(document.createTextNode(games[uname].name));
|
||||||
|
else {
|
||||||
|
debug(1, "Unrecognized game: " + uname);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
var button = document.createElement("span");
|
var button = document.createElement("span");
|
||||||
button.appendChild(document.createTextNode("Watch"));
|
button.appendChild(document.createTextNode("Watch"));
|
||||||
button.onclick = makeWatcher(reply.g[i].n);
|
button.onclick = makeWatcher(reply.g[i].n);
|
||||||
|
|
@ -492,8 +498,8 @@ function getchoices() {
|
||||||
/* Don't remove the first child, it's the header. */
|
/* Don't remove the first child, it's the header. */
|
||||||
while (optdiv.childNodes.length > 1)
|
while (optdiv.childNodes.length > 1)
|
||||||
optdiv.removeChild(optdiv.childNodes[1]);
|
optdiv.removeChild(optdiv.childNodes[1]);
|
||||||
for (var gname in reply.stat) {
|
for (var gname in games) {
|
||||||
if (!(gname in games))
|
if (!(gname in reply.stat))
|
||||||
continue;
|
continue;
|
||||||
var acttext;
|
var acttext;
|
||||||
if (reply.stat[gname] == "s")
|
if (reply.stat[gname] == "s")
|
||||||
|
|
|
||||||
|
|
@ -806,7 +806,7 @@ function statusmsg(req, res) {
|
||||||
var gamedesc = {};
|
var gamedesc = {};
|
||||||
gamedesc["n"] = sessid;
|
gamedesc["n"] = sessid;
|
||||||
gamedesc["p"] = sessions[sessid].pname;
|
gamedesc["p"] = sessions[sessid].pname;
|
||||||
gamedesc["g"] = sessions[sessid].game.name;
|
gamedesc["g"] = sessions[sessid].game.uname;
|
||||||
reply["g"].push(gamedesc);
|
reply["g"].push(gamedesc);
|
||||||
}
|
}
|
||||||
res.writeHead(200, { "Content-Type": "application/json" });
|
res.writeHead(200, { "Content-Type": "application/json" });
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue