a web component for displaying chess games
npm install chess-gameA web component for displaying chess games.
Chessboard functionality is provided by gchessboard.
This web component adds next and previous buttons and the list of moves on the side.
This is my first javascript project.
I started it in order to learn web components.
It might not adhere to the best practices.
Not recommended for production use yet.
``html`
es-module-shims.js is needed because most browsers other than Chrome don't support import map.
You can remove es-module-shims.js and the import map:
`html`
In that case you have to download index.js, chess.js and gchessboard to the root directory of your web server,
and modify index.js import statements like this:
`javascript`
import { Chess } from './chess.js'
import { GChessBoardElement } from './gchessboard.js' // or whatever filename you choose for gchessboard
You can set an intial position by adding a FEN tag to the PGN:
`html`
All elements are sized in em units, so you can change the size of the web component by changing the font size:
`html`
Users can enable/disable autoplay by clicking the autoplay button.
If you want autoplay to be enabled when the web page is loaded, you can use the autoplay attribute:
`html`
By default autoplay makes 1 move per second, so the period is 1 second.
You can use the autoplay-period attribute to set the period in milliseconds:
`html`
Users can flip the board by clicking the ⇵ button.
By default the chessboard is displayed from the white side.
You can set the orienation to black:
`html``
Bug reports, bug fixes, and UI improvements, are welcome.
New features should be discussed first.
Copyright (C) 2022 Charalampos Mitsakis
This software is licensed under the terms of the Apache License, Version 2.0