Overview
Comment: | [tb][fx][build] update WebExtension and build for MailExtension |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | build | tb | fx | mailext |
Files: | files | file ages | folders |
SHA3-256: |
0f4799907db213da15c6030c683b4155 |
User & Date: | olr on 2020-07-04 17:54:48 |
Other Links: | branch diff | manifest | tags |
Context
2020-07-05
| ||
09:35 | [tb][fx] update for MailExtension check-in: 05b48840da user: olr tags: tb, fx, mailext | |
2020-07-04
| ||
17:54 | [tb][fx][build] update WebExtension and build for MailExtension check-in: 0f4799907d user: olr tags: build, tb, fx, mailext | |
09:12 | [tb][build] update build and manifest check-in: 1c2ff3e7cc user: olr tags: build, tb, mailext | |
Changes
Modified gc_lang/fr/build.py from [4c6f440200] to [1abca1cab7].
︙ | ︙ | |||
68 69 70 71 72 73 74 | "create extension for Thunderbird (as MailExtension)" print("> Building extension for Thunderbird (MailExtension)") spfZip = "_build/" + dVars['tb_identifier'] + "-v" + dVars['version'] + '.mailext.xpi' hZip = zipfile.ZipFile(spfZip, mode='w', compression=zipfile.ZIP_DEFLATED) _copyGrammalecteJSPackageInZipFile(hZip, sLang) for spf in ["LICENSE.txt", "LICENSE.fr.txt"]: hZip.write(spf) | | > > > | | | | | | < | | < < < < < < < < < < < < < < < < | 68 69 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 | "create extension for Thunderbird (as MailExtension)" print("> Building extension for Thunderbird (MailExtension)") spfZip = "_build/" + dVars['tb_identifier'] + "-v" + dVars['version'] + '.mailext.xpi' hZip = zipfile.ZipFile(spfZip, mode='w', compression=zipfile.ZIP_DEFLATED) _copyGrammalecteJSPackageInZipFile(hZip, sLang) for spf in ["LICENSE.txt", "LICENSE.fr.txt"]: hZip.write(spf) helpers.addFolderToZipAndFileFile(hZip, "gc_lang/"+sLang+"/webext/gce_worker.js") helpers.addFolderToZipAndFileFile(hZip, "gc_lang/"+sLang+"/mailext", "", dVars, True) helpers.addFolderToZipAndFileFile(hZip, "gc_lang/"+sLang+"/webext/3rd", "3rd", dVars, True) helpers.addFolderToZipAndFileFile(hZip, "gc_lang/"+sLang+"/webext/_locales", "_locales", dVars, True) helpers.addFolderToZipAndFileFile(hZip, "gc_lang/"+sLang+"/webext/content_scripts", "content_scripts", dVars, True) helpers.addFolderToZipAndFileFile(hZip, "gc_lang/"+sLang+"/webext/fonts", "fonts", dVars, True) helpers.addFolderToZipAndFileFile(hZip, "gc_lang/"+sLang+"/webext/img", "img", dVars, True) helpers.addFolderToZipAndFileFile(hZip, "gc_lang/"+sLang+"/webext/panel", "panel", dVars, True) hZip.close() # Note about copying Thunderbird extension directly into the profile: # In Options > Configuration editor (about:config), deactivate option <xpinstall.whitelist.required> # If <manifest.json> is changed, you must reinstall the extension manually spExtension = dVars['win_tb_debug_extension_path'] if platform.system() == "Windows" else dVars['linux_tb_debug_extension_path'] if os.path.isdir(spExtension): file_util.copy_file(spfZip, f"{spExtension}/{dVars['tb_identifier']}.xpi") # Filename for TB is just <identifier.xpi> print(f"Thunderbird extension copied in <{spExtension}>") spExtension = dVars['win_tb_beta_extension_path'] if platform.system() == "Windows" else dVars['linux_tb_beta_extension_path'] if os.path.isdir(spExtension): file_util.copy_file(spfZip, f"{spExtension}/{dVars['tb_identifier']}.xpi") # Filename for TB is just <identifier.xpi> print(f"Thunderbird extension copied in <{spExtension}>") def _copyGrammalecteJSPackageInZipFile (hZip, sLang, sAddPath=""): for sf in os.listdir("grammalecte-js"): if not os.path.isdir("grammalecte-js/"+sf): hZip.write("grammalecte-js/"+sf, sAddPath+"grammalecte/"+sf) for sf in os.listdir("grammalecte-js/graphspell"): |
︙ | ︙ |
Modified gc_lang/fr/config.ini from [8f917f78e2] to [c9564324d8].
︙ | ︙ | |||
55 56 57 58 59 60 61 | # Thunderbird tb_identifier = French-GC-TB@grammalecte.net tb_name = Grammalecte [fr] win_tb_path = C:\Program Files\Mozilla Thunderbird\thunderbird.exe win_tb_beta_path = C:\Program Files\Thunderbird Daily\thunderbird.exe linux_tb_path = /usr/bin/thunderbird linux_tb_beta_path = /usr/bin/thunderbird | < | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | # Thunderbird tb_identifier = French-GC-TB@grammalecte.net tb_name = Grammalecte [fr] win_tb_path = C:\Program Files\Mozilla Thunderbird\thunderbird.exe win_tb_beta_path = C:\Program Files\Thunderbird Daily\thunderbird.exe linux_tb_path = /usr/bin/thunderbird linux_tb_beta_path = /usr/bin/thunderbird win_tb_debug_extension_path = D:\_temp\tb-debug.profile\extensions linux_tb_debug_extension_path = ~/tb-debug.profile/extensions win_tb_beta_extension_path = D:\_temp\tb-beta.profile\extensions linux_tb_beta_extension_path = ~/tb-beta.profile/extensions # Set Thunderbird folder in your PATH variable # Create a local profile: # thunderbird -CreateProfile "debug _build\tb-debug.profile" |
︙ | ︙ |
Deleted gc_lang/fr/mailext/README.txt version [e831050871].
|
| < < < < < < < < < < < < < < |
Modified gc_lang/fr/mailext/background.js from [84cc5ca0a0] to [f5c6b4e1ae].
1 2 3 4 | // Background "use strict"; | > > > > | > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | // Background /* jshint esversion:6, -W097 */ /* jslint esversion:6 */ /* global helpers, showError, Worker, chrome, console */ "use strict"; console.log("[Grammalecte] background"); // Chrome don’t follow the W3C specification: // https://browserext.github.io/browserext/ let bChrome = false; let bThunderbird = false; if (typeof(browser) !== "object") { var browser = chrome; bChrome = true; } if (typeof(messenger) === "object") { bThunderbird = true; } const oWorkerHandler = { xGCEWorker: null, nLastTimeWorkerResponse: 0, // milliseconds since 1970-01-01 oTask: {}, |
︙ | ︙ | |||
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | } } const oInitHandler = { initUIOptions: function () { browser.storage.local.get("ui_options").then(this._initUIOptions, showError); browser.storage.local.get("autorefresh_option").then(this._initUIOptions, showError); }, initGrammarChecker: function () { browser.storage.local.get("gc_options").then(this._initGrammarChecker, showError); browser.storage.local.get("personal_dictionary").then(this._setSpellingDictionaries, showError); browser.storage.local.get("community_dictionary").then(this._setSpellingDictionaries, showError); browser.storage.local.get("sc_options").then(this._initSCOptions, showError); }, _initUIOptions: function (oSavedOptions) { if (!oSavedOptions.hasOwnProperty("ui_options")) { browser.storage.local.set({"ui_options": { textarea: true, editablenode: true }}); | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | } } const oInitHandler = { initUIOptions: function () { if (bChrome) { browser.storage.local.get("ui_options", this._initUIOptions); browser.storage.local.get("autorefresh_option", this._initUIOptions); return; } browser.storage.local.get("ui_options").then(this._initUIOptions, showError); browser.storage.local.get("autorefresh_option").then(this._initUIOptions, showError); }, initGrammarChecker: function () { if (bChrome) { browser.storage.local.get("gc_options", this._initGrammarChecker); browser.storage.local.get("main_dic_name", this._setSpellingDictionaries); browser.storage.local.get("personal_dictionary", this._setSpellingDictionaries); browser.storage.local.get("community_dictionary", this._setSpellingDictionaries); browser.storage.local.get("oPersonalDictionary", this._setSpellingDictionaries); // deprecated browser.storage.local.get("sc_options", this._initSCOptions); return; } browser.storage.local.get("gc_options").then(this._initGrammarChecker, showError); browser.storage.local.get("main_dic_name", this._setSpellingDictionaries); browser.storage.local.get("personal_dictionary").then(this._setSpellingDictionaries, showError); browser.storage.local.get("community_dictionary").then(this._setSpellingDictionaries, showError); browser.storage.local.get("oPersonalDictionary").then(this._setSpellingDictionaries, showError); // deprecated browser.storage.local.get("sc_options").then(this._initSCOptions, showError); }, registerComposeScripts: async function () { // For Thunderbird only if (bThunderbird) { let xRegisteredScripts = await browser.composeScripts.register({ /*css: [ // Any number of code or file objects could be listed here. { code: "body { background-color: red; }" }, { file: "compose.css" }, ],*/ js: [ // Any number of code or file objects could be listed here. //{ code: `document.body.textContent = "Hey look, the script ran!";` }, { file: "content_scripts/html_src.js" }, { file: "content_scripts/panel.js" }, { file: "grammalecte/fr/textformatter.js" }, { file: "content_scripts/panel_tf.js" }, { file: "content_scripts/panel_gc.js" }, { file: "content_scripts/message_box.js" }, { file: "content_scripts/menu.js" }, { file: "content_scripts/init.js" } ] }); // To unregister scripts: // await xRegisteredScripts.unregister(); } }, _initUIOptions: function (oSavedOptions) { if (!oSavedOptions.hasOwnProperty("ui_options")) { browser.storage.local.set({"ui_options": { textarea: true, editablenode: true }}); |
︙ | ︙ | |||
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | catch (e) { console.log("initGrammarChecker failed"); showError(e); } }, _setSpellingDictionaries: function (oData) { if (oData.hasOwnProperty("community_dictionary")) { oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionary", oParam: { sDictionary: "community", oDict: oData["community_dictionary"] }, oInfo: {} }); } if (oData.hasOwnProperty("personal_dictionary")) { oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionary", oParam: { sDictionary: "personal", oDict: oData["personal_dictionary"] }, oInfo: {} }); } }, _initSCOptions: function (oData) { if (!oData.hasOwnProperty("sc_options")) { browser.storage.local.set({"sc_options": { community: true, personal: true }}); oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionaryOnOff", oParam: { sDictionary: "community", bActivate: true }, oInfo: {} }); oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionaryOnOff", oParam: { sDictionary: "personal", bActivate: true }, oInfo: {} }); } else { oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionaryOnOff", oParam: { sDictionary: "community", bActivate: oData.sc_options["community"] }, oInfo: {} }); oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionaryOnOff", oParam: { sDictionary: "personal", bActivate: oData.sc_options["personal"] }, oInfo: {} }); } | > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 | catch (e) { console.log("initGrammarChecker failed"); showError(e); } }, _setSpellingDictionaries: function (oData) { if (oData.hasOwnProperty("oPersonalDictionary")) { // deprecated (to be removed in 2020) console.log("personal dictionary migration"); browser.storage.local.set({ "personal_dictionary": oData["oPersonalDictionary"] }); oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionary", oParam: { sDictionary: "personal", oDict: oData["oPersonalDictionary"] }, oInfo: {} }); browser.storage.local.remove("oPersonalDictionary"); } if (oData.hasOwnProperty("main_dic_name")) { oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionary", oParam: { sDictionary: "main", oDict: oData["main_dic_name"] }, oInfo: {sExtPath: browser.extension.getURL("")} }); } if (oData.hasOwnProperty("community_dictionary")) { oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionary", oParam: { sDictionary: "community", oDict: oData["community_dictionary"] }, oInfo: {} }); } if (oData.hasOwnProperty("personal_dictionary")) { oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionary", oParam: { sDictionary: "personal", oDict: oData["personal_dictionary"] }, oInfo: {} }); } }, _initSCOptions: function (oData) { if (!oData.hasOwnProperty("sc_options")) { browser.storage.local.set({"sc_options": { community: true, personal: true }}); oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionaryOnOff", oParam: { sDictionary: "community", bActivate: true }, oInfo: {} }); oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionaryOnOff", oParam: { sDictionary: "personal", bActivate: true }, oInfo: {} }); } else { oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionaryOnOff", oParam: { sDictionary: "community", bActivate: oData.sc_options["community"] }, oInfo: {} }); oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionaryOnOff", oParam: { sDictionary: "personal", bActivate: oData.sc_options["personal"] }, oInfo: {} }); } }, } // start the Worker for the GC oWorkerHandler.start(); // init the options stuff and start the GC oInitHandler.initUIOptions(); oInitHandler.initGrammarChecker(); oInitHandler.registerComposeScripts(); // Thunderbird only // When the extension is installed or updated browser.runtime.onInstalled.addListener(function (oDetails) { // launched at installation or update // https://developer.mozilla.org/fr/Add-ons/WebExtensions/API/runtime/onInstalled if (oDetails.reason == "update" || oDetails.reason == "installed") { // todo //browser.tabs.create({url: "http://grammalecte.net"}); } }); /* Ports from content-scripts */ let dConnx = new Map(); /* Messages from the extension (not the Worker) */ function handleMessage (oRequest, xSender, sendResponse) { // message from panels //console.log(xSender); let {sCommand, oParam, oInfo} = oRequest; switch (sCommand) { case "getOptions": case "getDefaultOptions": case "setOptions": case "setOption": case "resetOptions": case "textToTest": case "fullTests": case "setDictionary": case "setDictionaryOnOff": oWorkerHandler.xGCEWorker.postMessage(oRequest); break; case "restartWorker": oWorkerHandler.restart(oParam["nDelayLimit"]); break; case "openURL": browser.tabs.create({url: oParam.sURL}); break; case "openConjugueurTab": openConjugueurTab(); break; case "openLexiconEditor": openLexiconEditor(oParam["dictionary"]); break; case "openDictionaries": openDictionaries(); break; default: console.log("[background] Unknown command: " + sCommand); console.log(oRequest); } //sendResponse({response: "response from background script"}); } browser.runtime.onMessage.addListener(handleMessage); function handleConnexion (xPort) { // Messages from tabs 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) { let {sCommand, oParam, oInfo} = oRequest; switch (sCommand) { case "ping": //console.log("[background] ping"); xPort.postMessage({sActionDone: "ping", result: null, bInfo: null, bEnd: true, bError: false}); break; case "parse": case "parseAndSpellcheck": case "parseAndSpellcheck1": case "parseFull": case "getListOfTokens": case "getSpellSuggestions": case "getVerb": oRequest.oInfo.iReturnPort = iPortId; // we pass the id of the return port to receive answer oWorkerHandler.xGCEWorker.postMessage(oRequest); break; case "restartWorker": oWorkerHandler.restart(oParam["nDelayLimit"]); break; case "openURL": browser.tabs.create({url: oParam.sURL}); break; case "openConjugueurTab": openConjugueurTab(); break; case "openConjugueurWindow": openConjugueurWindow(); break; case "openLexiconEditor": openLexiconEditor(); break; default: console.log("[background] Unknown command: " + sCommand); console.log(oRequest); } }); //xPort.postMessage({sActionDone: "newId", result: iPortId}); xPort.postMessage({sActionDone: "init", sUrl: browser.extension.getURL("")}); } browser.runtime.onConnect.addListener(handleConnexion); /* Context Menu (not for MailExtension) */ if (!bThunderbird) { // Analyze browser.contextMenus.create({ id: "grammar_checker_editable", title: "Analyser cette zone de texte", contexts: ["editable"] }); browser.contextMenus.create({ id: "grammar_checker_selection", title: "Analyser la sélection", contexts: ["selection"] }); browser.contextMenus.create({ id: "grammar_checker_iframe", title: "Analyser le contenu de ce cadre", contexts: ["frame"] }); browser.contextMenus.create({ id: "grammar_checker_page", title: "Analyser la page", contexts: ["all"] }); browser.contextMenus.create({ id: "separator_tools", type: "separator", contexts: ["all"] }); // Tools browser.contextMenus.create({ id: "conjugueur_tab", title: "Conjugueur [onglet]", contexts: ["all"] }); browser.contextMenus.create({ id: "conjugueur_window", title: "Conjugueur [fenêtre]", contexts: ["all"] }); //browser.contextMenus.create({ id: "dictionaries", title: "Dictionnaires", contexts: ["all"] }); browser.contextMenus.create({ id: "lexicon_editor", title: "Éditeur lexical", contexts: ["all"] }); 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 // confusing: no way to get the node where we click?! switch (xInfo.menuItemId) { // analyze case "grammar_checker_editable": case "grammar_checker_page": sendCommandToTab(xTab.id, xInfo.menuItemId); break; case "grammar_checker_iframe": sendCommandToTab(xTab.id, xInfo.menuItemId, xInfo.frameId); break; case "grammar_checker_selection": sendCommandToTab(xTab.id, xInfo.menuItemId, xInfo.selectionText); break; // tools case "conjugueur_window": openConjugueurWindow(); break; case "conjugueur_tab": openConjugueurTab(); break; case "lexicon_editor": openLexiconEditor(); break; case "dictionaries": openDictionaries(); break; default: console.log("[Background] Unknown menu id: " + xInfo.menuItemId); console.log(xInfo); console.log(xTab); } }); } /* Keyboard shortcuts */ browser.commands.onCommand.addListener(function (sCommand) { switch (sCommand) { case "grammar_checker": sendCommandToCurrentTab("shortcutGrammarChecker"); break; case "conjugueur_tab": openConjugueurTab(); break; case "lexicon_editor": openLexiconEditor(); break; case "dictionaries": openDictionaries(); break; } }); /* Tabs */ let nTabLexiconEditor = null; let nTabDictionaries = null; let nTabConjugueur = null; browser.tabs.onRemoved.addListener(function (nTabId, xRemoveInfo) { switch (nTabId) { case nTabLexiconEditor: nTabLexiconEditor = null; break; case nTabDictionaries: nTabDictionaries = null; break; case nTabConjugueur: nTabConjugueur = null; break; } }); /* Actions */ function storeGCOptions (dOptions) { if (dOptions instanceof Map) { dOptions = helpers.mapToObject(dOptions); } browser.storage.local.set({"gc_options": dOptions}); } function sendCommandToTab (iTab, sCommand, result=null) { let xTabPort = dConnx.get(iTab); xTabPort.postMessage({sActionDone: sCommand, result: result, oInfo: null, bEnd: false, bError: false}); } function sendCommandToCurrentTab (sCommand) { if (bChrome) { browser.tabs.query({ currentWindow: true, active: true }, (lTabs) => { for (let xTab of lTabs) { //console.log(xTab); browser.tabs.sendMessage(xTab.id, {sActionRequest: sCommand}); } }); return; } browser.tabs.query({ currentWindow: true, active: true }).then((lTabs) => { for (let xTab of lTabs) { //console.log(xTab); browser.tabs.sendMessage(xTab.id, {sActionRequest: sCommand}); } }, showError); } function sendCommandToAllTabs (sCommand) { for (let [iTab, xTabPort] of dConnx.entries()) { xTabPort.postMessage({sActionDone: sCommand, result: null, oInfo: null, bEnd: false, bError: false}); } } function openLexiconEditor (sName="__personal__") { if (nTabLexiconEditor === null) { if (bChrome) { browser.tabs.create({ url: browser.extension.getURL("panel/lex_editor.html") }, onLexiconEditorOpened); return; } let xLexEditor = browser.tabs.create({ url: browser.extension.getURL("panel/lex_editor.html") }); xLexEditor.then(onLexiconEditorOpened, showError); } else { browser.tabs.update(nTabLexiconEditor, {active: true}); } } function onLexiconEditorOpened (xTab) { nTabLexiconEditor = xTab.id; } function openDictionaries () { if (nTabDictionaries === null) { if (bChrome) { browser.tabs.create({ url: browser.extension.getURL("panel/dictionaries.html") }, onDictionariesOpened); return; } let xLexEditor = browser.tabs.create({ url: browser.extension.getURL("panel/dictionaries.html") }); xLexEditor.then(onDictionariesOpened, showError); } else { browser.tabs.update(nTabDictionaries, {active: true}); } } function onDictionariesOpened (xTab) { nTabDictionaries = xTab.id; } function openConjugueurTab () { if (nTabConjugueur === null) { if (bChrome) { browser.tabs.create({ url: browser.extension.getURL("panel/conjugueur.html") }, onConjugueurOpened); return; } let xConjTab = browser.tabs.create({ url: browser.extension.getURL("panel/conjugueur.html") }); xConjTab.then(onConjugueurOpened, showError); } else { browser.tabs.update(nTabConjugueur, {active: true}); } } function onConjugueurOpened (xTab) { nTabConjugueur = xTab.id; } function openConjugueurWindow () { if (bChrome) { browser.windows.create({ url: browser.extension.getURL("panel/conjugueur.html"), type: "popup", width: 710, height: 980 }); return; } let xConjWindow = browser.windows.create({ url: browser.extension.getURL("panel/conjugueur.html"), type: "popup", width: 710, height: 980 }); } function showError (e) { console.error(e); //console.error(e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message); } |
Deleted gc_lang/fr/mailext/gce_worker.js version [946a66a85a].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Modified gc_lang/fr/mailext/manifest.json from [e6c0d0d158] to [7d69dce83d].
︙ | ︙ | |||
21 22 23 24 25 26 27 | "48": "img/logo-48.png", "64": "img/logo-64.png", "80": "img/logo-80.png", "96": "img/logo-96.png" }, "browser_action": { "default_icon": "img/logo-32.png", | < > < | > | > > > > > > > > > > > > | > > > > > > > | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | "48": "img/logo-48.png", "64": "img/logo-64.png", "80": "img/logo-80.png", "96": "img/logo-96.png" }, "browser_action": { "default_icon": "img/logo-32.png", "default_title": "Grammalecte [fr]", "default_popup": "panel/main.html", "browser_style": false }, "compose_action": { "default_area": "maintoolbar", "default_icon": "img/logo-32.png", "default_title": "Analyser", "browser_style": false }, "background": { "scripts": [ "grammalecte/graphspell/helpers.js", "background.js" ] }, "commands": { "grammar_checker": { "suggested_key": { "default": "Ctrl+Shift+F" }, "description": "Ouvre le correcteur grammatical" }, "conjugueur_tab": { "suggested_key": { "default": "Ctrl+Shift+6" }, "description": "Ouvre le conjugueur" }, "lexicon_editor": { "suggested_key": { "default": "Ctrl+Shift+7" }, "description": "Ouvre l’éditeur lexical" } }, "permissions": [ "compose", "downloads", "storage" ] } |
Modified gc_lang/fr/webext/content_scripts/init.js from [acbd3c2f80] to [689258b9fa].
︙ | ︙ | |||
18 19 20 21 22 23 24 25 26 27 28 | // console can’t display error objects from content scripts console.error(e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message); } // Chrome don’t follow the W3C specification: // https://browserext.github.io/browserext/ let bChrome = false; if (typeof(browser) !== "object") { var browser = chrome; bChrome = true; } | > > > | | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | // console can’t display error objects from content scripts console.error(e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message); } // Chrome don’t follow the W3C specification: // https://browserext.github.io/browserext/ let bChrome = false; let bThunderbird = false; if (typeof(browser) !== "object") { var browser = chrome; bChrome = true; } if (typeof(messenger) === "object") { bThunderbird = true; } /* function loadImage (sContainerClass, sImagePath) { let xRequest = new XMLHttpRequest(); xRequest.open('GET', browser.extension.getURL("")+sImagePath, false); xRequest.responseType = "arraybuffer"; xRequest.send(); |
︙ | ︙ | |||
282 283 284 285 286 287 288 | const oGrammalecteBackgroundPort = { bConnected: false, xConnect: browser.runtime.connect({name: "content-script port"}), start: function () { | | | 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | const oGrammalecteBackgroundPort = { bConnected: false, xConnect: browser.runtime.connect({name: "content-script port"}), start: function () { console.log("[Grammalecte] background port: start."); this.listen(); this.listen2(); //this.ping(); }, restart: function () { console.log("[Grammalecte] try to reconnect to the background.") |
︙ | ︙ | |||
497 498 499 500 501 502 503 504 505 506 | } } oGrammalecteBackgroundPort.start(); /* Callable API for the webpage. | > > > > > > > > > > > > > > > > > > | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 | } } oGrammalecteBackgroundPort.start(); /* ComposeAction (Thunderbird only) */ if (bThunderbird) { console.log("Listen..."); try { browser.composeAction.onClicked.addListener(function (oTab, oData) { console.log("START"); oGrammalecte.startGCPanel("J'en aie mare..."); }); } catch (e) { showError(e) } console.log("Done."); } /* Callable API for the webpage. (Not for Thunderbird) */ if (!bThunderbird) { document.addEventListener("GrammalecteCall", function (xEvent) { // GrammalecteCall events are dispatched by functions in the API script // The script is loaded below. try { let oCommand = JSON.parse(xEvent.detail); switch (oCommand.sCommand) { case "openPanelForNode": if (oCommand.sNodeId && document.getElementById(oCommand.sNodeId)) { oGrammalecte.startGCPanel(document.getElementById(oCommand.sNodeId)); } break; case "openPanelForText": if (oCommand.sText) { if (oCommand.sText && oCommand.sNodeId && document.getElementById(oCommand.sNodeId)) { oGrammalecte.startGCPanel(oCommand.sText, document.getElementById(oCommand.sNodeId)); } else { oGrammalecte.startGCPanel(oCommand.sText); } } break; case "parseNode": if (oCommand.sNodeId && document.getElementById(oCommand.sNodeId)) { let xNode = document.getElementById(oCommand.sNodeId); if (xNode.tagName == "TEXTAREA" || xNode.tagName == "INPUT") { oGrammalecteBackgroundPort.parseAndSpellcheck(xNode.value, oCommand.sNodeId); } else if (xNode.tagName == "IFRAME") { oGrammalecteBackgroundPort.parseAndSpellcheck(xNode.contentWindow.document.body.innerText, oCommand.sNodeId); } else { oGrammalecteBackgroundPort.parseAndSpellcheck(xNode.innerText, oCommand.sNodeId); } } break; case "parseText": if (oCommand.sText && oCommand.sNodeId) { oGrammalecteBackgroundPort.parseAndSpellcheck(oCommand.sText, oCommand.sNodeId); } break; case "getSpellSuggestions": if (oCommand.sWord && oCommand.sDestination) { oGrammalecteBackgroundPort.getSpellSuggestions(oCommand.sWord, oCommand.sDestination, oCommand.sErrorId); } break; default: console.log("[Grammalecte] Event: Unknown command", oCommand.sCommand); } } catch (e) { showError(e); } }); // The API script must be injected this way to be callable by the page let xScriptGrammalecteAPI = document.createElement("script"); xScriptGrammalecteAPI.src = browser.extension.getURL("content_scripts/api.js"); document.documentElement.appendChild(xScriptGrammalecteAPI); } /* Note: Initialization starts when the background is connected. See: oGrammalecteBackgroundPort.listen() -> case "init" */ |
Modified helpers.py from [692e9d0564] to [793a89e669].
︙ | ︙ | |||
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | def copyAndFileTemplate (spfSrc, spfDst, dVars): "write file <spfSrc> as <spfDst> with variables filed with <dVars>" sText = Template(open(spfSrc, "r", encoding="utf-8").read()).safe_substitute(dVars) open(spfDst, "w", encoding="utf-8", newline="\n").write(sText) def addFolderToZipAndFileFile (hZip, spSrc, spDst, dVars, bRecursive): "add folder content to zip archive and file files with <dVars>" # recursive function spSrc = spSrc.strip("/ ") spDst = spDst.strip("/ ") for sf in os.listdir(spSrc): spfSrc = (spSrc + "/" + sf).strip("/ ") spfDst = (spDst + "/" + sf).strip("/ ") if os.path.isdir(spfSrc): if bRecursive: addFolderToZipAndFileFile(hZip, spfSrc, spfDst, dVars, bRecursive) else: | > > > > > > > < < < | | 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 | def copyAndFileTemplate (spfSrc, spfDst, dVars): "write file <spfSrc> as <spfDst> with variables filed with <dVars>" sText = Template(open(spfSrc, "r", encoding="utf-8").read()).safe_substitute(dVars) open(spfDst, "w", encoding="utf-8", newline="\n").write(sText) def addFileToZipAndFileFile (hZip, spfSrc, spfDst, dVars): if spfSrc.endswith((".py", ".js", ".json", ".html", ".htm", ".css", ".xcu", ".xul", ".rdf", ".dtd", ".properties")): hZip.writestr(spfDst, fileFile(spfSrc, dVars)) else: hZip.write(spfSrc, spfDst) def addFolderToZipAndFileFile (hZip, spSrc, spDst, dVars, bRecursive): "add folder content to zip archive and file files with <dVars>" # recursive function spSrc = spSrc.strip("/ ") spDst = spDst.strip("/ ") for sf in os.listdir(spSrc): spfSrc = (spSrc + "/" + sf).strip("/ ") spfDst = (spDst + "/" + sf).strip("/ ") if os.path.isdir(spfSrc): if bRecursive: addFolderToZipAndFileFile(hZip, spfSrc, spfDst, dVars, bRecursive) else: addFileToZipAndFileFile(hZip, spfSrc, spfDst, dVars) |