Skip to content
This repository has been archived by the owner on Aug 12, 2017. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:novemberborn/linkedgov-hackcamp
Browse files Browse the repository at this point in the history
  • Loading branch information
Kai Chan Vong committed Apr 10, 2011
2 parents 53f0aff + 9a844d6 commit e3339cc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ <h2></h2>
</div>

<div id="count-down">
<p class="timer">{10}</p>
<p class="timer"></p>
</div>
</header>

Expand Down
19 changes: 18 additions & 1 deletion public/js/enhancement.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,23 @@ function updateCash(points){
$("#player-details .cash").text("£ " + points).addClass(points < 0 ? "bankrupt" : "");
}

function countdown(){
clearInterval(countdown.interval);
var timer = $("#count-down .timer");
var remaining = 10;
timer.text(10);
countdown.interval = setInterval(function(){
remaining--;
if(remaining >= 0){
timer.text(remaining);
}
if(remaining <= 0){
clearInterval(countdown.interval);
socket.send({ type: "move", country: "pass" });
}
}, 1000);
}

Commands["register-user"] = {
exec: function(data){
if(data.single){
Expand All @@ -86,8 +103,8 @@ Commands["register-user"] = {

Commands["move"] = {
exec: function(data){
console.log(data);
updateCash(data.points);
countdown();
$("#current-item h2").text(data.commodity.title);
$("#current-item p").text("£ " + data.commodity.points);
$("#country-list li").each(function(ix, li){
Expand Down

0 comments on commit e3339cc

Please sign in to comment.