Grammalecte  Diff

Differences From Artifact [316d25a5ff]:

To Artifact [ae034ec96f]:


516
517
518
519
520
521
522
523
524
525
526
527
528
529
530

531
532
533
534
535
536
537
oGrammalecteBackgroundPort.listen()
oGrammalecteBackgroundPort.listen2()



/*
    Callable API for the webpage.
    The API script must be injected this way to be callable by the page
*/
let xScriptGrammalecteAPI = document.createElement("script");
xScriptGrammalecteAPI.src = browser.extension.getURL("content_scripts/api.js");
document.documentElement.appendChild(xScriptGrammalecteAPI);

document.addEventListener("GrammalecteCall", function (xEvent) {
    // GrammalecteCall events are dispatched by functions in the API script

    try {
        let oCommand = xEvent.detail;
        switch (oCommand.sCommand) {
            case "openPanelForNode":
                if (oCommand.xNode) {
                    oGrammalecte.startGCPanel(oCommand.xNode);
                }







|

<
<
<
<


>







516
517
518
519
520
521
522
523
524




525
526
527
528
529
530
531
532
533
534
oGrammalecteBackgroundPort.listen()
oGrammalecteBackgroundPort.listen2()



/*
    Callable API for the webpage.

*/




document.addEventListener("GrammalecteCall", function (xEvent) {
    // GrammalecteCall events are dispatched by functions in the API script
    // The script is loaded below.
    try {
        let oCommand = xEvent.detail;
        switch (oCommand.sCommand) {
            case "openPanelForNode":
                if (oCommand.xNode) {
                    oGrammalecte.startGCPanel(oCommand.xNode);
                }
563
564
565
566
567
568
569





570
571
572
573
574
575
576
                console.log("[Grammalecte] Event: Unknown command", oCommand.sCommand);
        }
    }
    catch (e) {
        showError(e);
    }
});







/*
    Note:
    Initialization starts when the background is connected.
    See: oGrammalecteBackgroundPort.listen() -> case "init"
*/







>
>
>
>
>







560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
                console.log("[Grammalecte] Event: Unknown command", oCommand.sCommand);
        }
    }
    catch (e) {
        showError(e);
    }
});

// The API script must be injected this way to be callable by the page
let xScriptGrammalecteAPI = document.createElement("script");
xScriptGrammalecteAPI.src = browser.extension.getURL("content_scripts/api.js");
document.documentElement.appendChild(xScriptGrammalecteAPI);


/*
    Note:
    Initialization starts when the background is connected.
    See: oGrammalecteBackgroundPort.listen() -> case "init"
*/