Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# git diff files
*.diff

dist/
dist/build
node_modules/

website/*.html
Expand Down
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"editor.defaultFormatter": "standard.vscode-standard",
"standard.enable": true,
"standard.autoFixOnSave": true
}
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

All notable changes to this project will be documented in this file.

## [1.1.0] - 2022-07-13
- Available as an npm module (both ES6 and CommonJS) with instructions
- Specify number of spares available to be placed
- Bug fixes and optimizations
- Works better on mobile
- Default piece images from CDN
- Internal position is updated before firing onChange
- Dragged piece can be magnified
- Accessibility improvements (alt tag)
- Can preload piece images

## [1.0.0] - 2019-06-11
- Orientation methods now return current orientation. [Issue #64]
- Drop support for IE8
Expand Down
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@ chessboard.js is a JavaScript chessboard component. It depends on [jQuery] v3.4.

Please see [chessboardjs.com] for documentation and examples.

## Usage

Installation: `npm i @discape/chessboardjs`

```js
import { Chessboard, fenToObj, objToFen } from "@discape/chessboardjs";
```

```js
const { Chessboard, fenToObj, objToFen } = require("@discape/chessboardjs");
```

Be sure to include the css:

```html
<link rel="stylesheet"
href="https://unpkg.com/@discape/chessboardjs/dist/build/chessboard.min.css"
crossorigin="anonymous">
```

## What is chessboard.js?

chessboard.js is a standalone JavaScript Chess Board. It is designed to be "just
Expand Down
104 changes: 52 additions & 52 deletions data/releases.json
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
[
"-----------------------------------------------------------------",
{
"released":false,
"version":"0.3.1",
"date":"10 Aug 2013",
"changes":[
"Orientation methods now return current orientation (GitHub Issue #64)"
],
"files":[
{ "name":"chessboardjs-0.3.1.zip", "size":"44.6 KB" }
]
},
"-----------------------------------------------------------------",
{
"version":"0.3.0",
"date":"10 Aug 2013",
"changes":[
"Added appearSpeed animation config",
"Added onSnapbackEnd event",
"Added onMoveEnd event"
],
"files":[
{ "name":"chessboardjs-0.3.0.zip", "size":"44.6 KB" }
]
},
"-----------------------------------------------------------------",
{
"version":"0.2.0",
"date":"05 Aug 2013",
"changes":[
"Added onMouseoverSquare and onMouseoutSquare events",
"Added onSnapEnd event",
"Added square code as CSS class on the squares",
"chess.js integration examples"
],
"files":[
{ "name":"chessboardjs-0.2.0.zip", "size":"44.6 KB" }
]
},
"-----------------------------------------------------------------",
{
"version":"0.1.0",
"date":"21 Jul 2013",
"changes":[
"Initial release"
],
"files":[
{ "name":"chessboard-0.1.0.zip", "size":"44.0 KB" }
]
},
"-----------------------------------------------------------------"
[
"-----------------------------------------------------------------",
{
"released":false,
"version":"0.3.1",
"date":"10 Aug 2013",
"changes":[
"Orientation methods now return current orientation (GitHub Issue #64)"
],
"files":[
{ "name":"chessboardjs-0.3.1.zip", "size":"44.6 KB" }
]
},
"-----------------------------------------------------------------",
{
"version":"0.3.0",
"date":"10 Aug 2013",
"changes":[
"Added appearSpeed animation config",
"Added onSnapbackEnd event",
"Added onMoveEnd event"
],
"files":[
{ "name":"chessboardjs-0.3.0.zip", "size":"44.6 KB" }
]
},
"-----------------------------------------------------------------",
{
"version":"0.2.0",
"date":"05 Aug 2013",
"changes":[
"Added onMouseoverSquare and onMouseoutSquare events",
"Added onSnapEnd event",
"Added square code as CSS class on the squares",
"chess.js integration examples"
],
"files":[
{ "name":"chessboardjs-0.2.0.zip", "size":"44.6 KB" }
]
},
"-----------------------------------------------------------------",
{
"version":"0.1.0",
"date":"21 Jul 2013",
"changes":[
"Initial release"
],
"files":[
{ "name":"chessboard-0.1.0.zip", "size":"44.0 KB" }
]
},
"-----------------------------------------------------------------"
]
Binary file added dist/img/chesspieces/alpha/bB.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/img/chesspieces/alpha/bK.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/img/chesspieces/alpha/bN.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/img/chesspieces/alpha/bP.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/img/chesspieces/alpha/bQ.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/img/chesspieces/alpha/bR.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/img/chesspieces/alpha/wB.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/img/chesspieces/alpha/wK.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/img/chesspieces/alpha/wN.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/img/chesspieces/alpha/wP.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/img/chesspieces/alpha/wQ.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/img/chesspieces/alpha/wR.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/img/chesspieces/uscf/bB.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/img/chesspieces/uscf/bK.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/img/chesspieces/uscf/bN.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/img/chesspieces/uscf/bP.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/img/chesspieces/uscf/bQ.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/img/chesspieces/uscf/bR.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/img/chesspieces/uscf/wB.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/img/chesspieces/uscf/wK.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/img/chesspieces/uscf/wN.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/img/chesspieces/uscf/wP.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/img/chesspieces/uscf/wQ.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/img/chesspieces/uscf/wR.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/img/chesspieces/wikipedia/bB.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/img/chesspieces/wikipedia/bK.png
12 changes: 12 additions & 0 deletions dist/img/chesspieces/wikipedia/bK.svg
Binary file added dist/img/chesspieces/wikipedia/bN.png
Binary file added dist/img/chesspieces/wikipedia/bP.png
Binary file added dist/img/chesspieces/wikipedia/bQ.png
Binary file added dist/img/chesspieces/wikipedia/bR.png
Binary file added dist/img/chesspieces/wikipedia/wB.png
Binary file added dist/img/chesspieces/wikipedia/wK.png
Binary file added dist/img/chesspieces/wikipedia/wN.png
Binary file added dist/img/chesspieces/wikipedia/wP.png
Binary file added dist/img/chesspieces/wikipedia/wQ.png
Binary file added dist/img/chesspieces/wikipedia/wR.png
8 changes: 4 additions & 4 deletions examples/1000-empty-board.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
1000

===== Name
Empty Board
Empty Board

===== Description
Chessboard.js initializes to an empty board with no second argument.

===== HTML
<div id="myBoard" style="width: 400px"></div>

===== JS
var board = Chessboard('myBoard')
10 changes: 5 additions & 5 deletions examples/1001-start-position.example
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
===== id
1001

===== Name
Start Position
===== Name
Start Position

===== Description
Pass <code class="js string">'start'</code> as the second argument to initialize
the board to the start position.

===== HTML
<div id="myBoard" style="width: 400px"></div>

===== JS
var board = Chessboard('myBoard', 'start')
10 changes: 5 additions & 5 deletions examples/1002-fen.example
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
===== id
1002

===== Name
FEN String
===== Name
FEN String

===== Description
Pass a <a href="docs.html#fen_string">FEN String</a> as the second argument to
initialize the board to a specific position.

===== HTML
<div id="myBoard" style="width: 400px"></div>

===== JS
var ruyLopez = 'r1bqkbnr/pppp1ppp/2n5/1B2p3/4P3/5N2/PPPP1PPP/RNBQK2R'
var board = Chessboard('myBoard', ruyLopez)
20 changes: 10 additions & 10 deletions examples/1003-position-object.example
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
===== id
1003

===== Name
Position Object
===== Description
Pass a <a href="docs.html#position_object">Position Object</a> as the second argument to initialize the board to a specific position.
===== HTML
<div id="myBoard" style="width: 400px"></div>
===== JS
===== Name
Position Object

===== Description
Pass a <a href="docs.html#position_object">Position Object</a> as the second argument to initialize the board to a specific position.

===== HTML
<div id="myBoard" style="width: 400px"></div>

===== JS
var position = {
d6: 'bK',
d4: 'wP',
Expand Down
18 changes: 9 additions & 9 deletions examples/1004-multiple-boards.example
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
===== id
1004

===== Name
Multiple Boards
===== Description
You can have multiple boards on the same page.
===== Name
Multiple Boards

===== Description
You can have multiple boards on the same page.

===== CSS
.small-board {
display: inline-block;
margin-right: 5px;
width: 200px;
}

===== HTML
<div id="board1" class="small-board"></div>
<div id="board2" class="small-board"></div>
<div id="board3" class="small-board"></div>
===== JS

===== JS
var board1 = Chessboard('board1', {
position: 'start',
showNotation: false
Expand Down
26 changes: 13 additions & 13 deletions examples/2000-config-position.example
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
===== id
2000

===== Name
Start Position
===== Description
Set the <a href="docs.html#config:position"><code class="js plain">position</code></a> property to <code class="js string">'start'</code> to initialize the board to the start position.
===== HTML
<div id="myBoard" style="width: 400px"></div>
===== JS
var config = {
position: 'start'
===== Name
Start Position

===== Description
Set the <a href="docs.html#config:position"><code class="js plain">position</code></a> property to <code class="js string">'start'</code> to initialize the board to the start position.

===== HTML
<div id="myBoard" style="width: 400px"></div>

===== JS
var config = {
position: 'start'
}
var board = Chessboard('myBoard', config)
var board = Chessboard('myBoard', config)
28 changes: 14 additions & 14 deletions examples/2001-config-orientation.example
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
===== id
2001

===== Name
Orientation
===== Description
Use the <a href="docs.html#config:orientation"><code class="js plain">orientation</code></a> property to set board orientation.
===== HTML
<div id="myBoard" style="width: 400px"></div>
===== JS
var config = {
orientation: 'black',
position: 'start'
===== Name
Orientation

===== Description
Use the <a href="docs.html#config:orientation"><code class="js plain">orientation</code></a> property to set board orientation.

===== HTML
<div id="myBoard" style="width: 400px"></div>

===== JS
var config = {
orientation: 'black',
position: 'start'
}
var board = Chessboard('myBoard', config)
var board = Chessboard('myBoard', config)
Loading