Skip to content

chessdog is a chess program that runs directly inside your browser. It can easily be embedded into other websites via a simple JavaScript API.

License

Notifications You must be signed in to change notification settings

cdietze/chessdog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chessdog

chessdog is a chess program that runs directly inside your browser. It can easily be embedded into other websites via a simple JavaScript API.

Getting Started

Here is a complete example. Insert this into any HTML page and a chess board will appear:

<div id="board"></div>
<script type="text/javascript" src="http://chessdog.christophdietze.com/chessdog.js"></script>
<script type="text/javascript">
  var board = new chessdog.Board(document.getElementById("board"));
</script>

Let's dissect what this does:

  1. Create a element where the board should be inserted, e.g.,

     <div id="board"></div>
    
  2. Include the chessdog script

     <script type="text/javascript" src="http://chessdog.christophdietze.com/chessdog.js"></script>
    
  3. Now, we can use the chessdog JavaScript API to create a chess board at the element. An iframe of a fixed size will be created as the child of the specified element.

     <script type="text/javascript">
       var board = new chessdog.Board(document.getElementById("board"));
     </script>
    
  4. Additionally, the API provides the following functions:

     board.reset()
     board.getFen()
     board.setFen(String fenString)
     board.getPgn()
     board.setPgn(String pgnString)
     board.onReady(function func)
     board.allowUserMoves(boolean allowed)
    

Demos

Building from source

In order to build from source you will need sbt v0.11.

git clone [email protected]:thunderklaus/chessdog.git
cd chessdog
sbt package-war

After the build finished successfully, you can open a demo page at ./target/webapp/demo/JackEmbedDemo.html. The final war file will be in the target directory ./target/scala_xxx/.

About

chessdog is a chess program that runs directly inside your browser. It can easily be embedded into other websites via a simple JavaScript API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published