Grammalecte  Diff

Differences From Artifact [505aead2d8]:

To Artifact [30dbeca75c]:


58
59
60
61
62
63
64

65
66
67
68
69
70
71
        this.xGCPanelContent.appendChild(this.xParagraphList);
        this.xPanelContent.addEventListener("click", onGrammalecteGCPanelClick, false);
        this.oTooltip = new GrammalecteTooltip(this.xParent, this.xGCPanelContent);
        this.xPanelContent.appendChild(this.xGCPanelContent);
        this.oTextControl = null;
        this.nLastResult = 0;
        this.iLastEditedParagraph = -1;

        // Lexicographer
        this.nLxgCount = 0;
        this.xLxgPanelContent = oGrammalecte.createNode("div", {id: "grammalecte_lxg_panel_content"});
        this.xPanelContent.appendChild(this.xLxgPanelContent);
        // Conjugueur
        this.xConjPanelContent = oGrammalecte.createNode("div", {id: "grammalecte_conj_panel_content"});
        this.xConjPanelContent.innerHTML = sGrammalecteConjugueurHTML;  // @Reviewers: sGrammalecteConjugueurHTML is a const value defined in <content_scripts/html_src.js>







>







58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
        this.xGCPanelContent.appendChild(this.xParagraphList);
        this.xPanelContent.addEventListener("click", onGrammalecteGCPanelClick, false);
        this.oTooltip = new GrammalecteTooltip(this.xParent, this.xGCPanelContent);
        this.xPanelContent.appendChild(this.xGCPanelContent);
        this.oTextControl = null;
        this.nLastResult = 0;
        this.iLastEditedParagraph = -1;
        this.nParagraph = 0;
        // Lexicographer
        this.nLxgCount = 0;
        this.xLxgPanelContent = oGrammalecte.createNode("div", {id: "grammalecte_lxg_panel_content"});
        this.xPanelContent.appendChild(this.xLxgPanelContent);
        // Conjugueur
        this.xConjPanelContent = oGrammalecte.createNode("div", {id: "grammalecte_conj_panel_content"});
        this.xConjPanelContent.innerHTML = sGrammalecteConjugueurHTML;  // @Reviewers: sGrammalecteConjugueurHTML is a const value defined in <content_scripts/html_src.js>
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
        }
        else if (typeof(what) === "string" || (what.nodeType && what.nodeType === 1)) {
            // Text or node
            this.oTextControl = new TextNodeEditor(what, xResultNode);
        }
        else {
            // error
            oGrammalecte.oMessageBox.showMessage("[BUG] Analyse d’un élément inconnu…");
            console.log("[Grammalecte] Unknown element:", what);
        }
    }

    setAutoRefreshButton () {
        this.xAutoRefresh.style.backgroundColor = (this.bAutoRefresh) ? "hsl(150, 50%, 50%)" : "";
        this.xAutoRefresh.style.color = (this.bAutoRefresh) ? "hsl(150, 50%, 96%)" : "";







|







148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
        }
        else if (typeof(what) === "string" || (what.nodeType && what.nodeType === 1)) {
            // Text or node
            this.oTextControl = new TextNodeEditor(what, xResultNode);
        }
        else {
            // error
            oGrammalecte.showMessage("[BUG] Analyse d’un élément inconnu…");
            console.log("[Grammalecte] Unknown element:", what);
        }
    }

    setAutoRefreshButton () {
        this.xAutoRefresh.style.backgroundColor = (this.bAutoRefresh) ? "hsl(150, 50%, 50%)" : "";
        this.xAutoRefresh.style.color = (this.bAutoRefresh) ? "hsl(150, 50%, 96%)" : "";
212
213
214
215
216
217
218




219
220
221
222
223
224
225
        while (this.xParagraphList.firstChild) {
            this.xParagraphList.removeChild(this.xParagraphList.firstChild);
        }
        this.aIgnoredErrors.clear();
    }

    hide () {




        if (oGrammalecte.oTFPanel) { oGrammalecte.oTFPanel.hide(); }
        if (oGrammalecte.oMessageBox) { oGrammalecte.oMessageBox.hide(); }
        oGrammalecte.clearRightClickedNode();
        this.xPanel.style.display = "none";
        this.oTextControl.clear();
    }








>
>
>
>







213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
        while (this.xParagraphList.firstChild) {
            this.xParagraphList.removeChild(this.xParagraphList.firstChild);
        }
        this.aIgnoredErrors.clear();
    }

    hide () {
        if (bThunderbird) {
            oGrammalecte.showMessage("Veuillez patienter…");
            this.copyAllParagraphsToComposeWindow();
        }
        if (oGrammalecte.oTFPanel) { oGrammalecte.oTFPanel.hide(); }
        if (oGrammalecte.oMessageBox) { oGrammalecte.oMessageBox.hide(); }
        oGrammalecte.clearRightClickedNode();
        this.xPanel.style.display = "none";
        this.oTextControl.clear();
    }

248
249
250
251
252
253
254

255
256
257
258
259
260
261
                }.bind(this)
                , true);
                this._tagParagraph(xParagraph, oResult.sParagraph, oResult.iParaNum, oResult.aGrammErr, oResult.aSpellErr);
                // creation
                xNodeDiv.appendChild(xActionsBar);
                xNodeDiv.appendChild(xParagraph);
                this.xParagraphList.appendChild(xNodeDiv);

            }
        }
        catch (e) {
            showError(e);
        }
    }








>







253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
                }.bind(this)
                , true);
                this._tagParagraph(xParagraph, oResult.sParagraph, oResult.iParaNum, oResult.aGrammErr, oResult.aSpellErr);
                // creation
                xNodeDiv.appendChild(xActionsBar);
                xNodeDiv.appendChild(xParagraph);
                this.xParagraphList.appendChild(xNodeDiv);
                this.nParagraph += 1;
            }
        }
        catch (e) {
            showError(e);
        }
    }

439
440
441
442
443
444
445











446
447
448
449
450
451
452
            showError(e);
        }
    }

    addSummary () {
        // todo
    }












    addMessageToGCPanel (sMessage) {
        let xNode = oGrammalecte.createNode("div", {className: "grammalecte_panel_flow_message", textContent: sMessage});
        this.xParagraphList.appendChild(xNode);
    }

    copyTextToClipboard () {







>
>
>
>
>
>
>
>
>
>
>







445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
            showError(e);
        }
    }

    addSummary () {
        // todo
    }

    copyAllParagraphsToComposeWindow () {
        // Thunderbird only
        // When closing the window, we change all nodes according to the content of paragraphs in the gc panel
        for (let iPara = 0;  iPara < this.nParagraph;  iPara++) {
            let sParagraphId = "grammalecte_paragraph"+iPara;
            if (this.xParent.getElementById(sParagraphId)) {
                this.oTextControl.setParagraph(iPara, this.xParent.getElementById(sParagraphId).textContent);
            }
        }
    }

    addMessageToGCPanel (sMessage) {
        let xNode = oGrammalecte.createNode("div", {className: "grammalecte_panel_flow_message", textContent: sMessage});
        this.xParagraphList.appendChild(xNode);
    }

    copyTextToClipboard () {