Grammalecte  Check-in [2ca05e00bb]

Overview
Comment:[fx] WebExt: don’t show page items in context menu in all contexts
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fx | webext3
Files: files | file ages | folders
SHA3-256: 2ca05e00bb4e6f7bffa5ed2845b1cd4d26e059483ba803b130a41bb9aefc6cdc
User & Date: olr on 2017-10-13 19:03:30
Other Links: branch diff | manifest | tags
Context
2017-10-14
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
13:43
[fx] WebExt: fix commands for selected text check-in: 2eb8d827d0 user: olr tags: fx, webext3
Changes

Modified gc_lang/fr/webext/background.js from [13dbea6b01] to [f622a68555].

196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
    contexts: ["editable"]
});

// Page
browser.contextMenus.create({
    id: "rightClickLxgPage",
    title: "Lexicographe (page)",
    contexts: ["all"]
});

browser.contextMenus.create({
    id: "rightClickGCPage",
    title: "Correction grammaticale (page)",
    contexts: ["all"]
});

browser.contextMenus.create({
    id: "separator_page",
    type: "separator",
    contexts: ["all"]
});

// Selected text
browser.contextMenus.create({
    id: "rightClickLxgSelectedText",
    title: "Lexicographe (sélection)",
    contexts: ["selection"]







|





|





|







196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
    contexts: ["editable"]
});

// Page
browser.contextMenus.create({
    id: "rightClickLxgPage",
    title: "Lexicographe (page)",
    contexts: ["page"]
});

browser.contextMenus.create({
    id: "rightClickGCPage",
    title: "Correction grammaticale (page)",
    contexts: ["page"]
});

browser.contextMenus.create({
    id: "separator_page",
    type: "separator",
    contexts: ["page"]
});

// Selected text
browser.contextMenus.create({
    id: "rightClickLxgSelectedText",
    title: "Lexicographe (sélection)",
    contexts: ["selection"]

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

46
47
48
49
50
51
52


53
54
55
56
57
58
59
    oTFPanel: null,
    oLxgPanel: null,
    oGCPanel: null,

    xRightClickedNode: null,

    listenRightClick: function () {


        document.addEventListener('contextmenu', function (xEvent) {
            this.xRightClickedNode = xEvent.target;
        }.bind(this), true);
    },

    clearRightClickedNode: function () {
        this.xRightClickedNode = null;







>
>







46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
    oTFPanel: null,
    oLxgPanel: null,
    oGCPanel: null,

    xRightClickedNode: null,

    listenRightClick: function () {
        // Node where a right click is done
        // Bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=1325814
        document.addEventListener('contextmenu', function (xEvent) {
            this.xRightClickedNode = xEvent.target;
        }.bind(this), true);
    },

    clearRightClickedNode: function () {
        this.xRightClickedNode = null;
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
        }
        catch (e) {
            showError(e);
        }
    }
}


/*
    Node where a right click is done
    Bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=1325814
*/


/*
    Connexion to the background
*/
let xGrammalectePort = browser.runtime.connect({name: "content-script port"});

xGrammalectePort.onMessage.addListener(function (oMessage) {







<
<
<
<
<
<







150
151
152
153
154
155
156






157
158
159
160
161
162
163
        }
        catch (e) {
            showError(e);
        }
    }
}








/*
    Connexion to the background
*/
let xGrammalectePort = browser.runtime.connect({name: "content-script port"});

xGrammalectePort.onMessage.addListener(function (oMessage) {