]> git.sesse.net Git - remoteglot-book/commitdiff
Show totals.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 13 Dec 2014 23:06:43 +0000 (00:06 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 13 Dec 2014 23:06:43 +0000 (00:06 +0100)
www/css/remoteglot.css
www/js/book.js
www/opening-stats.pl

index f8d99ba9ed6e76469ad8d421afb139f2214e75f2..110f5c827d832701ee9706ffb88132ef494a8d9c 100644 (file)
@@ -191,3 +191,6 @@ a.move:hover {
        background-color: black;
        color: white;
 }
+.totals {
+       background: rgb(90%,90%,90%);
+}
index c54fb94e700d9a8e1338f8c9db38ebada169f20e..0b1e4372264a7afa77d9cae8dbdf0c5bfbf464e2 100644 (file)
@@ -177,6 +177,10 @@ var show_lines = function(data, game) {
                var line = lines[i];
                var tr = document.createElement("tr");
 
+               if (line[0] === undefined || line[0] === null) {
+                       $(tr).addClass("totals");
+               }
+
                for (var j = 0; j < line.length; ++j) {
                        if (line[j] === null) {
                                add_td(tr, "");
index a17a82f067978cde4b46b033e3dbaaaa23d79d03..c283248395aab0cf62496b2b6b66c0e99f26b6ce 100755 (executable)
@@ -23,6 +23,16 @@ print $chld_in $hex, "\n";
 chomp (my $line = <$chld_out>);
 
 my ($white, $draw, $black, $opening_num, $white_avg_elo, $black_avg_elo, $num_elo, $timestamp, $pgn_file_number, $pgn_start_position, @moves) = split / /, $line;
+my @json_moves = ();
+push @json_moves, {
+       white => $white * 1,
+       draw => $draw * 1,
+       black => $black * 1,
+       white_avg_elo => $white_avg_elo * 1,
+       black_avg_elo => $black_avg_elo * 1,
+       num_elo => $num_elo * 1
+};
+
 my $opening = $openings{$opening_num} // 'A00: Start position';
 
 my $root_game;
@@ -47,7 +57,6 @@ eval {
 };
 
 # Explore one move out.
-my @json_moves = ();
 for my $move (@moves) {
        my ($np, $uci_move) = $pos->make_pretty_move($move);
        my $hex = unpack('H*', $np->bitpacked_fen);