From 36f383819224e74d9370225b50587e98e528cbd6 Mon Sep 17 00:00:00 2001 From: Laurent Mazet Date: Wed, 27 May 2020 09:02:50 +0200 Subject: [PATCH] Change button state depending of dictionnary avability --- public/index.html | 2 +- public/trivabble.js | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/public/index.html b/public/index.html index 8dc3943..a15eb23 100644 --- a/public/index.html +++ b/public/index.html @@ -69,7 +69,7 @@

Who's turn? Click on the Turn button!

- + diff --git a/public/trivabble.js b/public/trivabble.js index ce45109..205bfea 100644 --- a/public/trivabble.js +++ b/public/trivabble.js @@ -694,6 +694,7 @@ ? format(_("You changed the language of the board to {0}"), newLang) : format(_("{0} changed the language of the board to {1}"), msg.sender, newLang) ); + document.getElementById("check-spelling").disabled = true; const code = document.getElementById("board-lang").value; const file = new XMLHttpRequest(); file.overrideMimeType("application/json"); @@ -702,6 +703,8 @@ if ((file.readyState === 4) && (file.status == "200")) { try { dictionnary = JSON.parse(file.responseText); + + document.getElementById("check-spelling").disabled = false; } catch (e) { console.error(e); } @@ -1480,6 +1483,8 @@ function searchWordInLine(row, col, incRow, incCol) { + const initLetter = getLetterFromBoard(row, col); + /* Look for first letter in line */ while (getLetterFromBoard(row - incRow, col - incCol) !== "") { row -= incRow; @@ -1494,7 +1499,7 @@ row += incRow; col += incCol; } - return (word.length > 1) ? word : ""; + return (word === initLetter) ? "" : word; } function searchNewWords() { -- 2.30.2