From: Steinar H. Gunderson Date: Sat, 13 Dec 2014 23:13:12 +0000 (+0100) Subject: Show move number. X-Git-Url: https://git.sesse.net/?p=remoteglot-book;a=commitdiff_plain;h=64b65677dbce50c97c63d6aa7e31bb141cb183b5 Show move number. --- diff --git a/www/js/book.js b/www/js/book.js index d95b6e8..a489a6a 100644 --- a/www/js/book.js +++ b/www/js/book.js @@ -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);