10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
var oDialogControl = {
load: function () {
try {
// center window
document.getElementById('grammalecte-spelloptions-window').centerWindowOnScreen();
// main spelling dictionary
let sMainDicName = prefs.getCharPref('sMainDicName');
console.log("spelling dictionary:", sMainDicName);
if (sMainDicName == "fr-classic.json") {
console.log("classic");
document.getElementById("classic").checked = true;
}
else if (sMainDicName == "fr-reform.json") {
console.log("reform");
document.getElementById("reform").checked = true;
}
else if (sMainDicName == "fr-allvars.json") {
console.log("allvars");
document.getElementById("allvars").checked = true;
}
// Graphspell dictionaries
// personal dictionary
document.getElementById('personal_dic').checked = prefs.getBoolPref('bPersonalDictionary');
this.listen();
}
catch (e) {
console.error(e);
}
},
listen: function () {
document.addEventListener("dialogaccept", (event) => {
oDialogControl.setDictionaries();
});
},
setDictionaries: function () {
oSpellControl.init();
this._setGraphspellDictionaries();
//oSpellControl.init();
// main spelling dictionary
},
_setGraphspellDictionaries: function () {
let sMainDicName;
if (document.getElementById("classic").checked) {
console.log("classic");
sMainDicName = "fr-classic.json";
}
else if (document.getElementById("reform").checked) {
console.log("reform");
sMainDicName = "fr-reform.json";
}
else if (document.getElementById("allvars").checked) {
console.log("allvars");
sMainDicName = "fr-allvars.json";
}
console.log("selected spelling dictionary:", sMainDicName);
prefs.setCharPref("sMainDicName", sMainDicName);
// personal dictionary
let bActivate = document.getElementById('personal_dic').checked;
prefs.setBoolPref("bPersonalDictionary", bActivate);
}
};
|