diff 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
line wrap: on
line diff
--- a/rlgterm.js	Mon Jun 18 14:30:05 2012 -0700
+++ b/rlgterm.js	Mon Jun 18 16:53:44 2012 -0700
@@ -429,6 +429,14 @@
     var gamediv = document.getElementById("gametable");
     while (gamediv.children.length > 2)
       gamediv.removeChild(optdiv.children[2]);
+    if (reply.g.length === 0) {
+      gamediv.style.display = "none";
+      document.getElementById("nogames").style.display = "block";
+    }
+    else {
+      gamediv.style.display = "table";
+      document.getElementById("nogames").style.display = "none";
+    }
     for (var i = 0; i < reply.g.length; i++) {
       var row = document.createElement("div");
       var cell1 = document.createElement("div");