diff options
| author | Jules Laplace <jules@okfoc.us> | 2013-01-24 15:37:53 -0500 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2013-01-24 15:37:53 -0500 |
| commit | 8ae0a6a621ccdf300287c6a30aedb863a3184852 (patch) | |
| tree | ce2649f41a76a92df2ea3e84b80858f005c1adcf /public/javascripts | |
| parent | c15f0f8f6127554f5ddf05718de568c7d3a7dbc5 (diff) | |
time on cursors
Diffstat (limited to 'public/javascripts')
| -rw-r--r-- | public/javascripts/game.js | 9 | ||||
| -rw-r--r-- | public/javascripts/util.js | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/public/javascripts/game.js b/public/javascripts/game.js index cb51987..184d3a9 100644 --- a/public/javascripts/game.js +++ b/public/javascripts/game.js @@ -91,7 +91,7 @@ var UI = { } var howlong = Math.floor( (now - start) ) - delay; if (own_cursor) { - $("#waiting").html( timeInSecs( howlong ) ); + own_cursor.time.html( timeInSecs( howlong ) ); } } else { if (blurTime) { @@ -119,7 +119,10 @@ var UI = { var cursor = new Cursor( users[i] ); users[i].cursor = cursor; cursors.push(cursor); - } + } + else if (i == _id) { + own_cursor.name.html( users[i].firstname ); + } } }, @@ -141,9 +144,11 @@ function Cursor ( user ) { this.el.css('background-image', 'url(' + cursor_image + '?' + Math.floor(Math.random() * 1000) + ')'); this.name = $("<div>"); + this.name.addClass('name'); this.name.html( user.firstname ); this.time = $("<div>"); + this.time.addClass('time'); this.time.html( "0:00" ); this.el.append(this.name); diff --git a/public/javascripts/util.js b/public/javascripts/util.js index 86c8328..91c4713 100644 --- a/public/javascripts/util.js +++ b/public/javascripts/util.js @@ -43,6 +43,8 @@ function timeInSecs (time) { } if (time > 60) { str.push( leading( (time / 60) % 60 ) ); + } else { + str.push( Math.floor( time / 60 ) ); } str.push( leading( time % 60 ) ); |
