Skip to content

Commit

Permalink
enable book moves in game replay
Browse files Browse the repository at this point in the history
  • Loading branch information
yafred committed Jul 9, 2021
1 parent e1ebd67 commit 656291e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
3 changes: 2 additions & 1 deletion internal/embed/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,9 @@
<a href="#" id="swap" class="fa fa-retweet"></a>
</div>
<div class="cell small-2 text-center">
<a href="#" id="show-book-moves" class="fa fa-lightbulb"></a>
<a href="#" id="show-book-moves" class="fa fa-book-open"></a>
<a href="#" id="show-filter" class="fa fa-filter" style="display: none;"></a>
<a href="#" id="show-game-details" class="fa fa-info-circle" style="display: none;"></a>
</div>
<div class="cell small-2 text-center">
<a href="#" id="reset" class="fa fa-fast-backward"></a>
Expand Down
22 changes: 19 additions & 3 deletions internal/embed/javascript/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,23 @@ $('#show-filter').click(function(e) {
e.preventDefault();
});

$('#show-game-details').click(function(e) {
$('#show-game-details').hide()
$('#book-moves-panel').hide()
$('#show-book-moves').show()
$('#game-details').show()
e.preventDefault();
});

$('#show-book-moves').click(function(e) {
$('#show-book-moves').hide()
$('#filter').hide()
$('#show-filter').show()
$('#game-details').hide()
if (uiMode == 'opening') {
$('#show-filter').show()
} else {
$('#show-game-details').show()
}
$('#book-moves-panel').show()
updateBookMoves()
e.preventDefault();
Expand Down Expand Up @@ -692,7 +705,7 @@ function setReplayMode() {
$('#game-details').show()
$('#fen-container').hide()
$('#total-games').hide()
$('#show-book-moves').hide()
$('#show-book-moves').show()
$('#filter').hide()
$('#show-filter').hide()
$('#book-moves-panel').hide()
Expand Down Expand Up @@ -809,6 +822,7 @@ function highlightMove() {
}
$('#replay a[data-index="' + round + '"][data-color="' + color + '"]').parent().addClass('highlight')
}
updateBookMoves()
}

function updateOpeningBreadcrumbs() {
Expand Down Expand Up @@ -980,7 +994,9 @@ function updateBookMoves() {
$('#book-moves').html(Mustache.render(nextMovesTpl, moves.slice(0, 12))) // limit to 12 entries
$('.next-move').bind('click', function(e) {
e.preventDefault();
move($(this).html())
if (uiMode == 'opening') {
move($(this).html())
}
});
})
}
Expand Down

0 comments on commit 656291e

Please sign in to comment.