Grammalecte  Diff

Differences From Artifact [37c7ef1ed2]:

To Artifact [be5aff6344]:


109
110
111
112
113
114
115









116
117
118
119
120
121
122

    startLxgPanel: function () {
        oGrammalecte.createLxgPanel();
        oGrammalecte.oLxgPanel.clear();
        oGrammalecte.oLxgPanel.show();
        oGrammalecte.oLxgPanel.startWaitIcon();
    },










    createNode: function (sType, oAttr, oDataset=null) {
        try {
            let xNode = document.createElement(sType);
            Object.assign(xNode, oAttr);
            if (oDataset) {
                Object.assign(xNode.dataset, oDataset);







>
>
>
>
>
>
>
>
>







109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131

    startLxgPanel: function () {
        oGrammalecte.createLxgPanel();
        oGrammalecte.oLxgPanel.clear();
        oGrammalecte.oLxgPanel.show();
        oGrammalecte.oLxgPanel.startWaitIcon();
    },

    getPageText: function () {
        let sPageText = document.body.textContent;
        let nPos = sPageText.indexOf("__grammalecte_panel__");
        if (nPos >= 0) {
            sPageText = sPageText.slice(0, nPos);
        }
        return sPageText;
    },

    createNode: function (sType, oAttr, oDataset=null) {
        try {
            let xNode = document.createElement(sType);
            Object.assign(xNode, oAttr);
            if (oDataset) {
                Object.assign(xNode.dataset, oDataset);
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
                dInfo: {sTextAreaId: xRightClickedNode.id}
            });
            break;
        case "rightClickGCPage":
            oGrammalecte.startGCPanel();
            xGrammalectePort.postMessage({
                sCommand: "parseAndSpellcheck",
                dParam: {sText: document.body.textContent, sCountry: "FR", bDebug: false, bContext: false},
                dInfo: {sTextAreaId: xRightClickedNode.id}
            });
            break;
        case "rightClickGCSelectedText":
            oGrammalecte.startGCPanel();
            // selected text is sent to the GC worker in the background script.
            break;







|







192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
                dInfo: {sTextAreaId: xRightClickedNode.id}
            });
            break;
        case "rightClickGCPage":
            oGrammalecte.startGCPanel();
            xGrammalectePort.postMessage({
                sCommand: "parseAndSpellcheck",
                dParam: {sText: oGrammalecte.getPageText(), sCountry: "FR", bDebug: false, bContext: false},
                dInfo: {sTextAreaId: xRightClickedNode.id}
            });
            break;
        case "rightClickGCSelectedText":
            oGrammalecte.startGCPanel();
            // selected text is sent to the GC worker in the background script.
            break;
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
                dInfo: {sTextAreaId: xRightClickedNode.id}
            });
            break;
        case "rightClickLxgPage":
            oGrammalecte.startLxgPanel();
            xGrammalectePort.postMessage({
                sCommand: "getListOfTokens",
                dParam: {sText: document.body.textContent},
                dInfo: {sTextAreaId: xRightClickedNode.id}
            });
            break;
        case "rightClickLxgSelectedText":
            oGrammalecte.startLxgPanel();
            // selected text is sent to the GC worker in the background script.
            break;







|







214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
                dInfo: {sTextAreaId: xRightClickedNode.id}
            });
            break;
        case "rightClickLxgPage":
            oGrammalecte.startLxgPanel();
            xGrammalectePort.postMessage({
                sCommand: "getListOfTokens",
                dParam: {sText: oGrammalecte.getPageText()},
                dInfo: {sTextAreaId: xRightClickedNode.id}
            });
            break;
        case "rightClickLxgSelectedText":
            oGrammalecte.startLxgPanel();
            // selected text is sent to the GC worker in the background script.
            break;