Overview
| Comment: | [fx] remove log | 
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive | 
| Timelines: | family | ancestors | descendants | both | fx | webext2 | 
| Files: | files | file ages | folders | 
| SHA3-256: | 
47f63e5dc064e605b1a3b57b33971453 | 
| User & Date: | olr on 2017-08-26 10:33:05 | 
| Other Links: | branch diff | manifest | tags | 
Context
| 
   2017-08-26 
 | ||
| 18:54 | [fx] panel ui update check-in: fc3cf1b18f user: olr tags: fx, webext2 | |
| 10:33 | [fx] remove log check-in: 47f63e5dc0 user: olr tags: fx, webext2 | |
| 10:15 | [fx] code cleaning + keyboard shortcuts + main panel update check-in: 3f5e5e035c user: olr tags: fx, webext2 | |
Changes
Modified gc_lang/fr/webext/background.js from [e31347c2da] to [c04d704430].
| ︙ | ︙ | |||
13 14 15 16 17 18 19  | 
xGCEWorker.onmessage = function (e) {
    // https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent
    try {
        let {sActionDone, result, dInfo} = e.data;
        switch (sActionDone) {
            case "init":
 | < < < <  | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43  | 
xGCEWorker.onmessage = function (e) {
    // https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent
    try {
        let {sActionDone, result, dInfo} = e.data;
        switch (sActionDone) {
            case "init":
                break;
            case "parse":
            case "parseAndSpellcheck":
            case "parseAndSpellcheck1":
            case "getListOfTokens":
                if (typeof(dInfo.iReturnPort) === "number") {
                    let xPort = dConnx.get(dInfo.iReturnPort);
                    xPort.postMessage(e.data);
                } else {
                    console.log("[background] don’t know where to send results");
                    console.log(e.data);
                }
                break;
            case "textToTest":
                browser.runtime.sendMessage({sCommand: "text_to_test_result", sResult: result});
                break;
            case "fullTests":
                browser.runtime.sendMessage({sCommand: "fulltests_result", sResult: result});
                break;
            case "getOptions":
            case "getDefaultOptions":
            case "setOptions":
            case "setOption":
                console.log("OPTIONS");
 | 
| ︙ | ︙ | |||
68 69 70 71 72 73 74  | 
/*
    Messages from the extension (not the Worker)
*/
function handleMessage (oRequest, xSender, sendResponse) {
    //console.log(xSender);
 | < <  | 64 65 66 67 68 69 70 71 72 73 74 75 76 77  | 
/*
    Messages from the extension (not the Worker)
*/
function handleMessage (oRequest, xSender, sendResponse) {
    //console.log(xSender);
    switch (oRequest.sCommand) {
        case "parse":
        case "parseAndSpellcheck":
        case "parseAndSpellcheck1":
        case "getListOfTokens":
        case "textToTest":
        case "getOptions":
 | 
| ︙ | ︙ | |||
94 95 96 97 98 99 100  | 
}
browser.runtime.onMessage.addListener(handleMessage);
function handleConnexion (xPort) {
    let iPortId = xPort.sender.tab.id; // identifier for the port: each port can be found at dConnx[iPortId]
 | < < < <  | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109  | 
}
browser.runtime.onMessage.addListener(handleMessage);
function handleConnexion (xPort) {
    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) {
        switch (oRequest.sCommand) {
            case "parse":
            case "parseAndSpellcheck":
            case "parseAndSpellcheck1":
            case "getListOfTokens":
                oRequest.dInfo.iReturnPort = iPortId; // we pass the id of the return port to receive answer
                xGCEWorker.postMessage(oRequest);
                break;
            default:
                console.log("[background] Unknown command: " + oRequest.sCommand);
                console.log(oRequest);
        }
    });
 | 
| ︙ | ︙ | 
Modified gc_lang/fr/webext/content_scripts/content_modifier.js from [00d02be92c] to [08d6a77f2d].
| ︙ | ︙ | |||
53 54 55 56 57 58 59  | 
            let xConjButton = createNode("div", {className: "grammalecte_wrapper_button", textContent: "Conjuguer"});
            xConjButton.onclick = function () {
                this.createConjPanel();
                //this.oConjPanel.show();
            }.bind(this);
            let xTFButton = createNode("div", {className: "grammalecte_wrapper_button", textContent: "Formater"});
            xTFButton.onclick = function () {
 | |  | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67  | 
            let xConjButton = createNode("div", {className: "grammalecte_wrapper_button", textContent: "Conjuguer"});
            xConjButton.onclick = function () {
                this.createConjPanel();
                //this.oConjPanel.show();
            }.bind(this);
            let xTFButton = createNode("div", {className: "grammalecte_wrapper_button", textContent: "Formater"});
            xTFButton.onclick = function () {
                this.createTFPanel();
                this.oTFPanel.start(xTextArea);
                this.oTFPanel.show();
            }.bind(this);
            let xLxgButton = createNode("div", {className: "grammalecte_wrapper_button", textContent: "Analyser"});
            xLxgButton.onclick = function () {
                this.createLxgPanel();
                this.oLxgPanel.clear();
 | 
| ︙ | ︙ | |||
99 100 101 102 103 104 105  | 
        }
        catch (e) {
            showError(e);
        }
    },
    createConjPanel: function () {
 | < |  | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119  | 
        }
        catch (e) {
            showError(e);
        }
    },
    createConjPanel: function () {
        if (this.oConjPanel === null) {
            this.oConjPanel = new GrammalectePanel("grammalecte_conj_panel", "Conjugueur", 600, 600);
            this.oConjPanel.insertIntoPage();
        }
    },
    createTFPanel: function () {
        if (this.oTFPanel === null) {
            this.oTFPanel = new GrammalecteTextFormatter("grammalecte_tf_panel", "Formateur de texte", 800, 620, false);
            //this.oTFPanel.logInnerHTML();
            this.oTFPanel.insertIntoPage();
        }
    },
 | 
| ︙ | ︙ | |||
136 137 138 139 140 141 142  | 
/*
    Connexion to the background
*/
let xPort = browser.runtime.connect({name: "content-script port"});
xPort.onMessage.addListener(function (oMessage) {
 | < < < <  | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161  | 
/*
    Connexion to the background
*/
let xPort = browser.runtime.connect({name: "content-script port"});
xPort.onMessage.addListener(function (oMessage) {
    let {sActionDone, result, dInfo, bEnd, bError} = oMessage;
    switch (sActionDone) {
        case "parseAndSpellcheck":
            if (!bEnd) {
                oGrammalecte.oGCPanel.addParagraphResult(result);
            } else {
                oGrammalecte.oGCPanel.stopWaitIcon();
            }
            break;
        case "parseAndSpellcheck1":
            oGrammalecte.oGCPanel.refreshParagraph(dInfo.sParagraphId, result);
            break;
        case "getListOfTokens":
            if (!bEnd) {
                oGrammalecte.oLxgPanel.addListOfTokens(result);
            } else {
                oGrammalecte.oLxgPanel.stopWaitIcon();
            }
            break;
        // Design WTF: context menus are made in background, not in content-script.
 | 
| ︙ | ︙ | 
Modified gc_lang/fr/webext/gce_worker.js from [94cf928cb8] to [1a2b4f786b].
| ︙ | ︙ | |||
25 26 27 28 29 30 31  | 
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export
*/
"use strict";
 | |  | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39  | 
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export
*/
"use strict";
//console.log("[Worker] GC Engine Worker [start]");
//console.log(self);
importScripts("grammalecte/helpers.js");
importScripts("grammalecte/str_transform.js");
importScripts("grammalecte/ibdawg.js");
importScripts("grammalecte/text.js");
importScripts("grammalecte/tokenizer.js");
 | 
| ︙ | ︙ | |||
81 82 83 84 85 86 87  | 
/*
    Message Event Object
    https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent
*/
onmessage = function (e) {
 | <  | 81 82 83 84 85 86 87 88 89 90 91 92 93 94  | 
/*
    Message Event Object
    https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent
*/
onmessage = function (e) {
    let {sCommand, dParam, dInfo} = e.data;
    switch (sCommand) {
        case "init":
            init(dParam.sExtensionPath, dParam.sOptions, dParam.sContext, dInfo);
            break;
        case "parse":
            parse(dParam.sText, dParam.sCountry, dParam.bDebug, dParam.bContext, dInfo);
 | 
| ︙ | ︙ | |||
147 148 149 150 151 152 153  | 
    That’s why the full text to analyze is send in one block, but analyse is returned paragraph
    by paragraph.
*/
function init (sExtensionPath, sGCOptions="", sContext="JavaScript", dInfo={}) {
    try {
        if (!bInitDone) {
 | | |  | 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164  | 
    That’s why the full text to analyze is send in one block, but analyse is returned paragraph
    by paragraph.
*/
function init (sExtensionPath, sGCOptions="", sContext="JavaScript", dInfo={}) {
    try {
        if (!bInitDone) {
            //console.log("[Worker] Loading… Extension path: " + sExtensionPath);
            conj.init(helpers.loadFile(sExtensionPath + "/grammalecte/fr/conj_data.json"));
            phonet.init(helpers.loadFile(sExtensionPath + "/grammalecte/fr/phonet_data.json"));
            mfsp.init(helpers.loadFile(sExtensionPath + "/grammalecte/fr/mfsp_data.json"));
            //console.log("[Worker] Modules have been initialized…");
            gc_engine.load(sContext, sExtensionPath+"grammalecte/_dictionaries");
            oDict = gc_engine.getDictionary();
            oTest = new TestGrammarChecking(gc_engine, sExtensionPath+"/grammalecte/fr/tests_data.json");
            oLxg = new Lexicographe(oDict);
            if (sGCOptions !== "") {
                gc_engine.setOptions(helpers.objectToMap(JSON.parse(sGCOptions)));
            }
 | 
| ︙ | ︙ |