Grammalecte  Diff

Differences From Artifact [f5c6b4e1ae]:

To Artifact [05f690bf98]:


263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
    if (oDetails.reason == "update"  ||  oDetails.reason == "installed") {
        // todo
        //browser.tabs.create({url: "http://grammalecte.net"});
    }
});



/*
    Ports from content-scripts
*/

let dConnx = new Map();


/*
    Messages from the extension (not the Worker)
*/
function handleMessage (oRequest, xSender, sendResponse) {
    // message from panels
    //console.log(xSender);
    let {sCommand, oParam, oInfo} = oRequest;







<
<
<
<
<
<
<
<







263
264
265
266
267
268
269








270
271
272
273
274
275
276
    if (oDetails.reason == "update"  ||  oDetails.reason == "installed") {
        // todo
        //browser.tabs.create({url: "http://grammalecte.net"});
    }
});










/*
    Messages from the extension (not the Worker)
*/
function handleMessage (oRequest, xSender, sendResponse) {
    // message from panels
    //console.log(xSender);
    let {sCommand, oParam, oInfo} = oRequest;
315
316
317
318
319
320
321





322
323
324
325
326
327
328
    }
    //sendResponse({response: "response from background script"});
}

browser.runtime.onMessage.addListener(handleMessage);







function handleConnexion (xPort) {
    // Messages from tabs
    let iPortId = xPort.sender.tab.id; // identifier for the port: each port can be found at dConnx[iPortId]
    dConnx.set(iPortId, xPort);
    xPort.onMessage.addListener(function (oRequest) {
        let {sCommand, oParam, oInfo} = oRequest;
        switch (sCommand) {







>
>
>
>
>







307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
    }
    //sendResponse({response: "response from background script"});
}

browser.runtime.onMessage.addListener(handleMessage);


/*
    Ports from content-scripts
*/
let dConnx = new Map();

function handleConnexion (xPort) {
    // Messages from tabs
    let iPortId = xPort.sender.tab.id; // identifier for the port: each port can be found at dConnx[iPortId]
    dConnx.set(iPortId, xPort);
    xPort.onMessage.addListener(function (oRequest) {
        let {sCommand, oParam, oInfo} = oRequest;
        switch (sCommand) {
362
363
364
365
366
367
368
















369
370
371
372
373
374
375
    });
    //xPort.postMessage({sActionDone: "newId", result: iPortId});
    xPort.postMessage({sActionDone: "init", sUrl: browser.extension.getURL("")});
}

browser.runtime.onConnect.addListener(handleConnexion);


















/*
    Context Menu
    (not for MailExtension)
*/
if (!bThunderbird) {
    // Analyze







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
    });
    //xPort.postMessage({sActionDone: "newId", result: iPortId});
    xPort.postMessage({sActionDone: "init", sUrl: browser.extension.getURL("")});
}

browser.runtime.onConnect.addListener(handleConnexion);



/*
    ComposeAction
    (Thunderbird only)
*/
if (bThunderbird) {
    console.log("[Grammalecte] Thunderbird: listening compose action...");
    browser.composeAction.onClicked.addListener(function (xTab, xData) {
        console.log("ComposeAction clicked");
        console.log(xTab);
        console.log(xData);
        browser.tabs.sendMessage(xTab.id, {sActionRequest: "grammar_checker_compose_window"});
    });
}


/*
    Context Menu
    (not for MailExtension)
*/
if (!bThunderbird) {
    // Analyze