Skip to content

Commit

Permalink
select white/black target by clicking in input field first
Browse files Browse the repository at this point in the history
  • Loading branch information
yafred committed Mar 5, 2021
1 parent 796206c commit db68c71
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions internal/embed/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
integrity="sha512-HK5fgLBL+xu6dm/Ii3z4xhlSUyZgTT9tuc/hSrtw6uzJOvgRr2a9jyxxT1ely+B+xFAmJKVSTbpM/CuL7qxO8w=="
crossorigin="anonymous" />
<script src="https://cdn.jsdelivr.net/npm/[email protected]/mustache.min.js" type="text/javascript"></script>


<script id="nextMovesTpl" type="text/mustache">
{{#.}}
<div style="display: flex">
Expand Down
11 changes: 10 additions & 1 deletion internal/embed/javascript/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var $site = $('#site')
var mostPopularMove = ''
var simplifyTimecontrol = true // make m+s equivalent to m (for example: 600 will include 600+5) and 1/n equivalent to -
var uiMode = 'opening' // opening, replay
var playerInputMode = 'white' // changes when input fields are clicked

var gameReplaying

Expand Down Expand Up @@ -49,6 +50,14 @@ $black.change(function () {
getNextMoves()
});

$white.click(function (e) {
playerInputMode = 'white'
});

$black.click(function (e) {
playerInputMode = 'black'
});

$timecontrol.change(function () {
getNextMoves()
});
Expand Down Expand Up @@ -338,7 +347,7 @@ function handleReportResponse(data) {
if ($(this).data('sitename') == 'lichess.org') {
username = 'l:' + username
}
if ($black.val() != '' && $white.val() == '') {
if (playerInputMode == 'black') {
handleNameClicked(e, $black, username)
}
else {
Expand Down

0 comments on commit db68c71

Please sign in to comment.