cm-chessboard 7.3.5 → 7.3.6
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.
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
<h2>Example: Input enabled, move validation with chess.js</h2>
|
|
15
15
|
<p>Input enabled for white. <a href="https://github.com/jhlywa/chess.js">chess.js</a> does the validation and answers
|
|
16
16
|
with random moves.</p>
|
|
17
|
-
<h2 class="cm-visually-hidden">
|
|
17
|
+
<h2 class="cm-visually-hidden">The chessboard widget</h2>
|
|
18
18
|
<div class="board board-large" id="board"></div>
|
|
19
19
|
<h2 class="cm-visually-hidden">The Sourcecode of the example</h2>
|
|
20
20
|
<div id="output"></div>
|
package/package.json
CHANGED
|
@@ -9,6 +9,7 @@ import {piecesTranslations, renderPieceTitle} from "../../lib/I18n.js"
|
|
|
9
9
|
|
|
10
10
|
const hlTranslations = {
|
|
11
11
|
de: {
|
|
12
|
+
chessboard: "Schachbrett",
|
|
12
13
|
pieces_lists: "Figurenlisten",
|
|
13
14
|
board_as_table: "Schachbrett als Tabelle",
|
|
14
15
|
move_piece: "Figur bewegen",
|
|
@@ -17,9 +18,11 @@ const hlTranslations = {
|
|
|
17
18
|
move: "Zug ausführen",
|
|
18
19
|
input_white_enabled: "Eingabe Weiß aktiviert",
|
|
19
20
|
input_black_enabled: "Eingabe Schwarz aktiviert",
|
|
20
|
-
input_disabled: "Eingabe deaktiviert"
|
|
21
|
+
input_disabled: "Eingabe deaktiviert",
|
|
22
|
+
pieces: "Figuren",
|
|
21
23
|
},
|
|
22
24
|
en: {
|
|
25
|
+
chessboard: "Chessboard",
|
|
23
26
|
pieces_lists: "Pieces lists",
|
|
24
27
|
board_as_table: "Chessboard as table",
|
|
25
28
|
move_piece: "Move piece",
|
|
@@ -28,7 +31,8 @@ const hlTranslations = {
|
|
|
28
31
|
move: "Make move",
|
|
29
32
|
input_white_enabled: "Input white enabled",
|
|
30
33
|
input_black_enabled: "Input black enabled",
|
|
31
|
-
input_disabled: "Input disabled"
|
|
34
|
+
input_disabled: "Input disabled",
|
|
35
|
+
pieces: "Pieces"
|
|
32
36
|
}
|
|
33
37
|
}
|
|
34
38
|
|
|
@@ -49,7 +53,7 @@ export class Accessibility extends Extension {
|
|
|
49
53
|
this.t = this.translations[this.lang]
|
|
50
54
|
this.th = hlTranslations[this.lang]
|
|
51
55
|
if (this.props.movePieceForm) {
|
|
52
|
-
this.movePieceFormContainer = this.createElement(`<div><h3>${this.th.move_piece}</h3><form>
|
|
56
|
+
this.movePieceFormContainer = this.createElement(`<div><h3 id="hl_form_${this.chessboard.id}">${this.th.move_piece}</h3><form aria-labelledby="hl_form_${this.chessboard.id}">
|
|
53
57
|
<label for="move_piece_input_from_${chessboard.id}">${this.th.from}</label><input class="input-from" type="text" size="2" id="move_piece_input_from_${chessboard.id}"/>
|
|
54
58
|
<label for="move_piece_input_to_${chessboard.id}">${this.th.to}</label><input class="input-to" type="text" size="2" id="move_piece_input_to_${chessboard.id}"/>
|
|
55
59
|
<button type="submit" class="button-move">${this.th.move}</button>
|
|
@@ -79,7 +83,7 @@ export class Accessibility extends Extension {
|
|
|
79
83
|
this.chessboard.context.appendChild(this.movePieceFormContainer)
|
|
80
84
|
}
|
|
81
85
|
if (this.props.boardAsTable) {
|
|
82
|
-
this.boardAsTableContainer = this.createElement(`<div><h3>${this.th.board_as_table}</h3><div class="table"></div></div>`)
|
|
86
|
+
this.boardAsTableContainer = this.createElement(`<div><h3 id="hl_table_${this.chessboard.id}">${this.th.board_as_table}</h3><div class="table"></div></div>`)
|
|
83
87
|
this.boardAsTable = this.boardAsTableContainer.querySelector(".table")
|
|
84
88
|
this.chessboard.context.appendChild(this.boardAsTableContainer)
|
|
85
89
|
if (this.props.visuallyHidden) {
|
|
@@ -87,7 +91,7 @@ export class Accessibility extends Extension {
|
|
|
87
91
|
}
|
|
88
92
|
}
|
|
89
93
|
if (this.props.piecesAsList) {
|
|
90
|
-
this.piecesListContainer = this.createElement(`<div><h3>${this.th.pieces_lists}</h3><div class="list"></div></div>`)
|
|
94
|
+
this.piecesListContainer = this.createElement(`<div><h3 id="hl_lists_${this.chessboard.id}">${this.th.pieces_lists}</h3><div class="list"></div></div>`)
|
|
91
95
|
this.piecesList = this.piecesListContainer.querySelector(".list")
|
|
92
96
|
this.chessboard.context.appendChild(this.piecesListContainer)
|
|
93
97
|
if (this.props.visuallyHidden) {
|
|
@@ -169,9 +173,9 @@ ${listB}`
|
|
|
169
173
|
}
|
|
170
174
|
}
|
|
171
175
|
this.piecesList.innerHTML = `
|
|
172
|
-
<h4 id="white_${this.chessboard.id}">${this.t.colors_long.w}</h4>
|
|
176
|
+
<h4 id="white_${this.chessboard.id}">${this.th.pieces} ${this.t.colors_long.w}</h4>
|
|
173
177
|
<ul aria-labelledby="white_${this.chessboard.id}" class="list-inline">${listW}</ul>
|
|
174
|
-
<h4 id="black_${this.chessboard.id}">${this.t.colors_long.b}</h4>
|
|
178
|
+
<h4 id="black_${this.chessboard.id}">${this.th.pieces} ${this.t.colors_long.b}</h4>
|
|
175
179
|
<ul aria-labelledby="black_${this.chessboard.id}" class="list-inline">${listB}</ul>`
|
|
176
180
|
}
|
|
177
181
|
|
|
@@ -184,7 +188,7 @@ ${listB}`
|
|
|
184
188
|
files.reverse()
|
|
185
189
|
squares.reverse()
|
|
186
190
|
}
|
|
187
|
-
let html = `<table
|
|
191
|
+
let html = `<table aria-labelledby="hl_table_${this.chessboard.id}"><tr><th></th>`
|
|
188
192
|
for (const rank of ranks) {
|
|
189
193
|
html += `<th scope='col'>${rank}</th>`
|
|
190
194
|
}
|