Skip to content

Commit

Permalink
user total score displayed above picture
Browse files Browse the repository at this point in the history
  • Loading branch information
Ingy dot Net committed Dec 18, 2009
1 parent f30caaa commit b8eae16
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions static/browgle.css
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ span.points {
float: right;
}

.total_score {
font-weight: bold;
text-align: center;
}

.footer {
clear: both;
width: 100%;
Expand Down
11 changes: 9 additions & 2 deletions static/browgle.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,11 @@ Array.prototype.grep = function(f) {
$('.game_begin').hide();
$('.game_title').hide();
$('.word_input').show();

var $picture_row = $('table.players tr:first');
var $score_row = $('table.players').prepend("<tr></tr>").find('tr:first');
$picture_row.find('td').each(function() {
$score_row.append('<td class="total_score">0</td>');
});
setTimeout(function() {
$('.word_input input').focus();
}, 1000);
Expand Down Expand Up @@ -473,21 +477,24 @@ Array.prototype.grep = function(f) {
'</tr>';
$table.append(html)
}
var points = (({3:1, 4:1, 5:2, 6:3, 7:5})[word.length] || 11);
try {
$table.find('tr').find('td:eq(' + (col - 1) + ')')
.each(function() {
if ($(this).html() == "") {
$(this).html(
'<span class="word">' + word +
'</span><span class="points">' +
(({3:1, 4:1, 5:2, 6:3, 7:5})[word.length] || 11) +
points +
'</span>'
);
throw("word inserted. see ya");
}
})
}
catch(e) {}
var $total_td = $table.find('tr:first').find('td:eq(' + (col - 1) + ')');
$total_td.text(parseInt($total_td.text()) + points);
},

startKeyPress: function() {
Expand Down

0 comments on commit b8eae16

Please sign in to comment.