Grammalecte  Check-in [208f30234a]

Overview
Comment:[tb] code cleaning
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tb | multid
Files: files | file ages | folders
SHA3-256: 208f30234a02d33222095cf88103c895bb1101516e9b40da035a11444f23deb0
User & Date: olr on 2018-03-29 10:00:48
Other Links: branch diff | manifest | tags
Context
2018-03-30
09:37
[tb] ui to select/deselect personal dictionary check-in: 6c984d1387 user: olr tags: tb, multid
2018-03-29
10:00
[tb] code cleaning check-in: 208f30234a user: olr tags: tb, multid
09:52
[tb] remove console.log() check-in: 9510e5d68c user: olr tags: tb, multid
Changes

Modified gc_lang/fr/tb/content/overlay.js from [3a15f802c4] to [a0e3390e07].

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
    }
};


var oGrammarChecker = {
    // you must use var to be able to call this object from elsewhere
    xGCEWorker: null,
    bDictActive: null,
    loadGC: function () {
        if (this.xGCEWorker === null) {
            // Grammar checker
            echo('Loading Grammalecte');
            this.xGCEWorker = new BasePromiseWorker('chrome://promiseworker/content/gce_worker.js');
            let that = this;
            let xPromise = this.xGCEWorker.post('loadGrammarChecker', [prefs.getCharPref("sGCOptions"), "Thunderbird"]);







<







39
40
41
42
43
44
45

46
47
48
49
50
51
52
    }
};


var oGrammarChecker = {
    // you must use var to be able to call this object from elsewhere
    xGCEWorker: null,

    loadGC: function () {
        if (this.xGCEWorker === null) {
            // Grammar checker
            echo('Loading Grammalecte');
            this.xGCEWorker = new BasePromiseWorker('chrome://promiseworker/content/gce_worker.js');
            let that = this;
            let xPromise = this.xGCEWorker.post('loadGrammarChecker', [prefs.getCharPref("sGCOptions"), "Thunderbird"]);
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
            let xPromise = this.xGCEWorker.post('suggest', [dErr['sValue'], 10]);
            xPromise.then(
                function (sVal) {
                    if (sVal != "") {
                        let lSugg = sVal.split("|");
                        let n = 0;
                        for (let sSugg of lSugg) {
                            if (true || n > 0) {
                                xNodeSuggLine.appendChild(document.createTextNode(" "));
                            }
                            let xNodeSugg = document.createElement("span");
                            xNodeSugg.setAttribute("class", "sugg");
                            xNodeSugg.textContent = sSugg;
                            xNodeSugg.addEventListener("click", function (e) {
                                xEditor.changeParagraph(iParagraph, xNodeSugg.textContent, dErr["nStart"], dErr["nEnd"]);
                                xNodeDiv.textContent = "";
                                that.reparseParagraph(xEditor, iParagraph);
                            });
                            xNodeSuggLine.appendChild(xNodeSugg);
                            n += 1;
                        }
                    } else {
                        xNodeSuggLine.appendChild(document.createTextNode("Aucune suggestion."));
                    }
                    
                },
                function (aReason) { console.error('Promise rejected - ', aReason); }
            ).catch(
                function (aCaught) { console.error('Promise Error - ', aCaught); }
            );
            /*if (this.bDictActive === null) {
                this.bDictActive = oSpellControl.setDictionary("fr");
            }
            try {
                let aSugg = oSpellControl.suggest(dErr['sValue']);
                if (aSugg) {
                    let n = 0;
                    for (let sSugg of aSugg) {
                        if (true || n > 0) {
                            xNodeSuggLine.appendChild(document.createTextNode(" "));
                        }
                        let xNodeSugg = document.createElement("span");
                        xNodeSugg.setAttribute("class", "sugg");
                        xNodeSugg.textContent = sSugg;
                        xNodeSugg.addEventListener("click", function (e) {
                            xEditor.changeParagraph(iParagraph, xNodeSugg.textContent, dErr["nStart"], dErr["nEnd"]);
                            xNodeDiv.textContent = "";
                            that.reparseParagraph(xEditor, iParagraph);
                        });
                        xNodeSuggLine.appendChild(xNodeSugg);
                        n += 1;
                    }
                } else {
                    xNodeSuggLine.appendChild(document.createTextNode("Aucune suggestion."));
                }
            }
            catch (e) {
                xNodeSuggLine.appendChild(document.createTextNode("# Erreur : dictionnaire orthographique introuvable."));
                Cu.reportError(e);
            }*/
        });
        xNodeSuggLine.appendChild(xNodeSuggButton);
        xNodeDiv.appendChild(xNodeSuggLine);
        return xNodeDiv;
    },
    loadUI: function() {
        echo("loadUI");







<
|
<




















<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







345
346
347
348
349
350
351

352

353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372






























373
374
375
376
377
378
379
            let xPromise = this.xGCEWorker.post('suggest', [dErr['sValue'], 10]);
            xPromise.then(
                function (sVal) {
                    if (sVal != "") {
                        let lSugg = sVal.split("|");
                        let n = 0;
                        for (let sSugg of lSugg) {

                            xNodeSuggLine.appendChild(document.createTextNode(" "));

                            let xNodeSugg = document.createElement("span");
                            xNodeSugg.setAttribute("class", "sugg");
                            xNodeSugg.textContent = sSugg;
                            xNodeSugg.addEventListener("click", function (e) {
                                xEditor.changeParagraph(iParagraph, xNodeSugg.textContent, dErr["nStart"], dErr["nEnd"]);
                                xNodeDiv.textContent = "";
                                that.reparseParagraph(xEditor, iParagraph);
                            });
                            xNodeSuggLine.appendChild(xNodeSugg);
                            n += 1;
                        }
                    } else {
                        xNodeSuggLine.appendChild(document.createTextNode("Aucune suggestion."));
                    }
                    
                },
                function (aReason) { console.error('Promise rejected - ', aReason); }
            ).catch(
                function (aCaught) { console.error('Promise Error - ', aCaught); }
            );






























        });
        xNodeSuggLine.appendChild(xNodeSuggButton);
        xNodeDiv.appendChild(xNodeSuggLine);
        return xNodeDiv;
    },
    loadUI: function() {
        echo("loadUI");