272
273
274
275
276
277
278
279
280
281
282
283
284
285
|
return xNode;
}
catch (e) {
showError(e);
}
}
};
/*
Connexion to the background
*/
let xGrammalectePort = browser.runtime.connect({name: "content-script port"});
xGrammalectePort.onMessage.addListener(function (oMessage) {
|
>
|
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
|
return xNode;
}
catch (e) {
showError(e);
}
}
};
/*
Connexion to the background
*/
let xGrammalectePort = browser.runtime.connect({name: "content-script port"});
xGrammalectePort.onMessage.addListener(function (oMessage) {
|
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
|
Commands received from the context menu
(Context menu are initialized in background)
*/
// Grammar checker commands
case "rightClickGCEditableNode":
if (oGrammalecte.xRightClickedNode !== null) {
oGrammalecte.startGCPanel(oGrammalecte.xRightClickedNode);
sText = oGrammalecte.xRightClickedNode.tagName == "TEXTAREA" ? oGrammalecte.xRightClickedNode.value : oGrammalecte.xRightClickedNode.innerText;
xGrammalectePort.postMessage({
sCommand: "parseAndSpellcheck",
dParam: {sText: sText, sCountry: "FR", bDebug: false, bContext: false},
dInfo: {sTextAreaId: oGrammalecte.xRightClickedNode.id}
});
} else {
oGrammalecte.showMessage("Erreur. Le node sur lequel vous avez cliqué n’a pas pu être identifié. Sélectionnez le texte à corriger et relancez le correcteur via le menu contextuel.");
|
|
|
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
|
Commands received from the context menu
(Context menu are initialized in background)
*/
// Grammar checker commands
case "rightClickGCEditableNode":
if (oGrammalecte.xRightClickedNode !== null) {
oGrammalecte.startGCPanel(oGrammalecte.xRightClickedNode);
sText = (oGrammalecte.xRightClickedNode.tagName == "TEXTAREA") ? oGrammalecte.xRightClickedNode.value : oGrammalecte.xRightClickedNode.innerText;
xGrammalectePort.postMessage({
sCommand: "parseAndSpellcheck",
dParam: {sText: sText, sCountry: "FR", bDebug: false, bContext: false},
dInfo: {sTextAreaId: oGrammalecte.xRightClickedNode.id}
});
} else {
oGrammalecte.showMessage("Erreur. Le node sur lequel vous avez cliqué n’a pas pu être identifié. Sélectionnez le texte à corriger et relancez le correcteur via le menu contextuel.");
|
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
|
oGrammalecte.startGCPanel();
// selected text is sent to the GC worker in the background script.
break;
// Lexicographer commands
case "rightClickLxgEditableNode":
if (oGrammalecte.xRightClickedNode !== null) {
oGrammalecte.startLxgPanel();
sText = oGrammalecte.xRightClickedNode.tagName == "TEXTAREA" ? oGrammalecte.xRightClickedNode.value : oGrammalecte.xRightClickedNode.innerText;
xGrammalectePort.postMessage({
sCommand: "getListOfTokens",
dParam: {sText: sText},
dInfo: {sTextAreaId: oGrammalecte.xRightClickedNode.id}
});
} else {
oGrammalecte.showMessage("Erreur. Le node sur lequel vous avez cliqué n’a pas pu être identifié. Sélectionnez le texte à analyser et relancez le lexicographe via le menu contextuel.");
|
|
|
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
|
oGrammalecte.startGCPanel();
// selected text is sent to the GC worker in the background script.
break;
// Lexicographer commands
case "rightClickLxgEditableNode":
if (oGrammalecte.xRightClickedNode !== null) {
oGrammalecte.startLxgPanel();
sText = (oGrammalecte.xRightClickedNode.tagName == "TEXTAREA") ? oGrammalecte.xRightClickedNode.value : oGrammalecte.xRightClickedNode.innerText;
xGrammalectePort.postMessage({
sCommand: "getListOfTokens",
dParam: {sText: sText},
dInfo: {sTextAreaId: oGrammalecte.xRightClickedNode.id}
});
} else {
oGrammalecte.showMessage("Erreur. Le node sur lequel vous avez cliqué n’a pas pu être identifié. Sélectionnez le texte à analyser et relancez le lexicographe via le menu contextuel.");
|