summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2013-01-24 15:37:53 -0500
committerJules Laplace <jules@okfoc.us>2013-01-24 15:37:53 -0500
commit8ae0a6a621ccdf300287c6a30aedb863a3184852 (patch)
treece2649f41a76a92df2ea3e84b80858f005c1adcf
parentc15f0f8f6127554f5ddf05718de568c7d3a7dbc5 (diff)
time on cursors
-rw-r--r--public/javascripts/game.js9
-rw-r--r--public/javascripts/util.js2
-rw-r--r--public/stylesheets/style.css8
3 files changed, 16 insertions, 3 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 ) );
diff --git a/public/stylesheets/style.css b/public/stylesheets/style.css
index 2c033a9..93585a3 100644
--- a/public/stylesheets/style.css
+++ b/public/stylesheets/style.css
@@ -390,12 +390,18 @@ header {
.cursor div {
position: relative;
left: 25px;
- top: 0;
+ top: 3px;
font-size: 12px;
color: #333;
font-family: 'Julius Sans One', sans-serif;
z-index:2;
}
+.cursor div.name {
+ left: 29px;
+}
+.cursor div.time {
+ font-size: 10px;
+}
.cursor.idle div {
color: transparent;
}