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
|
var oDialogControl = {
load: function () {
try {
// center window
document.getElementById('grammalecte-spelloptions-window').centerWindowOnScreen();
// Graphspell dictionaries
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();
},
_setGraphspellDictionaries: function () {
let bActivate = document.getElementById('personal_dic').checked;
prefs.setBoolPref("bPersonalDictionary", bActivate);
}
};
|
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
<
>
>
>
>
>
>
>
>
>
>
>
>
|
|
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
68
69
70
71
72
73
74
75
76
|
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") {
document.getElementById("classic").checked = true;
}
else if (sMainDicName == "fr-reform.json") {
document.getElementById("reform").checked = true;
}
else if (sMainDicName == "fr-allvars.json") {
document.getElementById("allvars").checked = true;
}
// personal dictionary
document.getElementById('personal_dic').checked = prefs.getBoolPref('bPersonalDictionary');
// listen
this.listen();
}
catch (e) {
console.error(e);
}
},
listen: function () {
document.addEventListener("dialogaccept", (event) => {
oDialogControl.setDictionaries();
});
document.getElementById("classic").addEventListener("click", (event) => {
oDialogControl.changeMainDicUI("classic");
});
document.getElementById("reform").addEventListener("click", (event) => {
oDialogControl.changeMainDicUI("reform");
});
document.getElementById("allvars").addEventListener("click", (event) => {
oDialogControl.changeMainDicUI("allvars");
});
},
changeMainDicUI (sDic) {
document.getElementById("classic").checked = ("classic" === sDic);
document.getElementById("reform").checked = ("reform" === sDic);
document.getElementById("allvars").checked = ("allvars" === sDic);
},
setDictionaries: function () {
//oSpellControl.init();
// main spelling dictionary
let sMainDicName = "";
if (document.getElementById("classic").checked) {
sMainDicName = "fr-classic.json";
}
else if (document.getElementById("reform").checked) {
sMainDicName = "fr-reform.json";
}
else if (document.getElementById("allvars").checked) {
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);
}
};
|