drop ENABLE_SPELL_CHECKER
authorRaphaël Jakse <raphael.trivabble@jakse.fr>
Fri, 16 Oct 2020 16:34:01 +0000 (18:34 +0200)
committerRaphaël Jakse <raphael.trivabble@jakse.fr>
Fri, 16 Oct 2020 16:34:01 +0000 (18:34 +0200)
Makefile
public/config.js.sample
public/trivabble.js

index 40f915e36027c93db6b6f2aec84a4b507169aafc..cf855d8c59eb2d989bf3b36f4f755ebd25d24a02 100644 (file)
--- 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
 
index 35bccf56da4e56330c23173fccca95e284b20670..90b18f2d8c78f4309cdd18decd5763fa9ff3472b 100644 (file)
@@ -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",
 
index 98b50eb67aa33e28ea42f773c5d30ad19bbcf586..30dce5d12aa697c98dcb4a566c3bb4bc6e7fb1d6 100644 (file)
@@ -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]);
 
     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 {
     }
 
     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) {
     }
 
     function initSpellChecker() {
-        document.getElementById("disable-spell-checker-p").hidden = !getSetting("ENABLE_SPELL_CHECKER");
         document.getElementById("disable-spell-checker").checked = getSetting("DisableSpellChecker");
         toggleSpellChecker();
     }