DICTS = $(addsuffix .dict,$(LANGS))
-DEPEND = Makefile
+#DEPEND = Makefile
#MAKEFLAGS = -s
-.PHONY: all required count clean low
+.PHONY: all required count clean low list
all: required
make $(addprefix check-,$(LANGS))
+ make list
$(ROOT_DICT):
mkdir $(ROOT_DICT)
required: ${OBJ_DIR} ${OBJ_DIR}/src.mk ${ROOT_DICT}
+list: $(ROOT_DICT)/list.js
+
+$(ROOT_DICT)/list.js: $(wildcard $(ROOT_DICT)/*.dict)
+ ls -s ${ROOT_DICT}/*.dict| \
+ awk 'BEGIN { printf "window.DictionaryList = {\n" } \
+ { $$0 = gensub(/(.+) .*\/(.+)\.dict/, "\\1 \\2", "g"); \
+ printf "\"%s\": %d,\n", $$2, $$1 } \
+ END { printf "\"none\": 0\n};" }' > $@
+
$(OBJ_DIR)/src.mk:
echo Creation language table
wget $(ASPDICT) -q -O - | \
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="format-detection" content="telephone=no" />
<script src="config.js"></script>
+ <script src="dict/list.js"></script>
<script src="l10n.js"></script>
<script src="alert.js"></script>
<script src="touch2click.js"></script>
const Conf = window.TrivabbleConf || {};
+ const DictionaryList = window.DictionaryList || {};
+
function setConf(parameterName, defaultValue) {
if (typeof Conf[parameterName] === "undefined") {
Conf[parameterName] = defaultValue;
}
}
+ function checkDictionaryExistance() {
+ const code = document.getElementById("board-lang").value;
+
+ if (DictionaryList.hasOwnProperty(code) && getSetting("ENABLE_SPELL_CHECKER") && !document.getElementById("disable-spell-checker").checked) {
+ document.getElementById("check-spelling").hidden = false;
+ document.getElementById("info-spell-checking").hidden = false;
+ } else {
+ document.getElementById("check-spelling").hidden = true;
+ document.getElementById("info-spell-checking").hidden = true;
+ }
+ }
+
function getDictionary(code, callback, force) {
if (downloadedDictionaries[code]) {
if (downloadedDictionaries[code].length) {
case "boardLang":
document.getElementById("board-lang").value = value;
setSetting("BoardLang", value);
+ checkDictionaryExistance(value);
break;
}
}
function toggleSpellChecker(e) {
const disabled = !getSetting("ENABLE_SPELL_CHECKER") || document.getElementById("disable-spell-checker").checked;
- document.getElementById("check-spelling").hidden = disabled;
- document.getElementById("info-spell-checking").hidden = disabled;
+ checkDictionaryExistance();
if (e) {
setSetting("DisableSpellChecker", disabled);