show best move on analysis board

pull/7/merge
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);
}
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) {

View File

@ -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;

1
todo
View File

@ -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