cm-chessboard 3.17.2 → 3.17.7
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/favicon.ico
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -39,6 +39,14 @@ export const piecesTranslations = {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
export function renderPieceTitle(lang, name, color = undefined) {
|
|
43
|
+
let title = piecesTranslations[lang].pieces_long[name]
|
|
44
|
+
if(color) {
|
|
45
|
+
title += " " + piecesTranslations[lang].colors_long[color]
|
|
46
|
+
}
|
|
47
|
+
return title
|
|
48
|
+
}
|
|
49
|
+
|
|
42
50
|
export const SQUARE_COORDINATES = [
|
|
43
51
|
"a1", "b1", "c1", "d1", "e1", "f1", "g1", "h1",
|
|
44
52
|
"a2", "b2", "c2", "d2", "e2", "f2", "g2", "h2",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Repository: https://github.com/shaack/cm-chessboard
|
|
4
4
|
* License: MIT, see file 'LICENSE'
|
|
5
5
|
*/
|
|
6
|
-
import {ChessboardView} from "./ChessboardView.js"
|
|
6
|
+
import {ChessboardView, renderPieceTitle} from "./ChessboardView.js"
|
|
7
7
|
import {COLOR} from "./Chessboard.js"
|
|
8
8
|
import {piecesTranslations} from "./ChessboardView.js"
|
|
9
9
|
|
|
@@ -54,9 +54,9 @@ export class ChessboardViewAccessible extends ChessboardView {
|
|
|
54
54
|
let listB = ""
|
|
55
55
|
for (const piece of pieces) {
|
|
56
56
|
if (piece.color === "w") {
|
|
57
|
-
listW += `<li class="list-inline-item">${this.
|
|
57
|
+
listW += `<li class="list-inline-item">${renderPieceTitle(this.lang, piece.name)} ${piece.position}</li>`
|
|
58
58
|
} else {
|
|
59
|
-
listB += `<li class="list-inline-item">${this.
|
|
59
|
+
listB += `<li class="list-inline-item">${renderPieceTitle(this.lang, piece.name)} ${piece.position}</li>`
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
count++
|
|
@@ -76,7 +76,7 @@ export class ChessboardViewAccessible extends ChessboardView {
|
|
|
76
76
|
files.reverse()
|
|
77
77
|
squares.reverse()
|
|
78
78
|
}
|
|
79
|
-
let html = `<table><caption>${this.
|
|
79
|
+
let html = `<table><caption>${this.th.board_as_table}</caption><tr><th></th>`
|
|
80
80
|
for (const rank of ranks) {
|
|
81
81
|
html += `<th scope='col'>${rank}</th>`
|
|
82
82
|
}
|
|
@@ -89,7 +89,7 @@ export class ChessboardViewAccessible extends ChessboardView {
|
|
|
89
89
|
if(pieceCode) {
|
|
90
90
|
color = pieceCode.charAt(0)
|
|
91
91
|
name = pieceCode.charAt(1)
|
|
92
|
-
html += `<td>${this.
|
|
92
|
+
html += `<td>${renderPieceTitle(this.lang, name, color)}</td>`
|
|
93
93
|
} else {
|
|
94
94
|
html += `<td></td>`
|
|
95
95
|
}
|