cm-chessboard 5.4.0 → 5.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/examples/input-callbacks.html +6 -17
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,10 +16,11 @@ aspects of chess games.
|
|
|
16
16
|
- Uses SVG for rendering
|
|
17
17
|
- [Allows adding **extensions** to extend the functionality](https://shaack.com/projekte/cm-chessboard/examples/extensions/chessboard-arrows-extension.html)
|
|
18
18
|
|
|
19
|
-
## Extensions
|
|
19
|
+
## Extensions
|
|
20
20
|
|
|
21
21
|
- [Accessibility Extension](https://shaack.com/projekte/cm-chessboard/examples/extensions/chessboard-accessibility-extension.html)
|
|
22
22
|
- [Arrows Extension](https://shaack.com/projekte/cm-chessboard/examples/extensions/chessboard-arrows-extension.html) (by [@barakmich](https://github.com/barakmich))
|
|
23
|
+
- [PromotionDialog Extension](https://shaack.com/projekte/cm-chessboard/examples/extensions/chessboard-promotion-dialog-extension.html) 🆕
|
|
23
24
|
|
|
24
25
|
## Demo and repository
|
|
25
26
|
|
|
@@ -13,23 +13,9 @@
|
|
|
13
13
|
<div class="board" id="board1"></div>
|
|
14
14
|
<div class="board" id="board2"></div>
|
|
15
15
|
<br style="clear: both"/>
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
let markerType
|
|
20
|
-
if(event.type === SQUARE_SELECT_TYPE.primary) {
|
|
21
|
-
markerType = MARKER_TYPE.dot
|
|
22
|
-
} else {
|
|
23
|
-
markerType = MARKER_TYPE.circle
|
|
24
|
-
}
|
|
25
|
-
const markersOnSquare = board1.getMarkers(markerType, event.square)
|
|
26
|
-
if (markersOnSquare.length > 0) {
|
|
27
|
-
board1.removeMarkers(markerType, event.square)
|
|
28
|
-
} else {
|
|
29
|
-
board1.addMarker(markerType, event.square)
|
|
30
|
-
}
|
|
31
|
-
})
|
|
32
|
-
</pre>
|
|
16
|
+
<div>
|
|
17
|
+
<button onclick="window.removeDots()" class="btn btn-primary">Remove all dots</button>
|
|
18
|
+
</div>
|
|
33
19
|
<script type="module">
|
|
34
20
|
import {Chessboard, MARKER_TYPE, SQUARE_SELECT_TYPE} from "../src/cm-chessboard/Chessboard.js"
|
|
35
21
|
import {FEN} from "../src/cm-chessboard/model/Position.js"
|
|
@@ -53,6 +39,9 @@
|
|
|
53
39
|
board1.addMarker(markerType, event.square)
|
|
54
40
|
}
|
|
55
41
|
})
|
|
42
|
+
window.removeDots = () => {
|
|
43
|
+
board1.removeMarkers(MARKER_TYPE.dot)
|
|
44
|
+
}
|
|
56
45
|
|
|
57
46
|
const board2 = new Chessboard(document.getElementById("board2"), {
|
|
58
47
|
position: "rn2k1r1/ppp1pp1p/3p2p1/5bn1/P7/2N2B2/1PPPPP2/2BNK1RR",
|