}
}
+ function downloadDictionnary(code) {
+ if (typeof downloadDictionnary.code === "undefined") {
+ downloadDictionnary.code = "";
+ } else if (downloadDictionnary.code === code) {
+ return;
+ }
+ downloadDictionnary.code = code;
+
+ const file = new XMLHttpRequest();
+ file.overrideMimeType("application/json");
+ file.open("GET", "dict/" + code + ".json", true);
+ file.onreadystatechange = function () {
+ if ((file.readyState === 4) && (file.status == "200")) {
+ try {
+ dictionnary = JSON.parse(file.responseText);
+ document.getElementById("check-spelling").disabled = false;
+ } catch (e) {
+ console.error(e);
+ }
+ }
+ };
+ file.send(null);
+ return;
+ }
+
function removeElem(elem) {
elem.parentNode.removeChild(elem);
}
case "boardLang":
localStorage.trivabbleBoardLang = value;
document.getElementById("board-lang").value = value;
+ document.getElementById("check-spelling").disabled = true;
+ downloadDictionnary(value);
break;
}
}
return content;
}
- function downloadDictionnary(code) {
- const file = new XMLHttpRequest();
- file.overrideMimeType("application/json");
- file.open("GET", "dict/" + code + ".json", true);
- file.onreadystatechange = function () {
- if ((file.readyState === 4) && (file.status == "200")) {
- try {
- dictionnary = JSON.parse(file.responseText);
- document.getElementById("check-spelling").disabled = false;
- } catch (e) {
- console.error(e);
- }
- }
- };
- file.send(null);
- return;
- }
-
function handleChatMessage(msg) {
if (msg.specialMsg) {
switch (msg.specialMsg.type) {
? 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;
- downloadDictionnary(msg.specialMsg.newBoardLang);
}
}
}
}
if (localStorage.trivabbleBoardLang) {
- document.getElementById("check-spelling").disabled = true;
document.getElementById("board-lang").value = localStorage.trivabbleBoardLang;
- downloadDictionnary(localStorage.trivabbleBoardLang);
}
startGame(localStorage.trivabbleGameNumber, localStorage.trivabbleBoardLang);