Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:nko/hms-dreadnode

  • Loading branch information...
commit 70a9a467d79e7966aef15663f8fe3a15561105fd 2 parents f5d4e87 + 3dcc64c
@teleject teleject authored
Showing with 29 additions and 31 deletions.
  1. +15 −28 public/gameboard.html
  2. +14 −3 public/js/socket.js
View
43 public/gameboard.html
@@ -33,43 +33,30 @@
<section class="mod">
- <section class="handle mod">
+ <!-- <section class="handle mod">
<img src="http://a0.twimg.com/profile_images/127284652/twitter_pro_normal.jpg" alt="Your Twitter icon">
<h4>Teleject</h4>
<p>Joe Example</p>
- </section>
+ </section> -->
<section class="mod scoreboard">
- <h3>Scoreboard</h3>
- <table border="1" summary="Current game score between you and your wily opponent">
- <caption>
- Current Scoreboard
- </caption>
- <tr>
- <th scope="col">Player</th>
- <th scope="col">Ships Left</th>
- <th scope="col">Hits</th>
- <th scope="col">Sunk</th>
- </tr>
- <tr>
- <td>Your Name</td>
- <td>5</td>
- <td>13</td>
- <td>2</td>
- </tr>
- <tr>
- <td>Opponent Name</td>
- <td>4</td>
- <td>10</td>
- <td>0</td>
- </tr>
+ <h3>Players</h3>
+ <table id="players_list" border="1" summary="Current game score between you and your wily opponent">
+ <thead>
+ <tr>
+ <th scope="col">#</th>
+ <th scope="col">Player</th>
+ </tr>
+ </thead>
+ <tbody>
+ </tbody>
</table>
</section>
- <section class="mod timer">
+ <!-- <section class="mod timer">
<h3>Timer</h3>
<strong id="gametime">:29</strong>
- </section>
+ </section> -->
<section class="mod targetboard">
<h3>May Your Aim Be True</h3>
@@ -109,6 +96,6 @@
<p>
<a href="http://nodeknockout.com/teams/hms-dreadnode" title="Vote Dreadnode" target="_blank"><img width="126" height="63" src="http://nodeknockout.com/images/voteko.png" border="0" alt="Vote Node Knockout" /></a>
</p>
-
+
</body>
</html>
View
17 public/js/socket.js
@@ -92,8 +92,19 @@
userlist : function(message) {
var userlist = message.msg || [];
console.log(JSON.stringify(userlist));
- alert(JSON.stringify(userlist));
- // TODO: Update player listing.
+
+ var $player_list = $("#players_list"), $tr, $td;
+ if ($player_list.length) {
+ $player_list.find("tbody").empty();
+ for (var count=0; count<userlist.length; count++) {
+ $tr = $("<tr></tr>");
+ $td = $("<td></td>").text((count+1));
+ $tr.append($td);
+ $td = $("<td></td>").text(userlist[count]);
+ $tr.append($td);
+ $player_list.find("tbody").append($tr);
+ }
+ }
},
yourturn : function(message) {
var msg = message.msg || "";
@@ -154,5 +165,5 @@
dread.fire = function(shot) {
$.socket.send(JSON.stringify(new dread.Message("shot", shot)));
};
-
+
})(window,jQuery);
Please sign in to comment.
Something went wrong with that request. Please try again.