Skip to content

Commit

Permalink
chore: fix Chessboard -> new Chessboard
Browse files Browse the repository at this point in the history
  • Loading branch information
zackschuster committed Sep 29, 2022
1 parent 5a22310 commit 91ee4f7
Show file tree
Hide file tree
Showing 33 changed files with 113 additions and 113 deletions.
8 changes: 4 additions & 4 deletions data/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -426,13 +426,13 @@
"errors":[
{
"id":1001,
"desc":"The first argument to <code class='js plain'>Chessboard()</code> cannot be an empty string.",
"fix":"The first argument to the <code class='js plain'>Chessboard()</code> constructor should be the id of a DOM element or a reference to a single DOM element."
"desc":"The first argument to <code class='js plain'>new Chessboard()</code> cannot be an empty string.",
"fix":"The first argument to the <code class='js plain'>new Chessboard()</code> constructor should be the id of a DOM element or a reference to a single DOM element."
},
{
"id":1003,
"desc":"The first argument to <code class='js plain'>Chessboard()</code> must be an ID or a single DOM node.",
"fix":"The first argument to the <code class='js plain'>Chessboard()</code> constructor should be the id of a DOM element or a reference to a single DOM element."
"desc":"The first argument to <code class='js plain'>new Chessboard()</code> must be an ID or a single DOM node.",
"fix":"The first argument to the <code class='js plain'>new Chessboard()</code> constructor should be the id of a DOM element or a reference to a single DOM element."
},
{
"id":2826,
Expand Down
10 changes: 5 additions & 5 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')
var board = new Chessboard('myBoard')
12 changes: 6 additions & 6 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')
var board = new Chessboard('myBoard', 'start')
12 changes: 6 additions & 6 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)
var board = new Chessboard('myBoard', ruyLopez)
22 changes: 11 additions & 11 deletions examples/1003-position-object.example
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
===== 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',
e4: 'wK'
}
var board = Chessboard('myBoard', position)
var board = new Chessboard('myBoard', position)
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 = new 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 = new Chessboard('myBoard', config)
28 changes: 14 additions & 14 deletions examples/2002-config-notation.example
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
===== id
2002

===== Name
Notation
===== Description
Use the <a href="docs.html#config:showNotation"><code class="js plain">showNotation</code></a> property to turn board notation on or off.
===== HTML
<div id="myBoard" style="width: 400px"></div>
===== JS
var config = {
showNotation: false,
position: 'start'
===== Name
Notation

===== Description
Use the <a href="docs.html#config:showNotation"><code class="js plain">showNotation</code></a> property to turn board notation on or off.

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

===== JS
var config = {
showNotation: false,
position: 'start'
}
var board = Chessboard('myBoard', config)
var board = new Chessboard('myBoard', config)
30 changes: 15 additions & 15 deletions examples/2003-draggable-snapback.example
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
===== id
2003

===== Name
Draggable Snapback
===== Description
Set <a href="docs.html#config:draggable"><code class="js plain">draggable</code></a> to <code class='js keyword'>true</code> to allow drag and drop of pieces. Pieces will return to their original square when dropped off the board (ie: the default for <a href="docs.html#config:dropOffBoard"><code class="js plain">dropOffBoard</code></a> is <code class="js string">'snapback'</code>).
===== HTML
<div id="myBoard" style="width: 400px"></div>
===== JS
var config = {
draggable: true,
dropOffBoard: 'snapback', // this is the default
position: 'start'
===== Name
Draggable Snapback

===== Description
Set <a href="docs.html#config:draggable"><code class="js plain">draggable</code></a> to <code class='js keyword'>true</code> to allow drag and drop of pieces. Pieces will return to their original square when dropped off the board (ie: the default for <a href="docs.html#config:dropOffBoard"><code class="js plain">dropOffBoard</code></a> is <code class="js string">'snapback'</code>).

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

===== JS
var config = {
draggable: true,
dropOffBoard: 'snapback', // this is the default
position: 'start'
}
var board = Chessboard('myBoard', config)
var board = new Chessboard('myBoard', config)
2 changes: 1 addition & 1 deletion examples/2004-piece-theme-string.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ var config = {
pieceTheme: 'img/chesspieces/alpha/{piece}.png',
position: 'start'
}
var board = Chessboard('myBoard', config)
var board = new Chessboard('myBoard', config)
2 changes: 1 addition & 1 deletion examples/2030-piece-theme-function.example
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ var config = {
pieceTheme: pieceTheme,
position: 'start'
}
var board = Chessboard('myBoard', config)
var board = new Chessboard('myBoard', config)
2 changes: 1 addition & 1 deletion examples/2044-position-fen.example
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ You can set the <a href="docs.html#config:position"><code class="js plain">posit
var config = {
position: 'r1bqkbnr/pppp1ppp/2n5/1B2p3/4P3/5N2/PPPP1PPP/RNBQK2R'
}
var board = Chessboard('myBoard', config)
var board = new Chessboard('myBoard', config)
2 changes: 1 addition & 1 deletion examples/2063-position-object.example
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ var config = {
e4: 'wK'
}
};
var board = Chessboard('myBoard', config)
var board = new Chessboard('myBoard', config)
2 changes: 1 addition & 1 deletion examples/2082-draggable-trash.example
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ var config = {
dropOffBoard: 'trash',
position: 'start'
}
var board = Chessboard('myBoard', config)
var board = new Chessboard('myBoard', config)
2 changes: 1 addition & 1 deletion examples/3000-get-position.example
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var config = {
draggable: true,
position: 'start'
}
var board = Chessboard('myBoard', config)
var board = new Chessboard('myBoard', config)

function clickShowPositionBtn () {
console.log('Current position as an Object:')
Expand Down
2 changes: 1 addition & 1 deletion examples/3002-set-position-instant.example
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Pass <code class="js keyword">false</code> as the second argument to the <a href
<button id="setRookCheckmateBtn">Rook Checkmate</button>

===== JS
const board = Chessboard('myBoard')
const board = new Chessboard('myBoard')

document.getElementById('setRuyLopezBtn').onclick = () => board.position('r1bqkbnr/pppp1ppp/2n5/1B2p3/4P3/5N2/PPPP1PPP/RNBQK2R', false)
document.getElementById('setStartBtn').onclick = () => board.start(false)
Expand Down
2 changes: 1 addition & 1 deletion examples/3005-orientation.example
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Use the <a href="docs.html#methods:orientation"><code class="js plain">orientati

===== JS
const ruyLopez = 'r1bqkbnr/pppp1ppp/2n5/1B2p3/4P3/5N2/PPPP1PPP/RNBQK2R'
const board = Chessboard('myBoard', ruyLopez)
const board = new Chessboard('myBoard', ruyLopez)

document.getElementById('showOrientationBtn').onclick = () => console.log('Board orientation is: ' + board.orientation())
document.getElementById('flipOrientationBtn').onclick = () => board.flip()
Expand Down
2 changes: 1 addition & 1 deletion examples/3006-destroy.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ Use the <a href="docs.html#methods:destroy"><code class="js plain">destroy</code
<button id="destroyBtn">Destroy Board</button>

===== JS
const board = Chessboard('myBoard', 'start')
const board = new Chessboard('myBoard', 'start')

document.getElementById('destroyBtn').onclick = () => board.destroy()
2 changes: 1 addition & 1 deletion examples/3007-resize.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ Use the <a href="docs.html#methods:resize"><code class="js plain">resize</code><

===== JS
// NOTE: click "View example in new window." to see the full effect of this example
const board = Chessboard('myBoard', 'start')
const board = new Chessboard('myBoard', 'start')
window.onresize = () => board.resize()
2 changes: 1 addition & 1 deletion examples/4001-ondragstart.example
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ var config = {
onDragStart: onDragStart,
sparePieces: true
}
var board = Chessboard('myBoard', config)
var board = new Chessboard('myBoard', config)
2 changes: 1 addition & 1 deletion examples/4002-ondragstart-prevent-drag.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Prevent the drag action by returning <code class="js keyword">false</code> from
<button id="flipOrientationBtn">Flip Orientation</button>

===== JS
const board = Chessboard('myBoard', {
const board = new Chessboard('myBoard', {
draggable: true,
position: 'start',
// only allow pieces to be dragged when the board is oriented in their direction
Expand Down
2 changes: 1 addition & 1 deletion examples/4003-ondragmove.example
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ var config = {
onDragMove: onDragMove,
sparePieces: true
}
var board = Chessboard('myBoard', config)
var board = new Chessboard('myBoard', config)
2 changes: 1 addition & 1 deletion examples/4004-ondrop.example
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ var config = {
onDrop: onDrop,
sparePieces: true
}
var board = Chessboard('myBoard', config)
var board = new Chessboard('myBoard', config)
2 changes: 1 addition & 1 deletion examples/4005-ondrop-snapback.example
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ var config = {
position: 'start',
onDrop: onDrop
}
var board = Chessboard('myBoard', config)
var board = new Chessboard('myBoard', config)
2 changes: 1 addition & 1 deletion examples/4006-ondrop-trash.example
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ var config = {
position: 'start',
onDrop: onDrop
}
var board = Chessboard('myBoard', config)
var board = new Chessboard('myBoard', config)
2 changes: 1 addition & 1 deletion examples/4011-onsnapbackend.example
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ var config = {
position: 'start',
onSnapbackEnd: onSnapbackEnd
}
var board = Chessboard('myBoard', config)
var board = new Chessboard('myBoard', config)
2 changes: 1 addition & 1 deletion examples/5000-legal-moves.example
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,6 @@ var config = {
onDrop: onDrop,
onSnapEnd: onSnapEnd
}
board = Chessboard('myBoard', config)
board = new Chessboard('myBoard', config)

updateStatus()
2 changes: 1 addition & 1 deletion examples/5001-play-random-computer.example
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ var config = {
onDrop: onDrop,
onSnapEnd: onSnapEnd
}
board = Chessboard('myBoard', config)
board = new Chessboard('myBoard', config)
2 changes: 1 addition & 1 deletion examples/5002-random-vs-random.example
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ function makeRandomMove () {
window.setTimeout(makeRandomMove, 500)
}

board = Chessboard('myBoard', 'start')
board = new Chessboard('myBoard', 'start')

window.setTimeout(makeRandomMove, 500)
2 changes: 1 addition & 1 deletion examples/5003-highlight-legal-moves.example
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ var config = {
onMouseoverSquare: onMouseoverSquare,
onSnapEnd: onSnapEnd
}
board = Chessboard('myBoard', config)
board = new Chessboard('myBoard', config)
2 changes: 1 addition & 1 deletion examples/5004-piece-highlight1.example
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ var config = {
position: 'start',
onMoveEnd: onMoveEnd
}
board = Chessboard('myBoard', config)
board = new Chessboard('myBoard', config)

window.setTimeout(makeRandomMove, 500)
Loading

0 comments on commit 91ee4f7

Please sign in to comment.