Mercurial > hg > rlgwebd
comparison rlgterm.js @ 57:e7c864e80a79
RLG-Web client: explain when there are no games to watch
If no games are available for watching, display a message saying so
instead of showing an empty table.
author | John "Elwin" Edwards <elwin@sdf.org> |
---|---|
date | Mon, 18 Jun 2012 16:53:44 -0700 |
parents | 7f3ca16409fe |
children | 7a50b4412fea |
comparison
equal
deleted
inserted
replaced
56:7f3ca16409fe | 57:e7c864e80a79 |
---|---|
427 return; | 427 return; |
428 } | 428 } |
429 var gamediv = document.getElementById("gametable"); | 429 var gamediv = document.getElementById("gametable"); |
430 while (gamediv.children.length > 2) | 430 while (gamediv.children.length > 2) |
431 gamediv.removeChild(optdiv.children[2]); | 431 gamediv.removeChild(optdiv.children[2]); |
432 if (reply.g.length === 0) { | |
433 gamediv.style.display = "none"; | |
434 document.getElementById("nogames").style.display = "block"; | |
435 } | |
436 else { | |
437 gamediv.style.display = "table"; | |
438 document.getElementById("nogames").style.display = "none"; | |
439 } | |
432 for (var i = 0; i < reply.g.length; i++) { | 440 for (var i = 0; i < reply.g.length; i++) { |
433 var row = document.createElement("div"); | 441 var row = document.createElement("div"); |
434 var cell1 = document.createElement("div"); | 442 var cell1 = document.createElement("div"); |
435 var cell2 = document.createElement("div"); | 443 var cell2 = document.createElement("div"); |
436 cell1.appendChild(document.createTextNode(reply.g[i].p)); | 444 cell1.appendChild(document.createTextNode(reply.g[i].p)); |