1 function fenToDiag(vname
) {
2 import(`/variants/${vname}/class.js`).then(module
=> {
3 window
.V
= module
.default;
4 for (const [k
, v
] of Object
.entries(V
.Aliases
))
10 // TODO: heuristic to improve for ratio != 1 (how?)
11 function getDiagSize() {
12 if (window
.innerWidth
> 1000)
14 if (window
.innerWidth
< 800)
15 return window
.innerWidth
;
16 return window
.innerWidth
/ 2;
19 function drawDiagrams() {
20 const diagrams
= document
.getElementsByClassName("diag");
21 for (let i
=0; i
<diagrams
.length
; i
++) {
22 let chessboard
= document
.createElement("div");
23 chessboard
.classList
.add("chessboard");
24 diagrams
[i
].appendChild(chessboard
);
25 const diagSize
= getDiagSize();
26 diagrams
[i
].style
.width
= diagSize
+ "px";
27 diagrams
[i
].style
.height
= diagSize
+ "px";
28 diagrams
[i
].id
= "diag_" + i
;
31 fen: diagrams
[i
].dataset
.fen
,
32 color: diagrams
[i
].dataset
.col
|| 'w',