Grammalecte  Check-in [45958eeafc]

Overview
Comment:[fx] WebExt: message if node can’t be found via eventListener of context menu
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fx | webext3
Files: files | file ages | folders
SHA3-256: 45958eeafccd289f04d6379547873f1e08738212c21ab191993b4e2ae8c79ce5
User & Date: olr on 2017-10-14 10:59:21
Other Links: branch diff | manifest | tags
Context
2017-10-14
11:45
[fx] WebExt: context menu: slected text commands first check-in: 4c9fdcb9ba user: olr tags: fx, webext3
10:59
[fx] WebExt: message if node can’t be found via eventListener of context menu check-in: 45958eeafc user: olr tags: fx, webext3
2017-10-13
19:03
[fx] WebExt: don’t show page items in context menu in all contexts check-in: 2ca05e00bb user: olr tags: fx, webext3
Changes

Modified gc_lang/fr/webext/content_scripts/init.js from [c75754d628] to [88b511454d].

194
195
196
197
198
199
200




201
202
203
204
205
206
207
...
218
219
220
221
222
223
224




225
226
227
228
229
230
231
                oGrammalecte.startGCPanel(oGrammalecte.xRightClickedNode);
                sText = (oGrammalecte.xRightClickedNode.tagName == "TEXTAREA") ? oGrammalecte.xRightClickedNode.value : oGrammalecte.xRightClickedNode.textContent;
                xGrammalectePort.postMessage({
                    sCommand: "parseAndSpellcheck",
                    dParam: {sText: sText, sCountry: "FR", bDebug: false, bContext: false},
                    dInfo: {sTextAreaId: oGrammalecte.xRightClickedNode.id}
                });




            }
            break;
        case "rightClickGCPage":
            oGrammalecte.startGCPanel();
            xGrammalectePort.postMessage({
                sCommand: "parseAndSpellcheck",
                dParam: {sText: oGrammalecte.getPageText(), sCountry: "FR", bDebug: false, bContext: false},
................................................................................
                oGrammalecte.startLxgPanel();
                sText = (oGrammalecte.xRightClickedNode.tagName == "TEXTAREA") ? oGrammalecte.xRightClickedNode.value : oGrammalecte.xRightClickedNode.textContent;
                xGrammalectePort.postMessage({
                    sCommand: "getListOfTokens",
                    dParam: {sText: sText},
                    dInfo: {sTextAreaId: oGrammalecte.xRightClickedNode.id}
                });




            }
            break;
        case "rightClickLxgPage":
            oGrammalecte.startLxgPanel();
            xGrammalectePort.postMessage({
                sCommand: "getListOfTokens",
                dParam: {sText: oGrammalecte.getPageText()},







>
>
>
>







 







>
>
>
>







194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
...
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
                oGrammalecte.startGCPanel(oGrammalecte.xRightClickedNode);
                sText = (oGrammalecte.xRightClickedNode.tagName == "TEXTAREA") ? oGrammalecte.xRightClickedNode.value : oGrammalecte.xRightClickedNode.textContent;
                xGrammalectePort.postMessage({
                    sCommand: "parseAndSpellcheck",
                    dParam: {sText: sText, sCountry: "FR", bDebug: false, bContext: false},
                    dInfo: {sTextAreaId: oGrammalecte.xRightClickedNode.id}
                });
            } else {
                oGrammalecte.startGCPanel();
                oGrammalecte.oGCPanel.addMessage("Erreur. Node introuvable… Sélectionnez le texte à corriger et relancez le correcteur via le menu contextuel.");
                oGrammalecte.oGCPanel.stopWaitIcon();
            }
            break;
        case "rightClickGCPage":
            oGrammalecte.startGCPanel();
            xGrammalectePort.postMessage({
                sCommand: "parseAndSpellcheck",
                dParam: {sText: oGrammalecte.getPageText(), sCountry: "FR", bDebug: false, bContext: false},
................................................................................
                oGrammalecte.startLxgPanel();
                sText = (oGrammalecte.xRightClickedNode.tagName == "TEXTAREA") ? oGrammalecte.xRightClickedNode.value : oGrammalecte.xRightClickedNode.textContent;
                xGrammalectePort.postMessage({
                    sCommand: "getListOfTokens",
                    dParam: {sText: sText},
                    dInfo: {sTextAreaId: oGrammalecte.xRightClickedNode.id}
                });
            } else {
                oGrammalecte.startLxgPanel();
                oGrammalecte.oLxgPanel.addMessage("Erreur. Node introuvable… Sélectionnez le texte à analyser et relancez le lexicographe via le menu contextuel.");
                oGrammalecte.oLxgPanel.stopWaitIcon();
            }
            break;
        case "rightClickLxgPage":
            oGrammalecte.startLxgPanel();
            xGrammalectePort.postMessage({
                sCommand: "getListOfTokens",
                dParam: {sText: oGrammalecte.getPageText()},

Modified gc_lang/fr/webext/content_scripts/panel.css from [021aa4bf30] to [d6be17e22c].

95
96
97
98
99
100
101









102
103
104
105
106
107
108

.grammalecte_panel_content {
    position: absolute;
    min-width: 100%;
    height: calc(100% - 55px); /* panel height - title_bar */
    overflow: auto;
}











/*
    Spinner
*/
.grammalecte_spinner {
    visibility: hidden;







>
>
>
>
>
>
>
>
>







95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117

.grammalecte_panel_content {
    position: absolute;
    min-width: 100%;
    height: calc(100% - 55px); /* panel height - title_bar */
    overflow: auto;
}

.grammalecte_panel_message {
    margin: 10px;
    padding: 10px;
    border-radius: 5px;
    background-color: hsl(0, 50%, 40%);
    color: hsl(0, 50%, 96%);
    font-size: 20px;
}


/*
    Spinner
*/
.grammalecte_spinner {
    visibility: hidden;

Modified gc_lang/fr/webext/content_scripts/panel_gc.js from [b14363b80e] to [d202e2bfd4].

233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
    }

    addSummary () {
        // todo
    }

    addMessage (sMessage) {
        let xNode = oGrammalecte.createNode("div", {className: "grammalecte_gc_panel_message", textContent: sMessage});
        this.xParagraphList.appendChild(xNode);
    }

    _copyToClipboard (sText)  {
        // recipe from https://github.com/mdn/webextensions-examples/blob/master/context-menu-copy-link-with-types/clipboard-helper.js
        function setClipboardData (xEvent) {
            document.removeEventListener("copy", setClipboardData, true);







|







233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
    }

    addSummary () {
        // todo
    }

    addMessage (sMessage) {
        let xNode = oGrammalecte.createNode("div", {className: "grammalecte_panel_message", textContent: sMessage});
        this.xParagraphList.appendChild(xNode);
    }

    _copyToClipboard (sText)  {
        // recipe from https://github.com/mdn/webextensions-examples/blob/master/context-menu-copy-link-with-types/clipboard-helper.js
        function setClipboardData (xEvent) {
            document.removeEventListener("copy", setClipboardData, true);

Modified gc_lang/fr/webext/content_scripts/panel_lxg.js from [eb959206ea] to [d3537b8dce].

20
21
22
23
24
25
26
27

28
29
30
31
32
33
34
35

    addSeparator (sText) {
        if (this._xContentNode.textContent !== "") {
            this._xContentNode.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_separator", textContent: sText}));
        }
    }

    addMessage (sClass, sText) {

        this._xContentNode.appendChild(oGrammalecte.createNode("div", {className: sClass, textContent: sText}));
    }

    addListOfTokens (lTokens) {
        try {
            if (lTokens) {
                this._nCount += 1;
                let xNodeDiv = oGrammalecte.createNode("div", {className: "grammalecte_lxg_list_of_tokens"});







|
>
|







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

    addSeparator (sText) {
        if (this._xContentNode.textContent !== "") {
            this._xContentNode.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_separator", textContent: sText}));
        }
    }

    addMessage (sMessage) {
        let xNode = oGrammalecte.createNode("div", {className: "grammalecte_panel_message", textContent: sMessage});
        this._xContentNode.appendChild(xNode);
    }

    addListOfTokens (lTokens) {
        try {
            if (lTokens) {
                this._nCount += 1;
                let xNodeDiv = oGrammalecte.createNode("div", {className: "grammalecte_lxg_list_of_tokens"});