Grammalecte  Check-in [a693df4168]

Overview
Comment:merge trunk
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | multid
Files: files | file ages | folders
SHA3-256: a693df4168bdf3ce0071a501c0614d8ad4d0c2e8048639ed60fd0e42c8ec5d3d
User & Date: olr on 2018-03-07 17:32:24
Original Comment: marge trunk
Other Links: branch diff | manifest | tags
Context
2018-03-09
08:26
[fx] lexicon editor: update (new draft) check-in: 19e588f821 user: olr tags: fx, multid
2018-03-07
17:32
merge trunk check-in: a693df4168 user: olr tags: multid
16:10
[fx] hide useless panel about dictionaries for now check-in: 94e2e47aea user: olr tags: trunk, fx
2018-03-06
21:14
[lo] lexicon editor: ui update check-in: adee0f51ee user: olr tags: lo, multid
Changes

Modified gc_lang/fr/dictionnaire/genfrdic.py from [31b6065518] to [fbdbd49c59].

838
839
840
841
842
843
844




845
846
847
848
849
850
851
        if re.search(r"pl|sg|inv", self.iz) and re.match(r"[SXAIFW](?!=)", self.flags):
            sErr += '[is]'
        if re.search(r"nom|adj", self.po) and re.match(r"(?i)[aâàäáeéèêëiîïíìoôöóòuûüúù]", self.lemma) and re.match("[SFWXAI][.]", self.flags) \
           and "pel" not in self.lx:
            sErr += 'le drapeau derait finir avec *'
        if not self.flags and self.iz.endswith(("mas", "fem", "epi")):
            sErr += '[is] incomplet'




        if sErr:
            echo('   error -  id: ' + self.iD, end = "")
            echo('  ' + sErr + '  in  ' + self.__str__())

    def setTagsFrom (self, oEnt):
        self.po = oEnt.po
        self.iz = oEnt.iz







>
>
>
>







838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
        if re.search(r"pl|sg|inv", self.iz) and re.match(r"[SXAIFW](?!=)", self.flags):
            sErr += '[is]'
        if re.search(r"nom|adj", self.po) and re.match(r"(?i)[aâàäáeéèêëiîïíìoôöóòuûüúù]", self.lemma) and re.match("[SFWXAI][.]", self.flags) \
           and "pel" not in self.lx:
            sErr += 'le drapeau derait finir avec *'
        if not self.flags and self.iz.endswith(("mas", "fem", "epi")):
            sErr += '[is] incomplet'
        if self.flags.startswith(("a", "b", "c", "d")) and not self.lemma.endswith("er"):
            sErr += "drapeau pour verbe du 1ᵉʳ groupe sur un lemme non conforme"
        if self.flags.startswith("f") and not self.lemma.endswith("ir"):
            sErr += "drapeau pour verbe du 2ᵉ groupe sur un lemme non conforme"
        if sErr:
            echo('   error -  id: ' + self.iD, end = "")
            echo('  ' + sErr + '  in  ' + self.__str__())

    def setTagsFrom (self, oEnt):
        self.po = oEnt.po
        self.iz = oEnt.iz

Modified gc_lang/fr/webext/background.js from [1f59a4fda9] to [716a2f0752].

54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79

80
81
82
83
84
85
86
87
88
89
90
91
92

93
94

95
96
97
98
99
100
101
102





103
104
105
106
107
108
109
                browser.runtime.sendMessage(e.data);
                break;
            case "getOptions":
            case "getDefaultOptions":
            case "resetOptions":
                // send result to panel
                storeGCOptions(result);
                if (bChrome) {
                    e.data.result = helpers.mapToObject(e.data.result);
                }
                browser.runtime.sendMessage(e.data);
                break;
            case "setOptions":
            case "setOption":
                storeGCOptions(result);
                break;
            case "setDictionary":
                console.log("[background] " + sActionDone + ": " + result);
                break;
            default:
                console.log("[background] Unknown command: " + sActionDone);
                console.log(e.data);
        }
    }
    catch (e) {
        showError(e);

    }
};

function initUIOptions (dSavedOptions) {
    if (!dSavedOptions.hasOwnProperty("ui_options")) {
        browser.storage.local.set({"ui_options": {
            textarea: true,
            editablenode: true
        }});
    }
}

function initGrammarChecker (dSavedOptions) {

    let dOptions = (dSavedOptions.hasOwnProperty("gc_options")) ? dSavedOptions.gc_options : null;
    if (bChrome) {

        // JS crap again. Chrome can’t store Map object.
        dOptions = helpers.objectToMap(dOptions);
    }
    xGCEWorker.postMessage({
        sCommand: "init",
        dParam: {sExtensionPath: browser.extension.getURL(""), dOptions: dOptions, sContext: "Firefox"},
        dInfo: {}
    });





}

function setSpellingDictionary (dSavedDictionary) {
    if (dSavedDictionary.hasOwnProperty("oExtendedDictionary")) {
        xGCEWorker.postMessage({
            sCommand: "setDictionary",
            dParam: { sType: "extended", oDict: dSavedDictionary["oExtendedDictionary"] },







<
<
<














|
|
>













>
|
<
>
|
|
|
|
|
|
|
|
>
>
>
>
>







54
55
56
57
58
59
60



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92

93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
                browser.runtime.sendMessage(e.data);
                break;
            case "getOptions":
            case "getDefaultOptions":
            case "resetOptions":
                // send result to panel
                storeGCOptions(result);



                browser.runtime.sendMessage(e.data);
                break;
            case "setOptions":
            case "setOption":
                storeGCOptions(result);
                break;
            case "setDictionary":
                console.log("[background] " + sActionDone + ": " + result);
                break;
            default:
                console.log("[background] Unknown command: " + sActionDone);
                console.log(e.data);
        }
    }
    catch (error) {
        showError(error);
        console.log(e.data);
    }
};

function initUIOptions (dSavedOptions) {
    if (!dSavedOptions.hasOwnProperty("ui_options")) {
        browser.storage.local.set({"ui_options": {
            textarea: true,
            editablenode: true
        }});
    }
}

function initGrammarChecker (dSavedOptions) {
    try {
        let dOptions = (dSavedOptions.hasOwnProperty("gc_options")) ? dSavedOptions.gc_options : null;

        if (dOptions !== null && Object.getOwnPropertyNames(dOptions).length == 0) {
            console.log("# Error: the saved options was an empty object.");
            dOptions = null;
        }
        xGCEWorker.postMessage({
            sCommand: "init",
            dParam: {sExtensionPath: browser.extension.getURL(""), dOptions: dOptions, sContext: "Firefox"},
            dInfo: {}
        });
    }
    catch (e) {
        console.log("initGrammarChecker failed");
        showError(e);
    }
}

function setSpellingDictionary (dSavedDictionary) {
    if (dSavedDictionary.hasOwnProperty("oExtendedDictionary")) {
        xGCEWorker.postMessage({
            sCommand: "setDictionary",
            dParam: { sType: "extended", oDict: dSavedDictionary["oExtendedDictionary"] },
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328


/*
    Actions
*/

function storeGCOptions (dOptions) {
    if (bChrome) {
        // JS crap again. Chrome can’t store Map object.
        dOptions = helpers.mapToObject(dOptions);
    }
    browser.storage.local.set({"gc_options": dOptions});
}

function sendCommandToTab (sCommand, iTab) {
    let xTabPort = dConnx.get(iTab);







|
<







317
318
319
320
321
322
323
324

325
326
327
328
329
330
331


/*
    Actions
*/

function storeGCOptions (dOptions) {
    if (dOptions instanceof Map) {

        dOptions = helpers.mapToObject(dOptions);
    }
    browser.storage.local.set({"gc_options": dOptions});
}

function sendCommandToTab (sCommand, iTab) {
    let xTabPort = dConnx.get(iTab);

Modified gc_lang/fr/webext/content_scripts/init.js from [8dd0bc574d] to [86174a3577].

236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
            if (!bEnd) {
                oGrammalecte.oLxgPanel.addListOfTokens(result);
            } else {
                oGrammalecte.oLxgPanel.stopWaitIcon();
            }
            break;
        case "getSpellSuggestions":
            oGrammalecte.oGCPanel.oTooltip.setSpellSuggestionsFor(result.sWord, result.aSugg, dInfo.sErrorId);
            break;
        /*
            Commands received from the context menu
            (Context menu are initialized in background)
        */
        // Grammar checker commands
        case "rightClickGCEditableNode":







|







236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
            if (!bEnd) {
                oGrammalecte.oLxgPanel.addListOfTokens(result);
            } else {
                oGrammalecte.oLxgPanel.stopWaitIcon();
            }
            break;
        case "getSpellSuggestions":
            oGrammalecte.oGCPanel.oTooltip.setSpellSuggestionsFor(result.sWord, result.aSugg, result.iSuggBlock, dInfo.sErrorId);
            break;
        /*
            Commands received from the context menu
            (Context menu are initialized in background)
        */
        // Grammar checker commands
        case "rightClickGCEditableNode":

Modified gc_lang/fr/webext/content_scripts/panel_gc.css from [c9ea205d87] to [60aa48d094].

109
110
111
112
113
114
115

116
117
118

119
120
121
122
123
124
125
    color: hsla(210, 0%, 96%, 1);
    font-family: Tahoma, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif;
    font-size: 11px;
    font-style: normal;
    text-align: center;
}
#grammalecte_tooltip_message {

    font-family: Tahoma, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif;
    font-size: 15px;
    margin: 0 0 5px 0;

}
#grammalecte_tooltip_ignore {
    display: inline-block;
    padding: 1px 5px;
    background-color: hsl(30, 30%, 40%);
    color: hsla(30, 0%, 96%, 1);
    border-radius: 2px;







>


<
>







109
110
111
112
113
114
115
116
117
118

119
120
121
122
123
124
125
126
    color: hsla(210, 0%, 96%, 1);
    font-family: Tahoma, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif;
    font-size: 11px;
    font-style: normal;
    text-align: center;
}
#grammalecte_tooltip_message {
    margin: 0 0 5px 0;
    font-family: Tahoma, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif;
    font-size: 15px;

    color: hsl(210, 50%, 96%);
}
#grammalecte_tooltip_ignore {
    display: inline-block;
    padding: 1px 5px;
    background-color: hsl(30, 30%, 40%);
    color: hsla(30, 0%, 96%, 1);
    border-radius: 2px;
148
149
150
151
152
153
154











155
156
157
158
159
160
161
#grammalecte_tooltip_url:hover {
    background-color: hsl(210, 50%, 60%);
    color: hsla(0, 0%, 100%, 1);
    text-shadow: 0 0 3px hsl(210, 30%, 60%);
}
#grammalecte_tooltip_sugg_title {
    padding: 0 10px;











    background-color: hsl(210, 10%, 90%);
    color: hsl(210, 50%, 30%);
    font-family: Tahoma, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif;
    font-size: 10px;
    font-weight: bold;
}
#grammalecte_tooltip_sugg_block {







>
>
>
>
>
>
>
>
>
>
>







149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
#grammalecte_tooltip_url:hover {
    background-color: hsl(210, 50%, 60%);
    color: hsla(0, 0%, 100%, 1);
    text-shadow: 0 0 3px hsl(210, 30%, 60%);
}
#grammalecte_tooltip_sugg_title {
    padding: 0 10px;
    background-color: hsl(210, 10%, 90%);
    color: hsl(210, 50%, 30%);
    font-family: Tahoma, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif;
    font-size: 10px;
    font-weight: bold;
}
.grammalecte_tooltip_other_sugg_title {
    margin: 5px 0;
    padding: 0px 10px;
    line-height: normal;
    border-radius: 2px;
    background-color: hsl(210, 10%, 90%);
    color: hsl(210, 50%, 30%);
    font-family: Tahoma, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif;
    font-size: 10px;
    font-weight: bold;
}
#grammalecte_tooltip_sugg_block {

Modified gc_lang/fr/webext/content_scripts/panel_gc.js from [830eee61d0] to [8bd37de1f6].

390
391
392
393
394
395
396
397
398
399
400
401

402

403

404

405



406
407
408
409
410
411
412
413
414
415

416
417
418
419
420
421
422
        xNodeSugg.id = "grammalecte_sugg" + sErrorId + "--" + iSugg.toString();
        xNodeSugg.className = "grammalecte_tooltip_sugg";
        xNodeSugg.dataset.error_id = sErrorId;
        xNodeSugg.textContent = sSugg;
        return xNodeSugg;
    }

    setSpellSuggestionsFor (sWord, aSugg, sErrorId) {
        // spell checking suggestions
        try {
            if (sErrorId === this.sErrorId) {
                let xSuggBlock = document.getElementById("grammalecte_tooltip_sugg_block");

                xSuggBlock.textContent = "";

                if (!aSugg || aSugg.length == 0) {

                    xSuggBlock.appendChild(document.createTextNode("Aucune."));

                } else {



                    let iSugg = 0;
                    for (let sSugg of aSugg) {
                        xSuggBlock.appendChild(this._createSuggestion(sErrorId, iSugg, sSugg));
                        xSuggBlock.appendChild(document.createTextNode(" "));
                        iSugg += 1;
                    }
                }
            }
        }
        catch (e) {

            xSuggBlock.appendChild(document.createTextNode("# Oups. Le mécanisme de suggestion orthographique a rencontré un bug… (Ce module est encore en phase β.)"));
            showError(e);
        }
    }
}









|




>
|
>

>
|
>

>
>
>










>







390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
        xNodeSugg.id = "grammalecte_sugg" + sErrorId + "--" + iSugg.toString();
        xNodeSugg.className = "grammalecte_tooltip_sugg";
        xNodeSugg.dataset.error_id = sErrorId;
        xNodeSugg.textContent = sSugg;
        return xNodeSugg;
    }

    setSpellSuggestionsFor (sWord, aSugg, iSuggBlock, sErrorId) {
        // spell checking suggestions
        try {
            if (sErrorId === this.sErrorId) {
                let xSuggBlock = document.getElementById("grammalecte_tooltip_sugg_block");
                if (iSuggBlock == 0) {
                    xSuggBlock.textContent = "";
                }
                if (!aSugg || aSugg.length == 0) {
                    if (iSuggBlock == 0) {
                        xSuggBlock.appendChild(document.createTextNode("Aucune."));
                    }
                } else {
                    if (iSuggBlock > 0) {
                        xSuggBlock.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_tooltip_other_sugg_title", textContent: "AUTRES SUGGESTIONS :"}));
                    }
                    let iSugg = 0;
                    for (let sSugg of aSugg) {
                        xSuggBlock.appendChild(this._createSuggestion(sErrorId, iSugg, sSugg));
                        xSuggBlock.appendChild(document.createTextNode(" "));
                        iSugg += 1;
                    }
                }
            }
        }
        catch (e) {
            let xSuggBlock = document.getElementById("grammalecte_tooltip_sugg_block");
            xSuggBlock.appendChild(document.createTextNode("# Oups. Le mécanisme de suggestion orthographique a rencontré un bug… (Ce module est encore en phase β.)"));
            showError(e);
        }
    }
}


Modified gc_lang/fr/webext/gce_worker.js from [9f37b00cd8] to [42760d524d].

164
165
166
167
168
169
170
171
172
173
174
175

176

177
178
179
180
181
182
183
184

185
186
187
188
189
190
191
192
            phonet.init(helpers.loadFile(sExtensionPath + "/grammalecte/fr/phonet_data.json"));
            mfsp.init(helpers.loadFile(sExtensionPath + "/grammalecte/fr/mfsp_data.json"));
            //console.log("[Worker] Modules have been initialized…");
            gc_engine.load(sContext, sExtensionPath+"grammalecte/graphspell/_dictionaries");
            oSpellChecker = gc_engine.getSpellChecker();
            oTest = new TestGrammarChecking(gc_engine, sExtensionPath+"/grammalecte/fr/tests_data.json");
            oTokenizer = new Tokenizer("fr");

            oLocution =  helpers.loadFile(sExtensionPath + "/grammalecte/fr/locutions_data.json");

            oLxg = new Lexicographe(oSpellChecker, oTokenizer, oLocution);
            if (dOptions !== null) {

                console.log(dOptions);

                gc_engine.setOptions(dOptions);
            }
            //tests();
            bInitDone = true;
        } else {
            console.log("[Worker] Already initialized…")
        }
        // we always retrieve options from the gc_engine, for setOptions filters obsolete options

        postMessage(createResponse("init", gc_engine.getOptions(), dInfo, true));
    }
    catch (e) {
        helpers.logerror(e);
        postMessage(createResponse("init", createErrorResult(e, "init failed"), dInfo, true, true));
    }
}








<

<


>
|
>








>
|







164
165
166
167
168
169
170

171

172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
            phonet.init(helpers.loadFile(sExtensionPath + "/grammalecte/fr/phonet_data.json"));
            mfsp.init(helpers.loadFile(sExtensionPath + "/grammalecte/fr/mfsp_data.json"));
            //console.log("[Worker] Modules have been initialized…");
            gc_engine.load(sContext, sExtensionPath+"grammalecte/graphspell/_dictionaries");
            oSpellChecker = gc_engine.getSpellChecker();
            oTest = new TestGrammarChecking(gc_engine, sExtensionPath+"/grammalecte/fr/tests_data.json");
            oTokenizer = new Tokenizer("fr");

            oLocution =  helpers.loadFile(sExtensionPath + "/grammalecte/fr/locutions_data.json");

            oLxg = new Lexicographe(oSpellChecker, oTokenizer, oLocution);
            if (dOptions !== null) {
                if (!(dOptions instanceof Map)) {
                    dOptions = helpers.objectToMap(dOptions);
                }
                gc_engine.setOptions(dOptions);
            }
            //tests();
            bInitDone = true;
        } else {
            console.log("[Worker] Already initialized…")
        }
        // we always retrieve options from the gc_engine, for setOptions filters obsolete options
        dOptions = helpers.mapToObject(gc_engine.getOptions());
        postMessage(createResponse("init", dOptions, dInfo, true));
    }
    catch (e) {
        helpers.logerror(e);
        postMessage(createResponse("init", createErrorResult(e, "init failed"), dInfo, true, true));
    }
}

216
217
218
219
220
221
222

223
224
225
226

227
228
229
230



231

232
233
234
235
236
237
238

239
240
241
242
243
244

245
246
247
248
249
250
251
252
    sParagraph = sParagraph.replace(/­/g, "").normalize("NFC");
    let aGrammErr = gc_engine.parse(sParagraph, sCountry, bDebug, bContext);
    let aSpellErr = oSpellChecker.parseParagraph(sParagraph);
    postMessage(createResponse("parseAndSpellcheck1", {sParagraph: sParagraph, aGrammErr: aGrammErr, aSpellErr: aSpellErr}, dInfo, true));
}

function getOptions (dInfo={}) {

    postMessage(createResponse("getOptions", gc_engine.getOptions(), dInfo, true));
}

function getDefaultOptions (dInfo={}) {

    postMessage(createResponse("getDefaultOptions", gc_engine.getDefaultOptions(), dInfo, true));
}

function setOptions (dOptions, dInfo={}) {



    gc_engine.setOptions(dOptions);

    postMessage(createResponse("setOptions", gc_engine.getOptions(), dInfo, true));
}

function setOption (sOptName, bValue, dInfo={}) {
    console.log(sOptName+": "+bValue);
    if (sOptName) {
        gc_engine.setOption(sOptName, bValue);

        postMessage(createResponse("setOption", gc_engine.getOptions(), dInfo, true));
    }
}

function resetOptions (dInfo={}) {
    gc_engine.resetOptions();

    postMessage(createResponse("resetOptions", gc_engine.getOptions(), dInfo, true));
}

function tests () {
    console.log(conj.getConj("devenir", ":E", ":2s"));
    console.log(mfsp.getMasForm("emmerdeuse", true));
    console.log(mfsp.getMasForm("pointilleuse", false));
    console.log(phonet.getSimil("est"));







>
|



>
|



>
>
>

>
|






>
|





>
|







217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
    sParagraph = sParagraph.replace(/­/g, "").normalize("NFC");
    let aGrammErr = gc_engine.parse(sParagraph, sCountry, bDebug, bContext);
    let aSpellErr = oSpellChecker.parseParagraph(sParagraph);
    postMessage(createResponse("parseAndSpellcheck1", {sParagraph: sParagraph, aGrammErr: aGrammErr, aSpellErr: aSpellErr}, dInfo, true));
}

function getOptions (dInfo={}) {
    let dOptions = helpers.mapToObject(gc_engine.getOptions());
    postMessage(createResponse("getOptions", dOptions, dInfo, true));
}

function getDefaultOptions (dInfo={}) {
    let dOptions = helpers.mapToObject(gc_engine.getDefaultOptions());
    postMessage(createResponse("getDefaultOptions", dOptions, dInfo, true));
}

function setOptions (dOptions, dInfo={}) {
    if (!(dOptions instanceof Map)) {
        dOptions = helpers.objectToMap(dOptions);
    }
    gc_engine.setOptions(dOptions);
    dOptions = helpers.mapToObject(gc_engine.getOptions());
    postMessage(createResponse("setOptions", dOptions, dInfo, true));
}

function setOption (sOptName, bValue, dInfo={}) {
    console.log(sOptName+": "+bValue);
    if (sOptName) {
        gc_engine.setOption(sOptName, bValue);
        let dOptions = helpers.mapToObject(gc_engine.getOptions());
        postMessage(createResponse("setOption", dOptions, dInfo, true));
    }
}

function resetOptions (dInfo={}) {
    gc_engine.resetOptions();
    let dOptions = helpers.mapToObject(gc_engine.getOptions());
    postMessage(createResponse("resetOptions", dOptions, dInfo, true));
}

function tests () {
    console.log(conj.getConj("devenir", ":E", ":2s"));
    console.log(mfsp.getMasForm("emmerdeuse", true));
    console.log(mfsp.getMasForm("pointilleuse", false));
    console.log(phonet.getSimil("est"));
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
}

function getSpellSuggestions (sWord, dInfo) {
    if (!oSpellChecker) {
        postMessage(createResponse("getSpellSuggestions", "# Error. SpellChecker not loaded.", dInfo, true));
        return;
    }
    let i = 1;
    for (let aSugg of oSpellChecker.suggest(sWord)) {
        postMessage(createResponse("getSpellSuggestions", {sWord: sWord, aSugg: aSugg, iSugg: i}, dInfo, true));
        i += 1;
    }
}


// Lexicographer








|

|







330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
}

function getSpellSuggestions (sWord, dInfo) {
    if (!oSpellChecker) {
        postMessage(createResponse("getSpellSuggestions", "# Error. SpellChecker not loaded.", dInfo, true));
        return;
    }
    let i = 0;
    for (let aSugg of oSpellChecker.suggest(sWord)) {
        postMessage(createResponse("getSpellSuggestions", {sWord: sWord, aSugg: aSugg, iSuggBlock: i}, dInfo, true));
        i += 1;
    }
}


// Lexicographer

Modified gc_lang/fr/webext/manifest.json from [92ab4049ef] to [3eba02bf89].

1
2
3
4
5
6
7
8
9
10
11
12
{
  "manifest_version": 2,
  "name": "Grammalecte [fr]",
  "short_name": "Grammalecte [fr]",
  "version": "0.6.2",

  "applications": {
    "gecko": {
      "id": "French-GC@grammalecte.net",
      "strict_min_version": "56.0"
    }
  },




|







1
2
3
4
5
6
7
8
9
10
11
12
{
  "manifest_version": 2,
  "name": "Grammalecte [fr]",
  "short_name": "Grammalecte [fr]",
  "version": "0.6.2.1",

  "applications": {
    "gecko": {
      "id": "French-GC@grammalecte.net",
      "strict_min_version": "56.0"
    }
  },

Modified gc_lang/fr/webext/panel/main.html from [8eedb25cf8] to [d1aef2340b].

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
              <p class="select" data-page="ui_options_page"><i class="select select_icon fa fa-cube" data-page="ui_options_page"></i></p>
              <p class="select select_label" data-page="ui_options_page">Interface</p>
            </div>
            <div class="select select_block" data-page="gc_options_page">
              <p class="select" data-page="gc_options_page"><i class="select select_icon fa fa-cog" data-page="gc_options_page"></i></p>
              <p class="select select_label" data-page="gc_options_page">Grammaire</p>
            </div>
            <div class="select select_block" data-page="sc_options_page">
              <p class="select" data-page="sc_options_page"><i class="select select_icon fa fa-book" data-page="sc_options_page"></i></p>
              <p class="select select_label" data-page="sc_options_page">Dictionnaires</p>
            </div>
            <div class="select select_block" data-page="test_page">
              <p class="select" data-page="test_page"><i class="select select_icon fa fa-flask" data-page="test_page"></i></p>
              <p class="select select_label" data-page="test_page">Zone de test</p>
            </div>
          </ul>
        </nav>
      </header> <!-- #menu -->







|


|







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
              <p class="select" data-page="ui_options_page"><i class="select select_icon fa fa-cube" data-page="ui_options_page"></i></p>
              <p class="select select_label" data-page="ui_options_page">Interface</p>
            </div>
            <div class="select select_block" data-page="gc_options_page">
              <p class="select" data-page="gc_options_page"><i class="select select_icon fa fa-cog" data-page="gc_options_page"></i></p>
              <p class="select select_label" data-page="gc_options_page">Grammaire</p>
            </div>
            <!--<div class="select select_block" data-page="sc_options_page">
              <p class="select" data-page="sc_options_page"><i class="select select_icon fa fa-book" data-page="sc_options_page"></i></p>
              <p class="select select_label" data-page="sc_options_page">Dictionnaires</p>
            </div>-->
            <div class="select select_block" data-page="test_page">
              <p class="select" data-page="test_page"><i class="select select_icon fa fa-flask" data-page="test_page"></i></p>
              <p class="select select_label" data-page="test_page">Zone de test</p>
            </div>
          </ul>
        </nav>
      </header> <!-- #menu -->

Modified gc_lang/fr/webext/panel/main.js from [67d345836f] to [200b11bbbc].

101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
    let {sActionDone, result, dInfo, bEnd, bError} = oMessage;
    switch(sActionDone) {
        case "textToTest":
        case "fullTests":
            showTestResult(result);
            break;
        case "resetOptions":
            setGCOptions(result);
            break;
        default:
            console.log("GRAMMALECTE. Unknown command: " + sActionDone);
    }
    //sendResponse({sCommand: "none", result: "done"});
}








|







101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
    let {sActionDone, result, dInfo, bEnd, bError} = oMessage;
    switch(sActionDone) {
        case "textToTest":
        case "fullTests":
            showTestResult(result);
            break;
        case "resetOptions":
            displayGCOptions(result);
            break;
        default:
            console.log("GRAMMALECTE. Unknown command: " + sActionDone);
    }
    //sendResponse({sCommand: "none", result: "done"});
}

125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
        // hide them all
        for (let xNodePage of document.getElementsByClassName("page")) {
            xNodePage.style.display = "none";
        }
        // show the selected one
        document.getElementById(sPageName).style.display = "block";
        if (sPageName == "gc_options_page") {
            setGCOptionsFromStorage();
        }
        else if (sPageName == "ui_options_page") {
            setUIOptionsFromStorage();
        }
    }
    catch (e) {
        showError(e);
    }
}








|


|







125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
        // hide them all
        for (let xNodePage of document.getElementsByClassName("page")) {
            xNodePage.style.display = "none";
        }
        // show the selected one
        document.getElementById(sPageName).style.display = "block";
        if (sPageName == "gc_options_page") {
            displayGCOptionsLoadedFromStorage();
        }
        else if (sPageName == "ui_options_page") {
            displayUIOptionsLoadedFromStorage();
        }
    }
    catch (e) {
        showError(e);
    }
}

172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
}


/*
    UI options
*/

function setUIOptionsFromStorage () {
    if (bChrome) {
        browser.storage.local.get("ui_options", setUIOptions);
        return;
    }
    let xPromise = browser.storage.local.get("ui_options");
    xPromise.then(setUIOptions, showError);
}

function setUIOptions (dOptions) {
    if (!dOptions.hasOwnProperty("ui_options")) {
        console.log("no ui options found");
        return;
    }
    dOptions = dOptions.ui_options;
    for (let sOpt in dOptions) {
        if (document.getElementById("ui_option_"+sOpt)) {







|

|



|


|







172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
}


/*
    UI options
*/

function displayUIOptionsLoadedFromStorage () {
    if (bChrome) {
        browser.storage.local.get("ui_options", displayUIOptions);
        return;
    }
    let xPromise = browser.storage.local.get("ui_options");
    xPromise.then(displayUIOptions, showError);
}

function displayUIOptions (dOptions) {
    if (!dOptions.hasOwnProperty("ui_options")) {
        console.log("no ui options found");
        return;
    }
    dOptions = dOptions.ui_options;
    for (let sOpt in dOptions) {
        if (document.getElementById("ui_option_"+sOpt)) {
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242

243
244
    }});
}


/*
    GC options
*/
function setGCOptionsFromStorage () {
    if (bChrome) {
        browser.storage.local.get("gc_options", _setGCOptions);
        return;
    }
    let xPromise = browser.storage.local.get("gc_options");
    xPromise.then(_setGCOptions, showError);
}

function _setGCOptions (dSavedOptions) {
    if (dSavedOptions.hasOwnProperty("gc_options")) {
        setGCOptions(dSavedOptions.gc_options);
    }
}

function setGCOptions (dOptions) {
    try {
        // dOptions is supposed to be a Map
        if (bChrome) {
            // JS crap again. Chrome can’t store/send Map object.
            dOptions = helpers.objectToMap(dOptions);
        }
        for (let [sOpt, bVal] of dOptions) {
            if (document.getElementById("option_"+sOpt)) {
                document.getElementById("option_"+sOpt).checked = bVal;
            }
        }
    }
    catch (e) {
        console.log(dOptions);
        showError(e);

    }
}







|

|



|


|

|



|

<
<
<
<
<
|
|
|




<

>


205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228





229
230
231
232
233
234
235

236
237
238
239
    }});
}


/*
    GC options
*/
function displayGCOptionsLoadedFromStorage () {
    if (bChrome) {
        browser.storage.local.get("gc_options", _displayGCOptions);
        return;
    }
    let xPromise = browser.storage.local.get("gc_options");
    xPromise.then(_displayGCOptions, showError);
}

function _displayGCOptions (dSavedOptions) {
    if (dSavedOptions.hasOwnProperty("gc_options")) {
        displayGCOptions(dSavedOptions.gc_options);
    }
}

function displayGCOptions (oOptions) {
    try {





        for (let sParam in oOptions) {
            if (document.getElementById("option_"+sParam)) {
                document.getElementById("option_"+sParam).checked = oOptions[sParam];
            }
        }
    }
    catch (e) {

        showError(e);
        console.log(oOptions);
    }
}

Modified graphspell-js/helpers.js from [d6421f5497] to [b70dea39e2].

70
71
72
73
74
75
76



77
78
79
80
81
82
83
84



85
86
87
88
89
90
91
            this.logerror(e);
            return null;
        }
    },

    // conversions
    objectToMap: function (obj) {



        let m = new Map();
        for (let param in obj) {
            m.set(param, obj[param]);
        }
        return m;
    },

    mapToObject: function (m) {



        let obj = {};
        for (let [k, v] of m) {
            obj[k] = v;
        }
        return obj;
    }
};







>
>
>








>
>
>







70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
            this.logerror(e);
            return null;
        }
    },

    // conversions
    objectToMap: function (obj) {
        if (obj == null) {
            return null;
        }
        let m = new Map();
        for (let param in obj) {
            m.set(param, obj[param]);
        }
        return m;
    },

    mapToObject: function (m) {
        if (m == null) {
            return null;
        }
        let obj = {};
        for (let [k, v] of m) {
            obj[k] = v;
        }
        return obj;
    }
};