diff --git a/public/javascripts/analyse.js b/public/javascripts/analyse.js index 84dfad2b9c..ee3638a05a 100644 --- a/public/javascripts/analyse.js +++ b/public/javascripts/analyse.js @@ -48,8 +48,21 @@ function customFunctionOnPgnGameLoad() { $("#autoplayButton").click(refreshButtonset); } +function posToSquareId(pos) { + if (pos.length != 2) return; + var x = "abcdefgh".indexOf(pos[0]), y = 8 - parseInt(pos[1]); + return "img_tcol" + x + "trow" + y; +} + function customFunctionOnMove() { - $('#GameLastComment').toggle($('#GameLastComment > .comment').text().length > 0); + var $comment = $('#GameLastComment'); + $comment.toggle($comment.find('> .comment').text().length > 0); + var moves = $comment.find('.commentMove').map(function() { return $(this).text(); }); + var ids = $.map(moves, posToSquareId); + $("#GameBoard img.bestmove").removeClass("bestmove"); + $.each(ids, function() { + if (this) $("#" + this).addClass("bestmove"); + }); refreshButtonset(); var chart = $("div.adv_chart").data("chart"); if (chart) { diff --git a/public/stylesheets/analyse.css b/public/stylesheets/analyse.css index 244c3a9260..16ccd5bc4a 100644 --- a/public/stylesheets/analyse.css +++ b/public/stylesheets/analyse.css @@ -54,6 +54,10 @@ span.board_mark.horz { #GameBoard td.highlightBlackSquare img { background: url(../images/over5.png) no-repeat; } +#GameBoard td img.bestmove { + background: url(../images/sover.png) no-repeat; + background-position: 0 -64px; +} #GameBoard td img { width: 64px; height: 64px; diff --git a/todo b/todo index e928c196d9..6193a17dcd 100644 --- a/todo +++ b/todo @@ -29,3 +29,4 @@ also translate websockets error message @someone = link to someone's profile make ai servers use futures instead of IOs highlight analysis best move +check ai fallback to main server