]> git.sesse.net Git - remoteglot/commitdiff
Let book headings be dynamic.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 9 Dec 2014 23:36:20 +0000 (00:36 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 9 Dec 2014 23:36:20 +0000 (00:36 +0100)
www/book.html
www/js/book.js

index 5f71296fc20a2335b799eef3663b24e3dcd76fd7..38b0335563e9476f67c8bf22f99a72868ab453f8 100644 (file)
@@ -22,8 +22,8 @@
 <div id="analysis">
   <table>
     <thead>
-      <tr>
-        <th>Move</th>
+      <tr id="headings">
+        <!--<th>Move</th>
         <th>Games</th>
         <th>%</th>
         <th>Win%</th>
@@ -36,7 +36,7 @@
         <th>AvWElo</th>
         <th>AvBElo</th>
         <th>EloVar</th>
-        <th>AWin%</th>
+        <th>AWin%</th>-->
         <!--<th class="winbars">
           <table><tr>
              <td class="white" style="width: 35%;">White</td>
index 0cc516f525db5944d36c19640e32d2878e597cff..dfbc71fab1cb46064fafd994148d9e826f9c3c1b 100644 (file)
@@ -34,6 +34,11 @@ var add_td = function(tr, value) {
        $(td).text(value);
 }
 
+var headings = [
+       "Move", "Games", "%", "Win%", "WWin", "%WW", "Bwin", "%BW", "Draw", "Draw%",
+       "AvWElo", "AvBElo", "EloVar", "AWin%"
+];
+
 var show_lines = function(data, game) {
        var moves = data['moves'];
        $('#numviewers').text(data['opening']);
@@ -43,7 +48,15 @@ var show_lines = function(data, game) {
                total_num += parseInt(move['white']);
                total_num += parseInt(move['draw']);
                total_num += parseInt(move['black']);
-       }       
+       }
+
+       var headings_tr = $("#headings");
+       headings_tr.empty();
+       for (var i = 0; i < headings.length; ++i) {
+               var th = document.createElement("th");
+               headings_tr.append(th);
+               $(th).text(headings[i]);
+       }
 
        var tbl = $("#lines");
        tbl.empty();