]> git.sesse.net Git - remoteglot-book/commitdiff
Show move number.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 13 Dec 2014 23:13:12 +0000 (00:13 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 13 Dec 2014 23:13:12 +0000 (00:13 +0100)
www/js/book.js

index d95b6e8acdd6e3f1040b76d78ac80b05ed55c274..a489a6a3ed3c1a1dc0ef199789b870274ee42032 100644 (file)
@@ -188,6 +188,14 @@ var show_lines = function(data, game) {
                                var td = document.createElement("td");
                                tr.appendChild(td);
                                $(td).addClass("move");
+                               if (line[j] !== undefined) {
+                                       if (history.length % 2 == 0) {
+                                               $(td).text(((history.length / 2) + 1) + ". ");
+                                       } else {
+                                               $(td).text(((history.length / 2) + 0.5) + ". …");
+                                       }
+                               }
+
                                var move_a = document.createElement("a");
                                move_a.href = "javascript:make_move('" + line[j] + "')";
                                td.appendChild(move_a);