show best move on analysis board

This commit is contained in:
Thibault Duplessis 2012-07-10 00:09:23 +02:00
parent d01aa0c8ff
commit a96e396bda
3 changed files with 19 additions and 1 deletions

View file

@ -48,8 +48,21 @@ function customFunctionOnPgnGameLoad() {
$("#autoplayButton").click(refreshButtonset); $("#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() { 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(); refreshButtonset();
var chart = $("div.adv_chart").data("chart"); var chart = $("div.adv_chart").data("chart");
if (chart) { if (chart) {

View file

@ -54,6 +54,10 @@ span.board_mark.horz {
#GameBoard td.highlightBlackSquare img { #GameBoard td.highlightBlackSquare img {
background: url(../images/over5.png) no-repeat; 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 { #GameBoard td img {
width: 64px; width: 64px;
height: 64px; height: 64px;

1
todo
View file

@ -29,3 +29,4 @@ also translate websockets error message
@someone = link to someone's profile @someone = link to someone's profile
make ai servers use futures instead of IOs make ai servers use futures instead of IOs
highlight analysis best move highlight analysis best move
check ai fallback to main server