267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
|
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
switch (sCommand) {
case "conjugueur_tab":
openConjugueurTab();
break;
case "conjugueur_window":
openConjugueurWindow();
break;
case "lex_editor":
openLexEditor();
break;
}
});
/*
Actions
*/
function storeGCOptions (dOptions) {
if (bChrome) {
// JS crap again. Chrome can’t store Map object.
dOptions = helpers.mapToObject(dOptions);
}
browser.storage.local.set({"gc_options": dOptions});
}
function sendCommandToTab (sCommand, iTab) {
let xTabPort = dConnx.get(iTab);
xTabPort.postMessage({sActionDone: sCommand, result: null, dInfo: null, bEnd: false, bError: false});
}
function openLexEditor () {
if (bChrome) {
browser.tabs.create({
url: browser.extension.getURL("panel/lex_editor.html")
});
return;
}
let xLexEditor = browser.tabs.create({
url: browser.extension.getURL("panel/lex_editor.html")
});
xLexEditor.then(onCreated, onError);
}
function openConjugueurTab () {
if (bChrome) {
browser.tabs.create({
url: browser.extension.getURL("panel/conjugueur.html")
});
return;
|