add a button to enable spell checker
This commit is contained in:
parent
34dac8a414
commit
1595b60145
|
@ -180,3 +180,9 @@ msgstr "Aucun nouveau mot trouvé"
|
|||
|
||||
msgid "Incorrect dictionary file."
|
||||
msgstr "Dictionaire incorrect."
|
||||
|
||||
msgid "Enable spell checker"
|
||||
msgstr "Activer le vérificateur orthographique"
|
||||
|
||||
msgid "Spell checking requires Trivabble to download a dictionary. This dictionary is based on Aspell. Do you confirm?"
|
||||
msgstr "La vérification orthographique nécessite que Trivabble télécharge un dictionnaire. Ce dictionnaire est construit grâce à Aspell. Confirmez-vous ?"
|
||||
|
|
|
@ -186,3 +186,9 @@ msgstr ""
|
|||
|
||||
msgid "Incorrect dictionary file."
|
||||
msgstr ""
|
||||
|
||||
msgid "Enable spell checker"
|
||||
msgstr ""
|
||||
|
||||
msgid "Spell checking requires Trivabble to download a dictionary. This dictionary is based on Aspell. Do you confirm?"
|
||||
msgstr ""
|
||||
|
|
|
@ -69,7 +69,8 @@
|
|||
<p id="help-turn" data-l10n="text-content">Who's turn? Click on the Turn button!</p>
|
||||
<button id="clear-rack" class="minibutton" data-l10n="text-content">Put back all the tiles of your rack in the bag</button>
|
||||
<button id="show-rack" class="minibutton" data-l10n="text-content">Show my rack to other players</button>
|
||||
<button id="check-spelling" class="minibutton" data-l10n="text-content" disabled="disabled">Check spelling for new words</button>
|
||||
<button id="enable-spell-checker" class="minibutton" data-l10n="text-content">Enable spell checker</button>
|
||||
<button id="check-spelling" class="minibutton" data-l10n="text-content" style="display: none">Check spelling for new words</button>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -151,6 +151,14 @@
|
|||
}
|
||||
|
||||
function downloadDictionary(code) {
|
||||
if (localStorage.spellChecker) {
|
||||
document.getElementById("enable-spell-checker").style.display = "none";
|
||||
document.getElementById("check-spelling").style.display = "none";
|
||||
} else {
|
||||
document.getElementById("enable-spell-checker").style.display = "block";
|
||||
document.getElementById("check-spelling").style.display = "none";
|
||||
}
|
||||
|
||||
/* static variable */
|
||||
if (downloadDictionary.code === code) {
|
||||
return;
|
||||
|
@ -164,7 +172,7 @@
|
|||
if ((file.readyState === 4) && (file.status == "200")) {
|
||||
try {
|
||||
dictionary = file.responseText.split("\n");
|
||||
document.getElementById("check-spelling").disabled = false;
|
||||
document.getElementById("check-spelling").style.display = "block";
|
||||
} catch (e) {
|
||||
myAlert(_("Incorrect dictionary file."));
|
||||
}
|
||||
|
@ -173,6 +181,19 @@
|
|||
file.send(null);
|
||||
}
|
||||
|
||||
function enableSpellChecker() {
|
||||
myConfirm(
|
||||
_("Spell checking requires Trivabble to download a dictionary. This dictionary is based on Aspell. Do you confirm?"),
|
||||
function () {
|
||||
localStorage.spellChecker = true;
|
||||
downloadDictionary(localStorage.trivabbleBoardLang);
|
||||
},
|
||||
function () {
|
||||
localStorage.spellChecker = false;
|
||||
downloadDictionary(localStorage.trivabbleBoardLang);
|
||||
});
|
||||
}
|
||||
|
||||
function removeElem(elem) {
|
||||
elem.parentNode.removeChild(elem);
|
||||
}
|
||||
|
@ -578,7 +599,6 @@
|
|||
case "boardLang":
|
||||
localStorage.trivabbleBoardLang = value;
|
||||
document.getElementById("board-lang").value = value;
|
||||
document.getElementById("check-spelling").disabled = true;
|
||||
downloadDictionary(value);
|
||||
break;
|
||||
}
|
||||
|
@ -1739,6 +1759,7 @@
|
|||
document.getElementById("join-game").onclick = joinGame;
|
||||
document.getElementById("clear-rack").onclick = clearRack;
|
||||
document.getElementById("show-rack").onclick = showRack;
|
||||
document.getElementById("enable-spell-checker").onclick = enableSpellChecker;
|
||||
document.getElementById("check-spelling").onclick = checkSpelling;
|
||||
helpClear.onclick = clearGame;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue