diff --git a/Makefile b/Makefile index 40f915e..cf855d8 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ endif .PHONY: all help lang start-dev-server -all: lang +all: lang emptydictlist help: @echo make extract-lang-dists: extract the distributions per language from Wikipedia @@ -26,6 +26,11 @@ extract-lang-dists: lang: public/l10n/js/fr.js +emptydictlist: public/dict/list.js + +public/dict/list.js: + mkdir -p public/dict/ && touch public/dict/list.js + eslint: -${ESLINT} **/*.js diff --git a/public/config.js.sample b/public/config.js.sample index 35bccf5..90b18f2 100644 --- a/public/config.js.sample +++ b/public/config.js.sample @@ -17,9 +17,6 @@ window.TrivabbleConf = { // To tweak only if your webserver is shared with other conflicting resources at / (e.g. Yunohost integration) APP_PATH: "", - // Whether the spell checker is enabled (dictionaries must be downloaded on the server before enabling this option) - ENABLE_SPELL_CHECKER: false, - // The color of the flash light when double clicking on a cell FLASH_LIGHT_COLOR: "#EE6633", diff --git a/public/trivabble.js b/public/trivabble.js index 98b50eb..30dce5d 100644 --- a/public/trivabble.js +++ b/public/trivabble.js @@ -54,7 +54,6 @@ setConf("APP_PATH", ""); setConf("ENABLE_MSG_SOUND", true); setConf("ENABLE_TILE_SOUND", true); - setConf("ENABLE_SPELL_CHECKER", false); setConf("DOUBLE_TAP_DURATIONS", [650, 1100, 1800, 3000, 5000]); setConf("DOUBLE_TAP_DURATION", middle("DOUBLE_TAP_DURATIONS")); setConf("FLASH_LIGHT_DURATIONS", [800, 1600, 3200]); @@ -251,8 +250,10 @@ function checkDictionaryExistance() { const code = document.getElementById("board-lang").value; + const availableLang = Object.prototype.hasOwnProperty.call(DictionaryList, code); + document.getElementById("disable-spell-checker-p").hidden = !availableLang; - if (Object.prototype.hasOwnProperty.call(DictionaryList, code) && getSetting("ENABLE_SPELL_CHECKER") && !document.getElementById("disable-spell-checker").checked) { + if (availableLang && !document.getElementById("disable-spell-checker").checked) { document.getElementById("check-spelling").hidden = false; document.getElementById("info-spell-checking").hidden = false; } else { @@ -1995,7 +1996,7 @@ } function toggleSpellChecker(e) { - const disabled = !getSetting("ENABLE_SPELL_CHECKER") || document.getElementById("disable-spell-checker").checked; + const disabled = document.getElementById("disable-spell-checker").checked; checkDictionaryExistance(); if (e) { @@ -2008,7 +2009,6 @@ } function initSpellChecker() { - document.getElementById("disable-spell-checker-p").hidden = !getSetting("ENABLE_SPELL_CHECKER"); document.getElementById("disable-spell-checker").checked = getSetting("DisableSpellChecker"); toggleSpellChecker(); }