340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
|
// Tools
browser.contextMenus.create({ id: "conjugueur_tab", title: "Conjugueur [onglet]", contexts: ["all"] });
browser.contextMenus.create({ id: "conjugueur_window", title: "Conjugueur [fenêtre]", contexts: ["all"] });
//browser.contextMenus.create({ id: "dictionaries", title: "Dictionnaires", contexts: ["all"] });
browser.contextMenus.create({ id: "lexicon_editor", title: "Éditeur lexical", contexts: ["all"] });
// Rescan page
browser.contextMenus.create({ id: "separator_rescan", type: "separator", contexts: ["editable"] });
browser.contextMenus.create({ id: "rescanPage", title: "Rechercher à nouveau les zones de texte", contexts: ["editable"] });
browser.contextMenus.onClicked.addListener(function (xInfo, xTab) {
// xInfo = https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/contextMenus/OnClickData
// xTab = https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/tabs/Tab
// confusing: no way to get the node where we click?!
switch (xInfo.menuItemId) {
|
<
|
340
341
342
343
344
345
346
347
348
349
350
351
352
353
|
// Tools
browser.contextMenus.create({ id: "conjugueur_tab", title: "Conjugueur [onglet]", contexts: ["all"] });
browser.contextMenus.create({ id: "conjugueur_window", title: "Conjugueur [fenêtre]", contexts: ["all"] });
//browser.contextMenus.create({ id: "dictionaries", title: "Dictionnaires", contexts: ["all"] });
browser.contextMenus.create({ id: "lexicon_editor", title: "Éditeur lexical", contexts: ["all"] });
// Rescan page
browser.contextMenus.create({ id: "separator_rescan", type: "separator", contexts: ["editable"] });
browser.contextMenus.onClicked.addListener(function (xInfo, xTab) {
// xInfo = https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/contextMenus/OnClickData
// xTab = https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/tabs/Tab
// confusing: no way to get the node where we click?!
switch (xInfo.menuItemId) {
|
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
|
break;
case "lexicon_editor":
openLexiconEditor();
break;
case "dictionaries":
openDictionaries();
break;
// rescan page
case "rescanPage":
let xPort = dConnx.get(xTab.id);
xPort.postMessage({sActionDone: "rescanPage"});
break;
default:
console.log("[Background] Unknown menu id: " + xInfo.menuItemId);
console.log(xInfo);
console.log(xTab);
}
});
|
<
<
<
<
<
|
371
372
373
374
375
376
377
378
379
380
381
382
383
384
|
break;
case "lexicon_editor":
openLexiconEditor();
break;
case "dictionaries":
openDictionaries();
break;
default:
console.log("[Background] Unknown menu id: " + xInfo.menuItemId);
console.log(xInfo);
console.log(xTab);
}
});
|