From 44f85b846574bdf7f7e21a3e925889548221c17c Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 5 Mar 2013 03:30:21 -0500 Subject: += --- public/js/draw.js | 1 + public/js/game.js | 3 ++- server.js | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/public/js/draw.js b/public/js/draw.js index b969c1e..9116f78 100644 --- a/public/js/draw.js +++ b/public/js/draw.js @@ -50,6 +50,7 @@ $(function(){ console.log("saved"); }); clearWorkspace(); + $("#drawing").hide(); }); function draw(start, end){ diff --git a/public/js/game.js b/public/js/game.js index 0b90328..598e3c6 100644 --- a/public/js/game.js +++ b/public/js/game.js @@ -162,7 +162,8 @@ UI[ State.WINNING ] = new function(){ for (var i in data.scores) { scores.push( [data.scores[i], i] ); } - var topthree = scores.sort(function(){ a[0] - b[0] }).splice(0, 3); + var topthree = scores.sort(function(a,b){ a[0] - b[0] }).splice(0, 3); + console.log(data); for (var i in topthree) { var score = topthree[i][0] var nick = topthree[i][1] diff --git a/server.js b/server.js index 68bdd62..9d26aa8 100644 --- a/server.js +++ b/server.js @@ -154,10 +154,10 @@ Channel.prototype.pushImage = function(image){ } Channel.prototype.addVote = function(data, user){ - if (data.nick in this.images && not( user.nick in this.votes )) { + if (data.nick in this.images && !( user.nick in this.votes )) { this.voteCount++; this.votes[ user.nick ] = true; - this.scores[ data.nick ] += 1; + this.scores[ data.nick ] = this.scores[ data.nick ] ? this.scores[ data.nick ] + 1 : 1; if (this.voteCount == this.playerCount) this.startWinning(); } } -- cgit v1.2.3-70-g09d2