From a6d3dc6ed8686edeae155405e88439d9df9ea7b8 Mon Sep 17 00:00:00 2001 From: Laurent Mazet Date: Tue, 24 Nov 2020 13:21:39 +0100 Subject: [PATCH] use a local variable to store player's name --- public/trivabble.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/public/trivabble.js b/public/trivabble.js index 3ee40ad..3ca0cfd 100644 --- a/public/trivabble.js +++ b/public/trivabble.js @@ -1924,10 +1924,8 @@ totalScore += getSetting("PREMIUM_SEVEN_TILES"); } - /* Ѕcore player who pressed the button */ - if (!getSetting("SCORE_LAST_PLAYER")) { - lastPlayer = getSetting("PlayerName"); - } + /* Ѕcore last player or the one who pressed the button */ + const playerName = getSetting("SCORE_LAST_PLAYER") ? lastPlayer : getSetting("PlayerName"); myChoice( format(_("{0} points will be added to:"), totalScore), { @@ -1947,7 +1945,7 @@ score: parseInt(getScoreCell(name).textContent) + totalScore }]); }, - lastPlayer || currentPlayer || getSetting("PlayerName") + playerName || lastPlayer || currentPlayer || getSetting("PlayerName") ); } -- 2.30.2