Skip to content

Commit

Permalink
Merge pull request #22 from CoryWritesCode/corywritescode/issue19/tog…
Browse files Browse the repository at this point in the history
…gle-not-working-on-mobile

Update rest of the events to make sure they work on mobile
  • Loading branch information
LabinatorSolutions authored Oct 28, 2019
2 parents c9c5825 + ddc2f21 commit 05ebbc2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"eslint.enable": false
}
23 changes: 12 additions & 11 deletions css/board.css
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#btn-take-back {
background-image: url('../img/icons/takeback-enabled.svg');
}
#btn-take-back.disabled{
#btn-take-back.disabled {
background-image: url('../img/icons/takeback-disabled.svg');
}

Expand All @@ -70,11 +70,15 @@
}

#btn-settings {
background-image: url('../img/icons/settings.svg');
background-image: url('../img/icons/settings.svg');
}

/* main styles */

.buttons > button {
background-color: #ffffff;
}

.chess-area {
display: flex;
display: -webkit-flex;
Expand Down Expand Up @@ -132,7 +136,7 @@
text-decoration: underline;
}
.chess-area .board-table .promotion span.active {
background: #DCDCDC;
background: #dcdcdc;
}
.chess-area .board-table .promotion.hidden {
display: none;
Expand Down Expand Up @@ -430,7 +434,7 @@
padding: 5px;
font: normal 13px Arial;
}
.chess-area .board-settings .turns-history ol li:nth-child(2n+2) {
.chess-area .board-settings .turns-history ol li:nth-child(2n + 2) {
background: #f3f3f3;
}

Expand Down Expand Up @@ -545,7 +549,7 @@
background-color: #f5f5f5;
}

.chess-area .board-settings .btn-new-game {
.chess-area .board-settings .btn-new-game {
display: flex;
display: -webkit-flex;
align-items: center;
Expand All @@ -555,7 +559,7 @@
margin: 0 3px 0 2px;
border: none;
border-radius: 3px;
background: #D41C3B;
background: #d41c3b;
font-size: 14px;
line-height: 100%;
text-transform: none;
Expand Down Expand Up @@ -683,7 +687,6 @@
opacity: 0.7;
}
.chess-area .board-settings .castling .opts input {

}
.chess-area .board-settings .buttons {
width: 100%;
Expand Down Expand Up @@ -723,8 +726,7 @@
padding: 10px 0 0 0;
}

@media (max-width: 810px) {

@media (max-width: 810px) {
.chess-area {
align-items: center;
-webkit-align-items: center;
Expand Down Expand Up @@ -768,7 +770,6 @@
font-weight: bold;
color: #696868;
}

}

@media (max-width: 768px) {
Expand All @@ -792,4 +793,4 @@
max-width: 780px;
margin: 30px auto 40px auto;
font: normal 12px/18px Arial;
}
}
16 changes: 8 additions & 8 deletions js/board-controls-bottom.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// Rotate board

$('#btn-flip-board').click(function() {
$('#btn-flip-board').on('click touchstart', function () {
if (typeof board.flip == 'function') {
board.flip();
} else {
Expand All @@ -12,7 +12,7 @@ $('#btn-flip-board').click(function() {

// Switch sides

$('#btn-switch-sides').click(function() {
$('#btn-switch-sides').on('click touchstart', function () {
if (typeof board.flip == 'function') {
board.flip();
} else {
Expand All @@ -25,7 +25,7 @@ $('#btn-switch-sides').click(function() {
}

else if (playerSide == 'b') {
playerSide ='w';
playerSide = 'w';
opponentSide = 'b';
}

Expand All @@ -35,7 +35,7 @@ $('#btn-switch-sides').click(function() {

// Save PGN string popup

$('#btn-save-pgn').click(function() {
$('#btn-save-pgn').on('click touchstart', function () {
if ($('#board-save-pgn-area').hasClass('hidden')) {
$('#board-load-fen-area, #board-load-pgn-area').addClass('hidden');
$('#board-save-pgn-area').removeClass('hidden');
Expand All @@ -47,7 +47,7 @@ $('#btn-save-pgn').click(function() {

// Disable engine

$('#btn-engine-disable').click(function() {
$('#btn-engine-disable').on('click touchstart', function () {
if ($('#btn-engine-disable').hasClass('active')) {
$('#btn-engine-disable').removeClass('active');
$('#btn-engine-disable').text("AI");
Expand All @@ -64,7 +64,7 @@ $('#btn-engine-disable').click(function() {

// Show hint where to make move

$('#btn-show-hint').click(function() {
$('#btn-show-hint').on('click touchstart', function () {
if ($(this).hasClass('disabled')) {
console.log('Cannot show hint in opponent turn.');
return;
Expand All @@ -78,7 +78,7 @@ $('#btn-show-hint').click(function() {

// Make one step back

$('#btn-take-back').click(function() {
$('#btn-take-back').on('click touchstart', function () {
game.undo();
board.position(game.fen());
game.undo();
Expand All @@ -90,7 +90,7 @@ $('#btn-take-back').click(function() {

// Promotion popup ui

$('#game-promotion span').click(function() {
$('#game-promotion span').on('click touchstart', function () {

$('#game-promotion span').removeClass('active');
$(this).addClass('active');
Expand Down

0 comments on commit 05ebbc2

Please sign in to comment.