-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkillers_scores.js
32 lines (28 loc) · 1.12 KB
/
killers_scores.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
$( document ).ready(function() {
generate_footer();
settings_get();
setInterval( get_scores, 4000 );
get_scores();
});
function fill_data() {
$('.viewport .players').html( '' );
var $player = $( '#defaults .player' );
for (var i = 0; i < game.playersTotal; i++) {
var $anotherPlayer = $player.clone();
var player = game.players[i];
$( '.viewport .players' ).append( $anotherPlayer );
$anotherPlayer.find( '.name span' ).text( player.nm );
$anotherPlayer.find( '.number span' ).text( player.nb );
for (var l = 0; l < player.l; l++) {
$anotherPlayer.find( '.lifes' ).append( $.parseHTML( '<span class="life"> </span>' ) );
}
for (var l = 0; l < player.d; l++) {
$anotherPlayer.find('.throws').append( $.parseHTML( '<div class="dart throw"> </div>' ) );
}
if (player.c) $anotherPlayer.addClass( 'current' );
if (player.k) $anotherPlayer.addClass( 'killer' );
if (player.kd) $anotherPlayer.addClass( 'killed' );
player.k = ( $( this ).hasClass( 'killer' ) ) ? true : false;
if (player.t) $anotherPlayer.find( '.target' ).addClass( 'active' );
}
}