Using the min.js file

In order to use jschess you will either need to .pack.js file which contains all needed libraries (which is discussed elsewhere) or you will need to download the minified version (.min.js) which is discussed here. This is the list of third party libraries used by jschess and their download location...

name version minified from web debug from web documentation debug from me minified from me
prototype 1.7.3 Not available for download download link my download my download
raphael 2.2.0 download download link my download my download
chess.js 0.10.2 Not available for download download link my download my download

Import them so:

<script type="text/javascript" src="out/web/third_party/prototype.min.js"></script>
<script type="text/javascript" src="out/web/third_party/raphael.min.js"></script>
<script type="text/javascript" src="out/web/third_party/chess.min.js"></script>>

Then download the minified jschess file from here. Place the file somewhere on your web server and import it from your HTML like this:

<script type="text/javascript" src="jschess.min.js"></script>
If you want to help me debug jschess or are experiencing problems you can download the uncompressed file from here and use it like this:
<script type="text/javascript" src="jschess.js"></script>
You need a place for your board, so place something like this somewhere in your html:
<div id="myid"></div>
Then you can create a board from your javascript code by calling the constructor of SvgBoard. The board will be empty so we call startpos to get initial game position:
var board=new Board()
var svgBoard=new SvgBoard(board,{ id:'myid' })
board.startPosition()

Here is the result:

Copyright Mark Veltzer © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024 mark.veltzer@gmail.com