Grammalecte  Check-in [f7b29b571c]

Overview
Comment:[fx] tests with context menus
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fx | webext2
Files: files | file ages | folders
SHA3-256: f7b29b571c528bf325ad3f7976c4ea624cf27d636e3c0ff9b3a522ad9e19a7d0
User & Date: olr on 2017-08-07 15:09:00
Other Links: branch diff | manifest | tags
Context
2017-08-08
13:08
[fx] attempt for the lexicographer (can’t work that way, it seems) check-in: fd7a9b5ca3 user: olr tags: fx, webext2
2017-08-07
15:09
[fx] tests with context menus check-in: f7b29b571c user: olr tags: fx, webext2
13:31
[fx] some cleaning check-in: 04f319695e user: olr tags: fx, webext2
Changes

Modified gc_lang/fr/webext/background.js from [2d600ca132] to [fa74ac872d].

70
71
72
73
74
75
76
































            xGCEWorker.postMessage(["fullTests"]);
            break;
    }
    //sendResponse({response: "response from background script"});
}

browser.runtime.onMessage.addListener(handleMessage);







































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
            xGCEWorker.postMessage(["fullTests"]);
            break;
    }
    //sendResponse({response: "response from background script"});
}

browser.runtime.onMessage.addListener(handleMessage);


/*
    Context Menu
*/
browser.contextMenus.create({
    id: "grammar_checking",
    title: "Correction grammaticale",
    contexts: ["selection", "editable", "page"]
});

browser.contextMenus.create({
    id: "lexicographer",
    title: "Lexicographe",
    contexts: ["selection", "editable", "page"]
});

browser.contextMenus.onClicked.addListener(function (xInfo, xTab) {
    // xInfo = https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/contextMenus/OnClickData
    // xTab = https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/tabs/Tab
    console.log(xInfo);
    console.log(xTab);
    console.log("Item " + xInfo.menuItemId + " clicked in tab " + xTab.id);
    console.log("editable: " + xInfo.editable + " · selected: " + xInfo.selectionText);
    // confusing: no way to get the node where we click?!
    switch (xInfo.menuItemId) {
        case "grammar_checking":
            break;
        case "lexicographer":
            break;
    }
});

Modified gc_lang/fr/webext/manifest.json from [49413af971] to [ebaa1e6143].

37
38
39
40
41
42
43
44

45
46
    "grammalecte/_dictionaries/French.json",
    "grammalecte/fr/conj_data.json",
    "grammalecte/fr/mfsp_data.json",
    "grammalecte/fr/phonet_data.json",
    "grammalecte/fr/tests_data.json"
  ],
  "permissions": [
    "activeTab"

  ]
}







|
>


37
38
39
40
41
42
43
44
45
46
47
    "grammalecte/_dictionaries/French.json",
    "grammalecte/fr/conj_data.json",
    "grammalecte/fr/mfsp_data.json",
    "grammalecte/fr/phonet_data.json",
    "grammalecte/fr/tests_data.json"
  ],
  "permissions": [
    "activeTab",
    "contextMenus"
  ]
}