Grammalecte  Check-in [0e2a49ac8c]

Overview
Comment:[fx] add search engine
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fx | webext2
Files: files | file ages | folders
SHA3-256: 0e2a49ac8c391309670668e08c84b2d4b8f1d8ad670e4146e9cfd4217d3d0cff
User & Date: olr on 2017-08-09 09:16:06
Other Links: branch diff | manifest | tags
Context
2017-08-09
18:11
[fx] SharedWorker attempt (not working in content script) + lexicographer panel check-in: 4e34f03093 user: olr tags: fx, webext2
09:16
[fx] add search engine check-in: 0e2a49ac8c user: olr tags: fx, webext2
07:40
[fr] nouveaux libellés pour les options du conjugueur check-in: 9aaa619491 user: olr tags: fr, webext2
Changes

Modified gc_lang/fr/webext/background.js from [d13b1b16d2] to [4837698c20].

115
116
117
118
119
120
121



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140

141
142
143
144
145
146
147
148
149

150
151
152
153
154
155
156
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
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







+
+
+


















-
+








-
+







function onCreated(windowInfo) {
  console.log(`Created window: ${windowInfo.id}`);
}

function onError(error) {
  console.log(`Error: ${error}`);
}

let xConjWindow = null;
let xConjTab = null;

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":
            if (xInfo.selectionText) {
                xGCEWorker.postMessage(["getListOfTokens", {sText: xInfo.selectionText}]);
            }
            break;
        case "conjugueur_panel":
            var xConjWindow = browser.windows.create({
            xConjWindow = browser.windows.create({
                url: browser.extension.getURL("panel/conjugueur.html"),
                type: "detached_panel",
                width: 710,
                height: 980
            });
            xConjWindow.then(onCreated, onError);
            break;
        case "conjugueur_tab":
            var xConjTab = browser.tabs.create({
            xConjTab = browser.tabs.create({
                url: browser.extension.getURL("panel/conjugueur.html"),
                pinned: true
            });
            xConjTab.then(onCreated, onError);
            break;
    }

Modified gc_lang/fr/webext/manifest.json from [de1e478a6e] to [f9bf321344].

1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
1
2
3
4
5
6
7
8
9

10
11
12
13
14
15
16
17









-
+







{
  "manifest_version": 2,
  "name": "Grammalecte [fr]",
  "short_name": "Grammalecte [fr]",
  "version": "0.6",

  "applications": {
    "gecko": {
      "id": "French-GC@grammalecte.net",
      "strict_min_version": "54.0"
      "strict_min_version": "55.0"
    }
  },

  "author": "Olivier R.",
  "homepage_url": "https://grammalecte.net",

  "description": "Correcteur grammatical pour le français.",
39
40
41
42
43
44
45
46
47










39
40
41
42
43
44
45


46
47
48
49
50
51
52
53
54
55







-
-
+
+
+
+
+
+
+
+
+
+
    "grammalecte/fr/mfsp_data.json",
    "grammalecte/fr/phonet_data.json",
    "grammalecte/fr/tests_data.json"
  ],
  "permissions": [
    "activeTab",
    "contextMenus"
  ]
}
  ],
  "chrome_settings_overrides": {
    "search_provider": {
      "name": "Grammalecte",
      "search_url": "https://www.dicollecte.org/dictionary.php?prj=fr&lemma={searchTerms}",
      "keyword": "disc",
      "favicon_url": "https://www.dicollecte.org/favicon.ico"
    }
  }
}