From: Laurent Mazet Date: Tue, 24 Nov 2020 12:21:39 +0000 (+0100) Subject: use a local variable to store player's name X-Git-Url: https://secure.softndesign.org/git/?a=commitdiff_plain;h=a6d3dc6ed8686edeae155405e88439d9df9ea7b8;p=trivabble.git use a local variable to store player's name --- 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") ); }