Update app/static/js/common.js
This commit is contained in:
1 parent
f4c1efb454
commit
67f08f4fb1
1 file changed
+1
-4
@@ -1,11 +1,9 @@
|
|||||||
// Mirrors MATE_SCORE_CP in app/analysis.py: mate in N plies arrives as ±(100000 − N).
|
|
||||||
const MATE_SCORE_CP = 100000;
|
const MATE_SCORE_CP = 100000;
|
||||||
|
|
||||||
// CBurnett piece set by Colin M.L. Burnett (GPLv2+/BSD/CC BY-SA),
|
// CBurnett piece set by Colin M.L. Burnett (GPLv2+/BSD/CC BY-SA),
|
||||||
// via https://github.com/lichess-org/lila/tree/master/public/piece/cburnett
|
// via https://github.com/lichess-org/lila/tree/master/public/piece/cburnett
|
||||||
const PIECE_IMAGE_DIR = "/static/pieces";
|
const PIECE_IMAGE_DIR = "/static/pieces";
|
||||||
|
|
||||||
// Classic traffic-light classification colors (for arrows on the board).
|
|
||||||
const CLASS_COLORS = {
|
const CLASS_COLORS = {
|
||||||
best: "#3fae5b",
|
best: "#3fae5b",
|
||||||
good: "#7fbf5f",
|
good: "#7fbf5f",
|
||||||
@@ -53,7 +51,7 @@ function formatEval(cp) {
|
|||||||
|
|
||||||
function renderBoard(fen, flip) {
|
function renderBoard(fen, flip) {
|
||||||
const placement = fen.split(" ")[0];
|
const placement = fen.split(" ")[0];
|
||||||
const rows = placement.split("/"); // rows[0] = rank 8 ... rows[7] = rank 1
|
const rows = placement.split("/");
|
||||||
|
|
||||||
const board = el("board");
|
const board = el("board");
|
||||||
board.innerHTML = "";
|
board.innerHTML = "";
|
||||||
@@ -90,7 +88,6 @@ function renderBoard(fen, flip) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Center of a square (e.g. "e4") as {x, y} in a 0-100 viewBox, matching renderBoard's layout.
|
|
||||||
function squareToXY(square, flip) {
|
function squareToXY(square, flip) {
|
||||||
const file = square.charCodeAt(0) - "a".charCodeAt(0); // 0-7
|
const file = square.charCodeAt(0) - "a".charCodeAt(0); // 0-7
|
||||||
const rank = Number(square[1]); // 1-8
|
const rank = Number(square[1]); // 1-8
|
||||||
|
|||||||
Reference in new issue
Block a user