diff options
Diffstat (limited to 'public')
| -rw-r--r-- | public/javascripts/game.js | 53 | ||||
| -rw-r--r-- | public/stylesheets/style.css | 21 |
2 files changed, 44 insertions, 30 deletions
diff --git a/public/javascripts/game.js b/public/javascripts/game.js index 184d3a9..2ddc432 100644 --- a/public/javascripts/game.js +++ b/public/javascripts/game.js @@ -53,32 +53,43 @@ var game = { }, bindEvents: function(){ - window.onblur = function () { - $("#really_waiting").html("BLUR"); - socket.emit('blur', { id: _id }); - blurTime = Date.now(); - afk = true; - own_cursor.el.addClass('idle'); - } - window.onfocus = function () { - $("#really_waiting").html("FOCUS"); - socket.emit('focus', { id: _id }); - afk = false; - own_cursor.el.removeClass('idle'); - if (blurTime) { - delay += (Date.now() - blurTime); - $("#reset").html( "You left the page for " + timeInWords(delay) + ", counting it against your score.." ); - } - } var emit_mouse_movement = $.throttle(50, function (e) { var y = Math.floor( e.pageY - window.innerHeight / 2 ); var x = Math.floor( e.pageX - window.innerWidth / 2 ); socket.emit('mouse', { x: x, y: y, id: _id }); }); - window.onmousemove = function(e){ - emit_mouse_movement(e); - own_cursor.el.css({ 'left': e.pageX, 'top': e.pageY }); - } + $(window).bind({ + blur: function () { + $("#really_waiting").html("BLUR"); + socket.emit('blur', { id: _id }); + blurTime = Date.now(); + afk = true; + own_cursor.el.addClass('idle'); + }, + focus: function () { + $("#really_waiting").html("FOCUS"); + socket.emit('focus', { id: _id }); + afk = false; + own_cursor.el.removeClass('idle').show(); + if (blurTime) { + delay += (Date.now() - blurTime); + $("#reset").html( "You left the page for " + timeInWords(delay) + ", counting it against your score.." ); + } + }, + mousemove: function(e){ + emit_mouse_movement(e); + own_cursor.el.css({ 'left': e.pageX, 'top': e.pageY }); + } + }); + + $(".okfocus").bind({ + mouseover: function(){ + own_cursor.el.hide(); + }, + mouseout: function(){ + own_cursor.el.show(); + } + }); } }; diff --git a/public/stylesheets/style.css b/public/stylesheets/style.css index a01b355..8681414 100644 --- a/public/stylesheets/style.css +++ b/public/stylesheets/style.css @@ -1,3 +1,6 @@ + +@import url(http://fonts.googleapis.com/css?family=Julius+Sans+One); + body { padding: 50px; font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; @@ -7,7 +10,6 @@ a { color: #00B7FF; } -@import url(http://fonts.googleapis.com/css?family=Julius+Sans+One); @-webkit-keyframes a { 0% { @@ -390,7 +392,7 @@ header { .cursor div { position: relative; left: 25px; - top: 3px; + top: 6px; font-size: 12px; color: #333; font-family: 'Julius Sans One', sans-serif; @@ -434,13 +436,14 @@ ol { background: url(https://s3.amazonaws.com/luckyplop/cf8dc6647202296b7c84c906dbf43c6d46e04958.png) no-repeat -2px -97px; } .okfocus { - text-align:center; - position:fixed; - bottom:10px; - left:0; - width:100%; - + text-align: center; + position: fixed; + bottom: 10px; + left: 0; + font-size: 11px; + width: 100%; + cursor: pointer; } .okfocus img { - width:100px; + width: 100px; }
\ No newline at end of file |
