From 7a94c065d46702f1f51c1147be4364fbdffec480 Mon Sep 17 00:00:00 2001 From: rooklift <16438795+rooklift@users.noreply.github.com> Date: Wed, 7 Feb 2024 23:30:16 +0000 Subject: [PATCH] reduce space used by "Show" part of infobox --- src/modules/board_drawer.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/modules/board_drawer.js b/src/modules/board_drawer.js index 7ecfda5d..e80b6cfa 100644 --- a/src/modules/board_drawer.js +++ b/src/modules/board_drawer.js @@ -1030,6 +1030,13 @@ let board_drawer_prototype = { let tBest = translate("INFO_PANEL_BEST"); let tVisits = translate("INFO_PANEL_VISITS"); + // config.numbers uses various hardcoded strings like "Winrate" etc. But some can be shortened. + // We could actually do translations also... but for now it's just to reduce space used... + let short_strings = { + "Winrate": "Win", + "Visits": "Visit", + }; + let board = node.get_board(); let last_move = ""; @@ -1044,7 +1051,12 @@ let board_drawer_prototype = { } else if (config.no_ponder_no_candidates && !hub.engine.desired) { numbers_string = "(not pondering)"; } else { - numbers_string = config.numbers.split(" + ").join(", "); + let arr = config.numbers.split(" + "); + if (arr.length === 3) { + numbers_string = arr.map(s => short_strings[s] || s).join(", "); + } else { + numbers_string = arr.join(", "); + } } let s1 = ""; @@ -1066,7 +1078,7 @@ let board_drawer_prototype = { s1 += `${tEditing}: ${pad(pad(config.editing, 3, true), 4)} (${tEscape})`; } else { s1 += `${tPrev}: ${pad(last_move, 6)}`; - s1 += `${tShow}: ${pad(numbers_string, 23)}`; + s1 += `${tShow}: ${pad(numbers_string, 18)}`; } let move = "";