Changes In Branch mailext Through [53f7b50983] Excluding Merge-Ins
This is equivalent to a diff from 3d30d02ecf to 53f7b50983
2020-07-09
| ||
14:56 | [tb][fx] editor & text formatter: update for MailExtension check-in: 4553dac0b4 user: olr tags: tb, fx, mailext | |
13:07 | [tb][fx] adapt conjugueur to MailExtension -> no input allowed in compose scripts check-in: 53f7b50983 user: olr tags: tb, fx, mailext | |
2020-07-08
| ||
17:26 | [tb][fx] adjustement for Mail Extension: no event for input -> no autorefresh check-in: 081fa7f8ca user: olr tags: tb, fx, mailext | |
2020-07-04
| ||
10:23 | [fr] conf: tandis que, + phonet_simil: tandis / tendis / tendit check-in: ee8c478284 user: olr tags: trunk, fr | |
2020-07-02
| ||
12:23 | [tb] MailExtension for Thunderbird 78 check-in: 4c21586958 user: olr tags: tb, mailext | |
09:04 | [fr] faux positif et ajustements check-in: 3d30d02ecf user: olr tags: trunk, fr | |
2020-07-01
| ||
06:17 | [fr] ajustements check-in: f4c70b8022 user: olr tags: trunk, fr | |
Modified gc_lang/fr/build.py from [43a9cad18e] to [78914808d1].
︙ | ︙ | |||
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | from distutils import dir_util, file_util import helpers def build (sLang, dVars): "complementary build launched from make.py" createWebExtension(sLang, dVars) convertWebExtensionForChrome(sLang, dVars) createMailExtension(sLang, dVars) createNodeJSPackage(sLang) def createWebExtension (sLang, dVars): "create Web-extension" print("> Building WebExtension for Firefox") helpers.createCleanFolder("_build/webext/"+sLang) dir_util.copy_tree("gc_lang/"+sLang+"/webext/", "_build/webext/"+sLang) dir_util.copy_tree("grammalecte-js", "_build/webext/"+sLang+"/grammalecte") | > < | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | from distutils import dir_util, file_util import helpers def build (sLang, dVars): "complementary build launched from make.py" dVars['webextOptionsHTML'] = _createOptionsForWebExtension(dVars) createWebExtension(sLang, dVars) convertWebExtensionForChrome(sLang, dVars) createMailExtension(sLang, dVars) createNodeJSPackage(sLang) def createWebExtension (sLang, dVars): "create Web-extension" print("> Building WebExtension for Firefox") helpers.createCleanFolder("_build/webext/"+sLang) dir_util.copy_tree("gc_lang/"+sLang+"/webext/", "_build/webext/"+sLang) dir_util.copy_tree("grammalecte-js", "_build/webext/"+sLang+"/grammalecte") helpers.copyAndFileTemplate("_build/webext/"+sLang+"/manifest.json", "_build/webext/"+sLang+"/manifest.json", dVars) helpers.copyAndFileTemplate("_build/webext/"+sLang+"/panel/main.html", "_build/webext/"+sLang+"/panel/main.html", dVars) with helpers.CD("_build/webext/"+sLang): os.system("web-ext build") # Copy Firefox zip extension to _build helpers.moveFolderContent("_build/webext/"+sLang+"/web-ext-artifacts", "_build", "firefox-", True) |
︙ | ︙ | |||
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 102 | "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+"/mailext", "", dVars, True) helpers.addFileToZipAndFileFile(hZip, "gc_lang/"+sLang+"/webext/gce_worker.js", "gce_worker.js", dVars) helpers.addFileToZipAndFileFile(hZip, "gc_lang/"+sLang+"/webext/README.md", "README.md", dVars) 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 [2a80afd42c].
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 191 | } } 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/editor.js" }, { 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: {} }); } | > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 592 593 594 595 596 597 598 599 600 601 602 | 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"}); } }); /* 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); /* Ports from content-scripts */ let dConnx = new Map(); 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}); //console.log("[Grammalecte] init connection to content-script"); xPort.postMessage({sActionDone: "init", sUrl: browser.extension.getURL("")}); } browser.runtime.onConnect.addListener(handleConnexion); /* ComposeAction (Thunderbird only) */ if (bThunderbird) { browser.composeAction.onClicked.addListener(function (xTab, xData) { sendCommandToTab(xTab.id, "grammar_checker_compose_window"); }); } /* 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/chrome.manifest version [8b108fd6a7].
|
| < < < < < < < < < |
Deleted gc_lang/fr/mailext/content/about.css version [0c03b7bf9e].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted gc_lang/fr/mailext/content/about.js version [94f44e1159].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted gc_lang/fr/mailext/content/about.xul version [6f2fa2e063].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted gc_lang/fr/mailext/content/conjugueur.css version [c5ad386744].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted gc_lang/fr/mailext/content/conjugueur.js version [de46feffb0].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted gc_lang/fr/mailext/content/conjugueur.xul version [7d69e0ed2b].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted gc_lang/fr/mailext/content/gc_options.css version [c585d5d70e].
|
| < < < < < < < < < < < < < < < < < < |
Deleted gc_lang/fr/mailext/content/gc_options.js version [050fb882b6].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted gc_lang/fr/mailext/content/gc_options.xul version [2d497a7dd0].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted gc_lang/fr/mailext/content/options.css version [b5017553f4].
|
| < < < < < < < < < < < < |
Deleted gc_lang/fr/mailext/content/options.js version [9da0d898f3].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted gc_lang/fr/mailext/content/options.xul version [3943bf3117].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted gc_lang/fr/mailext/content/overlay.css version [680f0ace85].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted gc_lang/fr/mailext/content/overlay.js version [2bffe86e4e].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted gc_lang/fr/mailext/content/overlay.xul version [c9ae1732ec].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted gc_lang/fr/mailext/content/spell_options.css version [377d800f5a].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted gc_lang/fr/mailext/content/spell_options.js version [d5cdd1e710].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted gc_lang/fr/mailext/content/spell_options.xul version [abb535b915].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted gc_lang/fr/mailext/content/spellchecker.js version [ca575ac13b].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted gc_lang/fr/mailext/defaults/preferences/grammarchecker.js version [8769787af8].
|
| < < < < < < < < < < |
Deleted gc_lang/fr/mailext/gce_worker.js version [946a66a85a].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted gc_lang/fr/mailext/icon.png version [9598be5e3c].
cannot compute difference between binary files
Deleted gc_lang/fr/mailext/locale/en/about.dtd version [586b114cab].
|
| < < < < < < < |
Deleted gc_lang/fr/mailext/locale/en/gc_options.dtd version [6feaf76b9e].
|
| < < < < |
Deleted gc_lang/fr/mailext/locale/en/grammarchecker.properties version [ef0da976ea].
|
| < < < |
Deleted gc_lang/fr/mailext/locale/en/lex_editor.dtd version [d8b06fdebc].
|
| < < < < < < < < < < < < < < < < < |
Deleted gc_lang/fr/mailext/locale/en/options.dtd version [5fe56718ba].
|
| < < < < < < |
Deleted gc_lang/fr/mailext/locale/en/overlay.dtd version [1e54ceb89b].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted gc_lang/fr/mailext/locale/en/spell_options.dtd version [fc8174b93b].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted gc_lang/fr/mailext/locale/fr/about.dtd version [4705e2f2e0].
|
| < < < < < < < |
Deleted gc_lang/fr/mailext/locale/fr/gc_options.dtd version [aa14ca951b].
|
| < < < < |
Deleted gc_lang/fr/mailext/locale/fr/grammarchecker.properties version [e42689d6bb].
|
| < < < |
Deleted gc_lang/fr/mailext/locale/fr/lex_editor.dtd version [6b48b9e817].
|
| < < < < < < < < < < < < < < < < < < |
Deleted gc_lang/fr/mailext/locale/fr/options.dtd version [37a043f079].
|
| < < < < |
Deleted gc_lang/fr/mailext/locale/fr/overlay.dtd version [93a8ef80c4].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted gc_lang/fr/mailext/locale/fr/spell_options.dtd version [5ab4900b2b].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < |
Modified gc_lang/fr/mailext/manifest.json from [8fc810be06] to [57c89d52e2].
1 2 3 4 5 | { "manifest_version": 2, "applications": { "gecko": { "id": "${tb_identifier}", | | > > > > > > > > > > > > > > | > > > > > > | > > > > > > | > > > > > > > > > > > > > > > > > > > > > > | 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 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 68 69 | { "manifest_version": 2, "applications": { "gecko": { "id": "${tb_identifier}", "strict_min_version": "78.0a1" } }, "name": "${tb_name}", "short_name": "${tb_name}", "description": "${description}", "version": "${version}", "author": "${author}", "homepage_url": "${link}", "default_locale": "fr", "icons": { "16": "img/logo-16.png", "32": "img/logo-32.png", "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", "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": [ "activeTab", "compose", "downloads", "storage", "tabs" ] } |
Deleted gc_lang/fr/mailext/skin/Algoo_logo.png version [59954b3904].
cannot compute difference between binary files
Deleted gc_lang/fr/mailext/skin/LaMouette_small.png version [61c7247845].
cannot compute difference between binary files
Deleted gc_lang/fr/mailext/skin/grammarcheck.png version [9598be5e3c].
cannot compute difference between binary files
Deleted gc_lang/fr/mailext/skin/grammarcheck_disabled.png version [f900d73926].
cannot compute difference between binary files
Deleted gc_lang/fr/mailext/skin/grammarcheck_small.png version [dcb1bf8ae0].
cannot compute difference between binary files
Deleted gc_lang/fr/mailext/skin/grammarcheck_small_disabled.png version [502cc08b3e].
cannot compute difference between binary files
Deleted gc_lang/fr/mailext/skin/logo100.png version [137b3e197f].
cannot compute difference between binary files
Deleted gc_lang/fr/mailext/skin/logo120_text.png version [c438dd0680].
cannot compute difference between binary files
Deleted gc_lang/fr/mailext/worker/gce_worker.js version [abd0c9c4ba].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Added gc_lang/fr/webext/content_scripts/editor.js version [4bcac7be9b].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 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 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 102 103 104 105 106 107 108 109 110 111 112 113 114 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 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 191 192 193 194 195 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 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | // JavaScript // Editor for HTML page "use strict"; /* Editor for HTML page (Thunderbird or Iframe) */ class HTMLPageEditor { constructor (xDocument, bCheckSignature=false) { this.xDocument = xDocument; this.xRootNode = xDocument.body; //console.log(xDocument.body); //console.log(xDocument.body.innerHTML); this.lNode = []; this.bCheckSignature = bCheckSignature; this._lParsableNodes = ["P", "LI", "H1", "H2", "H3", "H4", "H5", "H6"]; this._lRootNodes = ["DIV", "UL", "OL"]; } * _getParsableNodes (xRootNode) { // recursive function try { for (let xNode of xRootNode.childNodes) { if (xNode.className !== "moz-cite-prefix" && xNode.tagName !== "BLOCKQUOTE" && (xNode.nodeType == Node.TEXT_NODE || (xNode.nodeType == Node.ELEMENT_NODE && !xNode.textContent.startsWith(">"))) && xNode.textContent !== "") { if (xNode.tagName === undefined) { if (!this.bCheckSignature && xNode.textContent.startsWith("-- ")) { break; } yield xNode; } else if (this._lParsableNodes.includes(xNode.tagName)) { yield xNode; } else if (this._lRootNodes.includes(xNode.tagName)) { yield* this._getParsableNodes(xNode); } } } } catch (e) { showError(e); } } * getParagraphs () { try { let i = 0; for (let xNode of this._getParsableNodes(this.xRootNode)) { this.lNode.push(xNode); yield [i, xNode.textContent]; i += 1; } } catch (e) { showError(e); } } getText () { try { let sPageText = ""; for (let [i, sLine] of this.getParagraphs()) { sPageText += sLine + "\n"; } return sPageText; } catch (e) { showError(e); } } getParagraph (iPara) { try { return this.lNode[iPara].textContent; } catch (e) { showError(e); } } setParagraph (iPara, sText) { try { return this.lNode[iPara].textContent = oGrammalecte.purgeText(sText); } catch (e) { showError(e); } } changeParagraph (iPara, sModif, iStart, iEnd) { let sText = this.getParagraph(iPara); this.writeParagraph(iPara, sText.slice(0, iStart) + sModif + sText.slice(iEnd)); } clear () { this.xDocument = null; this.xRootNode = null; this.lNode.length = 0; } } /* Editor for TextNode (Textarea or editable node) */ class TextNodeEditor { constructor (what, xResultNode=null) { this.xNode = null; this.dParagraph = new Map(); this.bTextArea = false; this.bIframe = false; this.bResultInEvent = false; // if true, the node content is not modified, but an event is dispatched on the node with the modified text this.xResultNode = null; // only useful for text analysed without node if (xResultNode instanceof HTMLElement) { this.xResultNode = xResultNode; this.bResultInEvent = true; } if (typeof(what) == "string") { // SIMPLE TEXT if (!this.xResultNode) { oGrammalecte.oGCPanel.addMessageToGCPanel("⛔ Aucun champ textuel défini. Les changements ne seront pas répercutés sur la zone d’où le texte a été extrait."); } this.loadText(sText); } else if (what.nodeType && what.nodeType === 1) { // NODE this.xNode = what; this.bResultInEvent = Boolean(this.xNode.dataset.grammalecte_result_via_event && this.xNode.dataset.grammalecte_result_via_event == "true"); this.bTextArea = (this.xNode.tagName == "TEXTAREA" || this.xNode.tagName == "INPUT"); this.bIframe = (this.xNode.tagName == "IFRAME"); if (this.bTextArea) { this.xNode.disabled = true; this.loadText(this.xNode.value); } else if (this.bIframe) { // iframe if (!this.bResultInEvent) { oGrammalecte.oGCPanel.addMessageToGCPanel("⛔ La zone analysée est un cadre contenant une autre page web (“iframe”). Les changements faits ne peuvent être pas répercutés dans cette zone."); } this.loadText(this.xNode.contentWindow.document.body.innerText); } else { // editable node oGrammalecte.oGCPanel.addMessageToGCPanel("❗ La zone de texte analysée est un champ textuel enrichi susceptible de contenir des éléments non textuels qui seront effacés lors de la correction."); this.loadText(this.xNode.innerText); } } } loadText (sText) { // function also used by the text formatter if (typeof(sText) === "string") { this.dParagraph.clear(); let i = 0; let iStart = 0; let iEnd = 0; sText = sText.replace(/\r\n/g, "\n").replace(/\r/g, "\n").normalize("NFC"); while ((iEnd = sText.indexOf("\n", iStart)) !== -1) { this.dParagraph.set(i, sText.slice(iStart, iEnd)); i++; iStart = iEnd+1; } this.dParagraph.set(i, sText.slice(iStart)); //console.log("Paragraphs number: " + (i+1)); } this.write(); } clear () { if (this.xNode !== null) { this.xNode.disabled = false; this.bTextArea = false; this.bIframe = false; this.bResultInEvent = false; this.xNode = null; this.xResultNode = null; } this.dParagraph.clear(); } getText () { return [...this.dParagraph.values()].join("\n").normalize("NFC"); } setParagraph (iParagraph, sText) { this.dParagraph.set(iParagraph, oGrammalecte.purgeText(sText)); this.write(); } getParagraph (iParaNum) { return this.dParagraph.get(iParaNum); } _eraseNodeContent () { while (this.xNode.firstChild) { this.xNode.removeChild(this.xNode.firstChild); } } write () { if (this.xNode !== null) { if (this.bResultInEvent) { const xEvent = new CustomEvent("GrammalecteResult", { detail: JSON.stringify({ sType: "text", sText: this.getText() }) }); this.xNode.dispatchEvent(xEvent); //console.log("[Grammalecte debug] Text sent to xNode via event:", xEvent.detail); } else if (this.bTextArea) { this.xNode.value = this.getText(); //console.log("[Grammalecte debug] text written in textarea:", this.getText()); } else if (this.bIframe) { //console.log(this.getText()); } else { this._eraseNodeContent(); this.dParagraph.forEach((val, key) => { this.xNode.appendChild(document.createTextNode(val.normalize("NFC"))); this.xNode.appendChild(document.createElement("br")); }); //console.log("[Grammalecte debug] text written in editable node:", this.getText()); } } else if (this.xResultNode !== null) { const xEvent = new CustomEvent("GrammalecteResult", { detail: JSON.stringify({ sType: "text", sText: this.getText() }) }); this.xResultNode.dispatchEvent(xEvent); //console.log("[Grammalecte debug] Text sent to xResultNode via event:", xEvent.detail); } } } |
Modified gc_lang/fr/webext/content_scripts/html_src.js from [33c5ac1d61] to [32b2f1f9e8].
︙ | ︙ | |||
9 10 11 12 13 14 15 | @Reviewers: This file only defines HTML nodes in const values */ const sGrammalecteConjugueurHTML = ` <div class="centered_bar"> | | | | | > | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | @Reviewers: This file only defines HTML nodes in const values */ const sGrammalecteConjugueurHTML = ` <div class="centered_bar"> <div contenteditable="true" id="grammalecte_conj_verb" autofocus >entrez un verbe</div> <div id="grammalecte_conj_button">Conjuguer</div> </div> <div class="grammalecte_clearer"></div> <h1 class="grammalecte_conj_title" id="grammalecte_conj_verb_title" class="center"> </h1> <div id="grammalecte_conj_verb_info" class="center"> </div> <div id="grammalecte_conj_options"> <div id="grammalecte_conj_oneg" class="grammalecte_conj_option_off" data-selected="off">Négation</div> · <div id="grammalecte_conj_oint" class="grammalecte_conj_option_off" data-selected="off">Interrogatif</div> · <div id="grammalecte_conj_ofem" class="grammalecte_conj_option_off" data-selected="off">Féminin</div> <br/> <div id="grammalecte_conj_opro" class="grammalecte_conj_option_off" data-selected="off">Pronominal</div> · <div id="grammalecte_conj_otco" class="grammalecte_conj_option_off" data-selected="off">Temps composés</div> </div> <div id="grammalecte_conj_note">❦</div> <!-- section 1 --> <div class="grammalecte_conj_container"> <div class="grammalecte_conj_column"> <div id="infinitif"> |
︙ | ︙ |
Modified gc_lang/fr/webext/content_scripts/init.js from [acbd3c2f80] to [1238d56b74].
︙ | ︙ | |||
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 40 41 42 43 | // 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" || browser.hasOwnProperty("composeAction")) { // JS sucks again. // In Thunderbird, <browser> exists in content-scripts, but not <messenger> // <browner> has property <composeAction> but is undefined... bThunderbird = true; //console.log("[Grammalecte] Thunderbird..."); } /* function loadImage (sContainerClass, sImagePath) { let xRequest = new XMLHttpRequest(); xRequest.open('GET', browser.extension.getURL("")+sImagePath, false); xRequest.responseType = "arraybuffer"; xRequest.send(); |
︙ | ︙ | |||
59 60 61 62 63 64 65 | xObserver: null, sExtensionUrl: null, oOptions: null, | | | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | xObserver: null, sExtensionUrl: null, oOptions: null, bAutoRefresh: (bThunderbird) ? false : true, listen: function () { document.addEventListener("click", (xEvent) => { //console.log("click", xEvent.target.id); this.oPanelButton.examineNode(xEvent.target); }); document.addEventListener("keyup", (xEvent) => { |
︙ | ︙ | |||
134 135 136 137 138 139 140 141 142 143 144 145 146 147 | let sPageText = document.body.innerText; let nPos = sPageText.indexOf("__grammalecte_panel__"); if (nPos >= 0) { sPageText = sPageText.slice(0, nPos).normalize("NFC"); } return sPageText; }, createNode: function (sType, oAttr, oDataset=null) { try { let xNode = document.createElement(sType); Object.assign(xNode, oAttr); if (oDataset) { Object.assign(xNode.dataset, oDataset); | > > > > | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | let sPageText = document.body.innerText; let nPos = sPageText.indexOf("__grammalecte_panel__"); if (nPos >= 0) { sPageText = sPageText.slice(0, nPos).normalize("NFC"); } return sPageText; }, purgeText: function (sText) { return sText.replace(/ /g, " ").replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&"); }, createNode: function (sType, oAttr, oDataset=null) { try { let xNode = document.createElement(sType); Object.assign(xNode, oAttr); if (oDataset) { Object.assign(xNode.dataset, oDataset); |
︙ | ︙ | |||
257 258 259 260 261 262 263 264 265 266 267 268 269 270 | return { top: Math.round(top), left: Math.round(left), bottom: Math.round(bottom), right: Math.round(right) }; } }; function autoRefreshOption (oSavedOptions=null) { // auto recallable function if (oSavedOptions === null) { if (bChrome) { browser.storage.local.get("autorefresh_option", autoRefreshOption); return; } browser.storage.local.get("autorefresh_option").then(autoRefreshOption, showError); } | > > > | 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | return { top: Math.round(top), left: Math.round(left), bottom: Math.round(bottom), right: Math.round(right) }; } }; function autoRefreshOption (oSavedOptions=null) { // auto recallable function if (bThunderbird) { return; } if (oSavedOptions === null) { if (bChrome) { browser.storage.local.get("autorefresh_option", autoRefreshOption); return; } browser.storage.local.get("autorefresh_option").then(autoRefreshOption, showError); } |
︙ | ︙ | |||
282 283 284 285 286 287 288 | const oGrammalecteBackgroundPort = { bConnected: false, xConnect: browser.runtime.connect({name: "content-script port"}), start: function () { | | | 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | 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.") |
︙ | ︙ | |||
374 375 376 377 378 379 380 381 382 383 384 385 386 387 | this.bConnected = false; this.restart(); }.bind(this)); this.xConnect.onMessage.addListener(function (oMessage) { let { sActionDone, result, oInfo, bEnd, bError } = oMessage; switch (sActionDone) { case "init": this.bConnected = true; oGrammalecte.sExtensionUrl = oMessage.sUrl; oGrammalecte.listen(); oGrammalecte.createButton(); break; case "ping": console.log("[Grammalecte] Connection to background done."); | > | 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | this.bConnected = false; this.restart(); }.bind(this)); this.xConnect.onMessage.addListener(function (oMessage) { let { sActionDone, result, oInfo, bEnd, bError } = oMessage; switch (sActionDone) { case "init": //console.log("[Grammalecte] content-script: init"); this.bConnected = true; oGrammalecte.sExtensionUrl = oMessage.sUrl; oGrammalecte.listen(); oGrammalecte.createButton(); break; case "ping": console.log("[Grammalecte] Connection to background done."); |
︙ | ︙ | |||
462 463 464 465 466 467 468 469 470 471 472 473 474 475 | if (document.activeElement.tagName == "IFRAME") { //console.log(document.activeElement.id); frameId given by result is different than frame.id oGrammalecte.startGCPanel(document.activeElement); } else { oGrammalecte.showMessage("Erreur. Le cadre sur lequel vous avez cliqué n’a pas pu être identifié. Sélectionnez le texte à corriger et relancez le correcteur via le menu contextuel."); } break; default: console.log("[Grammalecte] Content-script. Unknown command: ", sActionDone); } }.bind(this)); }, /* | > > > > > > > | 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | if (document.activeElement.tagName == "IFRAME") { //console.log(document.activeElement.id); frameId given by result is different than frame.id oGrammalecte.startGCPanel(document.activeElement); } else { oGrammalecte.showMessage("Erreur. Le cadre sur lequel vous avez cliqué n’a pas pu être identifié. Sélectionnez le texte à corriger et relancez le correcteur via le menu contextuel."); } break; /* composeAction (Thunderbird only) */ case "grammar_checker_compose_window": oGrammalecte.startGCPanel("__ThunderbirdComposeWindow__"); break; default: console.log("[Grammalecte] Content-script. Unknown command: ", sActionDone); } }.bind(this)); }, /* |
︙ | ︙ | |||
500 501 502 503 504 505 506 | oGrammalecteBackgroundPort.start(); /* Callable API for the webpage. | | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | 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 597 | oGrammalecteBackgroundPort.start(); /* 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 gc_lang/fr/webext/content_scripts/panel.js from [647c8a603c] to [d95f7c1664].
︙ | ︙ | |||
191 192 193 194 195 196 197 | setSizeAndPosition () { // size if (this.xWidthButton && this.xHeightButton) { this.xWidthButton.style.opacity = (this.bHorizStrech) ? ".9" : ""; this.xHeightButton.style.opacity = (this.bVertStrech) ? ".9" : ""; } let nWidth = Math.min(this.nWidth, window.innerWidth-200); | | | | 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | setSizeAndPosition () { // size if (this.xWidthButton && this.xHeightButton) { this.xWidthButton.style.opacity = (this.bHorizStrech) ? ".9" : ""; this.xHeightButton.style.opacity = (this.bVertStrech) ? ".9" : ""; } let nWidth = Math.min(this.nWidth, window.innerWidth-200); let nHeight = Math.min(this.nHeight, window.innerHeight-50); if (this.bFlexible) { // width if (this.bHorizStrech) { nWidth = Math.min(this.nWidth*1.33, window.innerWidth-200); } // height nHeight = ([4, 5, 6].includes(this.nPosition)) ? nHeight : Math.floor(window.innerHeight*0.45); if (this.bVertStrech) { nHeight = ([4, 5, 6].includes(this.nPosition)) ? (window.innerHeight-50) : Math.floor(window.innerHeight*0.67); } } this.xPanel.style.width = `${nWidth}px`; this.xPanel.style.height = `${nHeight}px`; // position let oPos = null; switch (this.nPosition) { |
︙ | ︙ |
Modified gc_lang/fr/webext/content_scripts/panel_conj.css from [e61b4b58d2] to [ec0b4594f9].
︙ | ︙ | |||
56 57 58 59 60 61 62 | div.grammalecte_conj_column { width: 50%; padding: 0 10px; font-size: 12px; } | | | | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | div.grammalecte_conj_column { width: 50%; padding: 0 10px; font-size: 12px; } div#grammalecte_conj_verb { display: inline-block; width: 230px; margin-left: 5px; padding: 5px 10px; border: 2px solid hsl(0, 0%, 80%); border-radius: 3px; height: 20px; background: transparent; font: normal 18px Tahoma, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif; color: hsl(0, 0%, 30%); } div#grammalecte_conj_verb { color: hsl(0, 0%, 70%); } div#grammalecte_conj_button { display: inline-block; padding: 7px 10px; font-size: 18px; |
︙ | ︙ | |||
95 96 97 98 99 100 101 102 103 104 105 106 107 108 | } div#grammalecte_conj_options { margin: 10px 0 0 5px; font-size: 16px; text-align: center; } div#grammalecte_conj_note { margin: 10px 20px; font-size: 11px; color: hsl(0, 0%, 60%); text-align: center; } | > > > > > > > > > > > > > > > > > > > | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | } div#grammalecte_conj_options { margin: 10px 0 0 5px; font-size: 16px; text-align: center; } div.grammalecte_conj_option_off { display: inline-block; margin: 2px; background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsIAAA7CARUoSoAAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMTczbp9jAAADGUlEQVQ4T2P4//8/VTFWQUowggEEQJoRiJlB/BfPn6vMbmrp6AqPOdUeGPa4Iyj8cbN/0Kn5HV0db169UoHqA6kF6UGYg8QBSYAw09SKqtoaTYMvtfLq/5t5xf+1MTD9B+FGIZl/ILEaZe2vs5pba0FqkfRhNZChzNx6RYOU0v96Nb3/tWLyH6aVlC8+vHNX8Yn9B4on5RctrpFQ/FCnZfi/hUvsf7W714q3b9/C9YIwsoEMNaERdQ1aRv9rZFX/13r7bH729KkQVA7uirdv3gjVefpsrjez+d8gLPO/PSOzDqoGjOGMnVu3qtcZWryrU9T+3x0Tv+HFy5cMZ44d99+ydm0oTM38SZNDN61e4w9il+qabGgytftfzy34bsGcOeowNXAD8/kl2hpMrP7X8wm/b6mtFQFpbGZg+NfCwPRn5cJFDlPaOxwaROX+tLAL/ls4fYb/vbt3RWo1Dd7XA4Nn87LlbRgGlptbH28QV/o/rbxy6dt37xgak1PqmwQk/zdYO/yrkZD9WCsm/bHO2PIfMJL+d+fk13/79o0hX151aYOS9v8paZnHMQysNDZ/1Cgq939KTW0ZTGxKfUN+rZTy/zoLuz9Aw/7U6Br/7y0uzQfJ/fz5kyFHWKKsUdvof4uX3yOYHkwDa+vgBq5YsNClAeiiekvbP7UGZn/q9Ez+z504yQUk9wNoYJYIHgPBXgaGx+TCkiUg/qye3sgGAalf9daO/4Cu/FOrqgMy9B9IbNnsOZE/fvwAeXlJnYoOdi+DIqXRyPI/MLw+5GdmCk5raSkFJeZmLpH/faVl+eWhkfl1ihqgxP2/JSOr9O6dO4I12kYfcEYKPNnIa/3vT0rdcOnKFYYlU6bVTCwugStuTkppm1hVXfP6zRuGIgMCyQaE4QlbWvl/Q2Dwxtu3bvFB5eAJG5hc+Bp8AzY2ABN2k4A07oQNxGANkKyn8h8YZqAc8356eeXiQzt2Fp/Yt78YlA1rFTXfA9MfLOutxJf1YK6AFw71Mir/m5AKB2C6/AcSAxUOwJKIYOEAM5RqxRdVMFZB8vF/BgAKMNpeW+niqQAAAABJRU5ErkJggg==') no-repeat; background-color: none; padding: 0 3px 0 22px ; border-radius: 3px; cursor: pointer; } div.grammalecte_conj_option_on { display: inline-block; margin: 2px; background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAOwQAADsEBuJFr7QAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xNzNun2MAAAMnSURBVDhPY/j//z9VMVZBSjC6ACMQM4PYz1+8UGmaPrsjvL7rVGB1++Oguo7H/pXNpzpmz+949eaNClQ9SC1ID9wMOAOIQRIgzFQxYWqtZk7NF/ms2v+8mc3/GAra/oOwUE7jP5CYcnbN1+aps2pBapH0YTWQwTyrbIVUVsN/rdy6/9KZNe8qJk5fsOvQkeL9x04UF/RMWSAPFAPJcWW1/HcvqF7x9u1buF4QRjaQIbS0pk6rsOG/ItAVLgXVG2/duSMOlYO74v7DR+JuBTVbDPPr/wvnNvzPaGqvg6oBYzhj686d6vq59e/Uc2r/B1U1r3v69ClMjgUNg7zJ4JBbsdK8qPE/d079uznzF6iDxEAYbiB/TH6bGdB1LFnNb3smTZaDioMMgKmBuZJtwtyFZcUNLYb62VWPpHLr/y/buLkNpg6mmME8p/y4PDBssjsmLIKKsQIxcqCDY9+/sGIab07Lf9XUssP66SUbFLPq/qf1TDkBkgNhuIHGOZWPhDIa/zdMnl4O4n/89AmUNPig8mCX+hdWz1AGWmpS0PhfOLF0oWZsVo0GMBw9K1oeQ9UhDDTMrHwkmtX4v6pvYv7xkyflGMqaP/oXV6/89esXWD6gsHKmcnbtf1AY+5Q3r9+0aRODXFhaiVYe2MBHGAYaZZUdNyhu+q+ZkD2ZNb6iTqOg4b9MZv3/6KrG2S6ZBRNVgC7Tyav7b5Zdufr3nz9sv4EWySTmLwaJA718HMNA4ficNsOihv8qOVVvI5PTxFNae6eL5jX+18yt/QM06C/IMAugYe8/fAB7//bde/LAxP9WCmgp1kgBJRvDvLp38sBATmzpXbt582aGhMauuaBYBLnCOLNiPTBcQRHFAAoGrZTidXiTDQiDEzYwTMSAhkbVtW6Yt3ART3Rd63xguoTFPMPd+/clPIvrNoKSGN6EDcTgnADKejJAV4EiwCi35iXQlQuXrN9UcuTM2fyCvimLZDNr3iJlvZX4sh4svTFV9E+pBYbdF4mc+v9AL//jym3+z1Dc+l8st46kwgFmKErxFVbXcdqvpv1JQE0nycUXVTBWQfLxfwYA8YUHpiMfZa8AAAAASUVORK5CYII=') no-repeat; background-color: hsla(120, 50%, 50%, .2); padding: 0 3px 0 22px; border-radius: 3px; cursor: pointer; } div#grammalecte_conj_note { margin: 10px 20px; font-size: 11px; color: hsl(0, 0%, 60%); text-align: center; } |
Modified gc_lang/fr/webext/content_scripts/panel_gc.js from [2282aa660c] to [505aead2d8].
︙ | ︙ | |||
55 56 57 58 59 60 61 | // Editor this.xGCPanelContent = oGrammalecte.createNode("div", {id: "grammalecte_gc_panel_content"}); this.xParagraphList = oGrammalecte.createNode("div", {id: "grammalecte_paragraph_list"}); this.xGCPanelContent.appendChild(this.xParagraphList); this.xPanelContent.addEventListener("click", onGrammalecteGCPanelClick, false); this.oTooltip = new GrammalecteTooltip(this.xParent, this.xGCPanelContent); this.xPanelContent.appendChild(this.xGCPanelContent); | < | | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | // Editor this.xGCPanelContent = oGrammalecte.createNode("div", {id: "grammalecte_gc_panel_content"}); this.xParagraphList = oGrammalecte.createNode("div", {id: "grammalecte_paragraph_list"}); this.xGCPanelContent.appendChild(this.xParagraphList); this.xPanelContent.addEventListener("click", onGrammalecteGCPanelClick, false); this.oTooltip = new GrammalecteTooltip(this.xParent, this.xGCPanelContent); this.xPanelContent.appendChild(this.xGCPanelContent); this.oTextControl = null; this.nLastResult = 0; this.iLastEditedParagraph = -1; // Lexicographer this.nLxgCount = 0; this.xLxgPanelContent = oGrammalecte.createNode("div", {id: "grammalecte_lxg_panel_content"}); this.xPanelContent.appendChild(this.xLxgPanelContent); // Conjugueur |
︙ | ︙ | |||
98 99 100 101 102 103 104 105 106 107 108 109 110 111 | }; this.xEditorButton.onclick = () => { if (!this.bWorking) { this.showEditor(); } }; this.xAutoRefresh.onclick = () => { this.bAutoRefresh = !this.bAutoRefresh; oGrammalecte.bAutoRefresh = this.bAutoRefresh; browser.storage.local.set({"autorefresh_option": this.bAutoRefresh}); this.setAutoRefreshButton(); } this.xLxgButton.onclick = () => { if (!this.bWorking) { | > > > > | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | }; this.xEditorButton.onclick = () => { if (!this.bWorking) { this.showEditor(); } }; this.xAutoRefresh.onclick = () => { if (bThunderbird) { oGrammalecte.showMessage("À cause d’une limitation de Thunberbird, l’auto-rafraîchissement est indisponible. Si vous modifiez le texte dans ce panneau, cliquez sur le bouton ↻ pour relancer l’analyse grammaticale du paragraphe.") return; } this.bAutoRefresh = !this.bAutoRefresh; oGrammalecte.bAutoRefresh = this.bAutoRefresh; browser.storage.local.set({"autorefresh_option": this.bAutoRefresh}); this.setAutoRefreshButton(); } this.xLxgButton.onclick = () => { if (!this.bWorking) { |
︙ | ︙ | |||
134 135 136 137 138 139 140 | start (what, xResultNode=null) { this.oTooltip.hide(); this.bWorking = false; this.clear(); this.hideMessage(); this.resetTimer(); | | | < < | | | < | | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | start (what, xResultNode=null) { this.oTooltip.hide(); this.bWorking = false; this.clear(); this.hideMessage(); this.resetTimer(); if (typeof(what) === "string" && what === "__ThunderbirdComposeWindow__") { // Thunderbird compose window this.oTextControl = new HTMLPageEditor(document); } else if (typeof(what) === "string" || (what.nodeType && what.nodeType === 1)) { // Text or node this.oTextControl = new TextNodeEditor(what, xResultNode); } else { // error oGrammalecte.oMessageBox.showMessage("[BUG] Analyse d’un élément inconnu…"); console.log("[Grammalecte] Unknown element:", what); } } |
︙ | ︙ | |||
240 241 242 243 244 245 246 | if (this.bAutoRefresh) { // timer for refreshing analysis window.clearTimeout(parseInt(xParagraph.dataset.timer_id, 10)); xParagraph.dataset.timer_id = window.setTimeout(this.recheckParagraph.bind(this), 3000, oResult.iParaNum); this.iLastEditedParagraph = oResult.iParaNum; } // write text | | < | 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | if (this.bAutoRefresh) { // timer for refreshing analysis window.clearTimeout(parseInt(xParagraph.dataset.timer_id, 10)); xParagraph.dataset.timer_id = window.setTimeout(this.recheckParagraph.bind(this), 3000, oResult.iParaNum); this.iLastEditedParagraph = oResult.iParaNum; } // write text this.oTextControl.setParagraph(parseInt(xEvent.target.dataset.para_num, 10), xEvent.target.textContent); }.bind(this) , true); this._tagParagraph(xParagraph, oResult.sParagraph, oResult.iParaNum, oResult.aGrammErr, oResult.aSpellErr); // creation xNodeDiv.appendChild(xActionsBar); xNodeDiv.appendChild(xParagraph); this.xParagraphList.appendChild(xNodeDiv); |
︙ | ︙ | |||
279 280 281 282 283 284 285 | recheckParagraph (iParaNum) { if (!this.bOpened) { return; } let sParagraphId = "grammalecte_paragraph" + iParaNum; let xParagraph = this.xParent.getElementById(sParagraphId); this._blockParagraph(xParagraph); | > > | > | 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | recheckParagraph (iParaNum) { if (!this.bOpened) { return; } let sParagraphId = "grammalecte_paragraph" + iParaNum; let xParagraph = this.xParent.getElementById(sParagraphId); this._blockParagraph(xParagraph); if (bThunderbird) { // WORKAROUND: input event isn’t triggered by key input, so as textContent isn’t up to date, we do it now this.oTextControl.setParagraph(iParaNum, xParagraph.textContent); } let sText = this.oTextControl.getParagraph(iParaNum); oGrammalecteBackgroundPort.parseAndSpellcheck1(sText, "__GrammalectePanel__", sParagraphId); } refreshParagraph (sParagraphId, oResult) { // function called when results are sent by the Worker if (!this.bOpened) { |
︙ | ︙ | |||
410 411 412 413 414 415 416 | let sErrorId = this.xParent.getElementById(sNodeSuggId).dataset.error_id; //let sParaNum = sErrorId.slice(0, sErrorId.indexOf("-")); let xNodeErr = this.xParent.getElementById("grammalecte_err" + sErrorId); xNodeErr.textContent = this.xParent.getElementById(sNodeSuggId).textContent; xNodeErr.className = "grammalecte_error_corrected"; xNodeErr.removeAttribute("style"); let iParaNum = parseInt(sErrorId.slice(0, sErrorId.indexOf("-")), 10); | | < | 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | let sErrorId = this.xParent.getElementById(sNodeSuggId).dataset.error_id; //let sParaNum = sErrorId.slice(0, sErrorId.indexOf("-")); let xNodeErr = this.xParent.getElementById("grammalecte_err" + sErrorId); xNodeErr.textContent = this.xParent.getElementById(sNodeSuggId).textContent; xNodeErr.className = "grammalecte_error_corrected"; xNodeErr.removeAttribute("style"); let iParaNum = parseInt(sErrorId.slice(0, sErrorId.indexOf("-")), 10); this.oTextControl.setParagraph(iParaNum, this.xParent.getElementById("grammalecte_paragraph" + iParaNum).textContent); this.oTooltip.hide(); this.recheckParagraph(iParaNum); this.iLastEditedParagraph = iParaNum; } catch (e) { showError(e); } |
︙ | ︙ | |||
435 436 437 438 439 440 441 | this.oTooltip.hide(); } catch (e) { showError(e); } } | < < < < | 436 437 438 439 440 441 442 443 444 445 446 447 448 449 | this.oTooltip.hide(); } catch (e) { showError(e); } } addSummary () { // todo } addMessageToGCPanel (sMessage) { let xNode = oGrammalecte.createNode("div", {className: "grammalecte_panel_flow_message", textContent: sMessage}); this.xParagraphList.appendChild(xNode); |
︙ | ︙ | |||
475 476 477 478 479 480 481 | // Firefox 63+, Chrome 66+ // Working draft: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard navigator.clipboard.writeText(sText) .then( (res) => { window.setTimeout(() => { this.xClipboardButton.textContent = "📋"; }, 2000); } ) .catch( | | | 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 | // Firefox 63+, Chrome 66+ // Working draft: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard navigator.clipboard.writeText(sText) .then( (res) => { window.setTimeout(() => { this.xClipboardButton.textContent = "📋"; }, 2000); } ) .catch( (e) => { showError(e); this._sendTextToClipboard(sText); } ); } else { this._sendTextToClipboardFallback(sText); } } _sendTextToClipboardFallback (sText) { |
︙ | ︙ | |||
498 499 500 501 502 503 504 | xEvent.clipboardData.setData("text/plain", sText); } document.addEventListener("copy", setClipboardData, true); document.execCommand("copy"); window.setTimeout(() => { this.xClipboardButton.textContent = "📋"; }, 2000); } catch (e) { | | | 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 | xEvent.clipboardData.setData("text/plain", sText); } document.addEventListener("copy", setClipboardData, true); document.execCommand("copy"); window.setTimeout(() => { this.xClipboardButton.textContent = "📋"; }, 2000); } catch (e) { showError(e); } } // Lexicographer clearLexicographer () { this.nLxgCount = 0; |
︙ | ︙ | |||
592 593 594 595 596 597 598 | listenConj () { if (!this.bListenConj) { // button this.xParent.getElementById('grammalecte_conj_button').addEventListener("click", (e) => { this.conjugateVerb(); }); // text field this.xParent.getElementById('grammalecte_conj_verb').addEventListener("change", (e) => { this.conjugateVerb(); }); // options | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | > | | | | | | | | | | | | | | | < | | < | < | < < | | < | | | < | | 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 | listenConj () { if (!this.bListenConj) { // button this.xParent.getElementById('grammalecte_conj_button').addEventListener("click", (e) => { this.conjugateVerb(); }); // text field this.xParent.getElementById('grammalecte_conj_verb').addEventListener("change", (e) => { this.conjugateVerb(); }); // options this.xParent.getElementById('grammalecte_conj_oneg').addEventListener("click", (e) => { this.switchOption('grammalecte_conj_oneg'); this.updateConj(); }); this.xParent.getElementById('grammalecte_conj_opro').addEventListener("click", (e) => { this.switchOption('grammalecte_conj_opro'); this.updateConj(); }); this.xParent.getElementById('grammalecte_conj_oint').addEventListener("click", (e) => { this.switchOption('grammalecte_conj_oint'); this.updateConj(); }); this.xParent.getElementById('grammalecte_conj_ofem').addEventListener("click", (e) => { this.switchOption('grammalecte_conj_ofem'); this.updateConj(); }); this.xParent.getElementById('grammalecte_conj_otco').addEventListener("click", (e) => { this.switchOption('grammalecte_conj_otco'); this.updateConj(); }); this.bListenConj = true; } } purgeInputText () { // Thunderbird don’t accept input fields // So we use editable node and we purge it let sVerb = this.xParent.getElementById('grammalecte_conj_verb').innerText; let nIndexCut = sVerb.indexOf("\n"); if (nIndexCut != -1) { sVerb = sVerb.slice(0, nIndexCut); }; this.xParent.getElementById('grammalecte_conj_verb').textContent = sVerb.trim(); } switchOption (sOption) { if (this.xParent.getElementById(sOption).dataset.disabled == "off") { this.xParent.getElementById(sOption).dataset.selected = (this.xParent.getElementById(sOption).dataset.selected == "off") ? "on" : "off"; this.xParent.getElementById(sOption).className = (this.xParent.getElementById(sOption).dataset.selected == "on") ? "grammalecte_conj_option_on" : "grammalecte_conj_option_off"; } } resetOption (sOption) { this.xParent.getElementById(sOption).dataset.selected = "off"; this.xParent.getElementById(sOption).dataset.disabled = "off"; this.xParent.getElementById(sOption).style.color = ""; this.xParent.getElementById(sOption).className = "grammalecte_conj_option_off"; } selectOption (sOption) { this.xParent.getElementById(sOption).dataset.selected = "on"; this.xParent.getElementById(sOption).className = "grammalecte_conj_option_on"; } unselectOption (sOption) { this.xParent.getElementById(sOption).dataset.selected = "off"; this.xParent.getElementById(sOption).className = "grammalecte_conj_option_off"; } enableOption (sOption) { this.xParent.getElementById(sOption).dataset.disabled = "off"; this.xParent.getElementById(sOption).style.color = ""; } disableOption (sOption) { this.xParent.getElementById(sOption).dataset.disabled = "on"; this.xParent.getElementById(sOption).style.color = "#CCC"; } conjugateVerb (sVerb="") { try { if (!sVerb) { this.purgeInputText(); sVerb = this.xParent.getElementById('grammalecte_conj_verb').textContent; } this.resetOption('grammalecte_conj_oneg'); this.resetOption('grammalecte_conj_opro'); this.resetOption('grammalecte_conj_oint'); this.resetOption('grammalecte_conj_otco'); this.resetOption('grammalecte_conj_ofem'); // request analyzing sVerb = sVerb.trim().toLowerCase().replace(/’/g, "'").replace(/ +/g, " "); if (sVerb) { if (sVerb.startsWith("ne pas ")) { this.selectOption('grammalecte_conj_oneg'); sVerb = sVerb.slice(7).trim(); } if (sVerb.startsWith("se ")) { this.selectOption('grammalecte_conj_opro'); sVerb = sVerb.slice(3).trim(); } else if (sVerb.startsWith("s'")) { this.selectOption('grammalecte_conj_opro'); sVerb = sVerb.slice(2).trim(); } if (sVerb.endsWith("?")) { this.selectOption('grammalecte_conj_oint'); sVerb = sVerb.slice(0,-1).trim(); } if (sVerb) { this.sVerb = sVerb; this.updateConj(true); } else { this.xParent.getElementById('grammalecte_conj_verb').textContent = ""; } } } catch (e) { showError(e); } } updateConj (bStart=false) { let bPro = this.xParent.getElementById('grammalecte_conj_opro').dataset.selected == "on"; let bNeg = this.xParent.getElementById('grammalecte_conj_oneg').dataset.selected == "on"; let bTpsCo = this.xParent.getElementById('grammalecte_conj_otco').dataset.selected == "on"; let bInt = this.xParent.getElementById('grammalecte_conj_oint').dataset.selected == "on"; let bFem = this.xParent.getElementById('grammalecte_conj_ofem').dataset.selected == "on"; if (this.sVerb) { oGrammalecteBackgroundPort.getVerb(this.sVerb, bStart, bPro, bNeg, bTpsCo, bInt, bFem); } } conjugateWith (oVerb, oConjTable) { // function called when results come from the Worker if (oVerb) { this.xParent.getElementById('grammalecte_conj_verb').style.color = "#999999"; this.xParent.getElementById('grammalecte_conj_verb').textContent = ""; this.xParent.getElementById('grammalecte_conj_verb_title').textContent = oVerb.sVerb; this.xParent.getElementById('grammalecte_conj_verb_info').textContent = oVerb.sInfo; this.xParent.getElementById('grammalecte_conj_opro').textContent = oVerb.sProLabel; if (oVerb.bUncomplete) { this.unselectOption('grammalecte_conj_opro'); this.disableOption('grammalecte_conj_opro'); this.unselectOption('grammalecte_conj_otco'); this.disableOption('grammalecte_conj_otco'); this.xParent.getElementById('grammalecte_conj_note').textContent = "Ce verbe n’a pas encore été vérifié. C’est pourquoi les options “pronominal” et “temps composés” sont désactivées."; } else { this.enableOption('grammalecte_conj_otco'); if (oVerb.nPronominable == 0) { this.enableOption('grammalecte_conj_opro'); } else if (oVerb.nPronominable == 1) { this.selectOption('grammalecte_conj_opro'); this.disableOption('grammalecte_conj_opro'); } else { // -1 or error this.unselectOption('grammalecte_conj_opro'); this.disableOption('grammalecte_conj_opro'); } this.xParent.getElementById('grammalecte_conj_note').textContent = "❦"; } this.displayConj(oConjTable); } else { this.xParent.getElementById('grammalecte_conj_verb').style.color = "#BB4411"; } } displayConj (oConjTable) { // function called when results come from the Worker if (oConjTable === null) { return; } try { this.xParent.getElementById('grammalecte_conj_verb').textContent = ""; // infinitif this.xParent.getElementById('grammalecte_conj_infi').textContent = oConjTable["infi"] || " "; // something or nbsp // participe présent this.xParent.getElementById('grammalecte_conj_ppre').textContent = oConjTable["ppre"] || " "; // participes passés this.xParent.getElementById('grammalecte_conj_ppas1').textContent = oConjTable["ppas1"] || " "; this.xParent.getElementById('grammalecte_conj_ppas2').textContent = oConjTable["ppas2"] || " "; |
︙ | ︙ | |||
779 780 781 782 783 784 785 | this.xParent.getElementById('grammalecte_conj_simp2').textContent = oConjTable["simp2"] || " "; this.xParent.getElementById('grammalecte_conj_simp3').textContent = oConjTable["simp3"] || " "; this.xParent.getElementById('grammalecte_conj_simp4').textContent = oConjTable["simp4"] || " "; this.xParent.getElementById('grammalecte_conj_simp5').textContent = oConjTable["simp5"] || " "; this.xParent.getElementById('grammalecte_conj_simp6').textContent = oConjTable["simp6"] || " "; } catch (e) { | | | 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 | this.xParent.getElementById('grammalecte_conj_simp2').textContent = oConjTable["simp2"] || " "; this.xParent.getElementById('grammalecte_conj_simp3').textContent = oConjTable["simp3"] || " "; this.xParent.getElementById('grammalecte_conj_simp4').textContent = oConjTable["simp4"] || " "; this.xParent.getElementById('grammalecte_conj_simp5').textContent = oConjTable["simp5"] || " "; this.xParent.getElementById('grammalecte_conj_simp6').textContent = oConjTable["simp6"] || " "; } catch (e) { showError(e); } } } class GrammalecteTooltip { |
︙ | ︙ | |||
936 937 938 939 940 941 942 | catch (e) { let xSuggBlock = this.xParent.getElementById("grammalecte_tooltip_sugg_block"); xSuggBlock.appendChild(document.createTextNode("# Oups. Le mécanisme de suggestion orthographique a rencontré un bug… (Ce module est encore en phase β.)")); showError(e); } } } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 973 974 975 976 977 978 979 | catch (e) { let xSuggBlock = this.xParent.getElementById("grammalecte_tooltip_sugg_block"); xSuggBlock.appendChild(document.createTextNode("# Oups. Le mécanisme de suggestion orthographique a rencontré un bug… (Ce module est encore en phase β.)")); showError(e); } } } |
Modified gc_lang/fr/webext/content_scripts/panel_tf.js from [c58813ca49] to [dd32e278d0].
︙ | ︙ | |||
73 74 75 76 77 78 79 | xTypo.appendChild(this._createLigaturesSelection()); let xMisc = this._createFieldset("group_misc", true, "Divers"); xMisc.appendChild(this._createOrdinalOptions()); xMisc.appendChild(this._createBlockOption("o_etc", true, "Et cætera, etc.")); xMisc.appendChild(this._createBlockOption("o_missing_hyphens", true, "Traits d’union manquants")); xMisc.appendChild(this._createBlockOption("o_ma_word", true, "Apostrophes manquantes")); xMisc.appendChild(this._createSingleLetterOptions()); | < < < > > > > | > | 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 | xTypo.appendChild(this._createLigaturesSelection()); let xMisc = this._createFieldset("group_misc", true, "Divers"); xMisc.appendChild(this._createOrdinalOptions()); xMisc.appendChild(this._createBlockOption("o_etc", true, "Et cætera, etc.")); xMisc.appendChild(this._createBlockOption("o_missing_hyphens", true, "Traits d’union manquants")); xMisc.appendChild(this._createBlockOption("o_ma_word", true, "Apostrophes manquantes")); xMisc.appendChild(this._createSingleLetterOptions()); xColumn1.appendChild(xSSP); xColumn1.appendChild(xSpace); xColumn1.appendChild(xNBSP); xColumn1.appendChild(xDelete); xColumn2.appendChild(xTypo); xColumn2.appendChild(xMisc); if (!bThunderbird) { let xStruct = this._createFieldset("group_struct", false, "Restructuration [!]"); xStruct.appendChild(this._createBlockOption("o_remove_hyphens_at_end_of_paragraphs", false, "Enlever césures en fin de ligne/paragraphe [!]")); xStruct.appendChild(this._createBlockOption("o_merge_contiguous_paragraphs", false, "Fusionner les paragraphes contigus [!]")); xColumn2.appendChild(xStruct); } xOptions.appendChild(xColumn1); xOptions.appendChild(xColumn2); // Actions let xActions = oGrammalecte.createNode("div", {id: "grammalecte_tf_actions"}); let xDefaultButton = oGrammalecte.createNode("div", {id: "grammalecte_tf_reset", textContent: "Par défaut", className: "grammalecte_tf_button"}); xDefaultButton.addEventListener("click", () => { this.reset(); }); let xApplyButton = oGrammalecte.createNode("div", {id: "grammalecte_tf_apply", textContent: "Appliquer", className: "grammalecte_tf_button"}); |
︙ | ︙ | |||
521 522 523 524 525 526 527 | // end of processing //window.setCursor("auto"); // restore pointer const t1 = Date.now(); this.xParent.getElementById('grammalecte_tf_time_res').textContent = this.getTimeRes((t1-t0)/1000); oGrammalecte.oGCPanel.oTextControl.loadText(sText); | < | 523 524 525 526 527 528 529 530 531 532 533 534 535 536 | // end of processing //window.setCursor("auto"); // restore pointer const t1 = Date.now(); this.xParent.getElementById('grammalecte_tf_time_res').textContent = this.getTimeRes((t1-t0)/1000); oGrammalecte.oGCPanel.oTextControl.loadText(sText); this.bTextChanged = true; } catch (e) { showError(e); } } |
︙ | ︙ |
Modified gc_lang/fr/webext/manifest.json from [8dac256bfb] to [9dc86ec3bd].
︙ | ︙ | |||
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | "matches": ["<all_urls>"], "exclude_matches": [ "*://*.wikisource.org/*", "*://*.wikipedia.org/*", "*://*.wiktionary.org/*" ], "js": [ "content_scripts/html_src.js", "content_scripts/panel.js", "grammalecte/fr/textformatter.js", "content_scripts/panel_tf.js", "content_scripts/panel_gc.js", "content_scripts/message_box.js", "content_scripts/menu.js", "content_scripts/init.js" ], "run_at": "document_end" }, { "matches": [ "*://*.wikisource.org/*", "*://*.wikipedia.org/*", "*://*.wiktionary.org/*" ], "js": [ "content_scripts/html_src.js", "content_scripts/panel.js", "grammalecte/fr/textformatter.js", "content_scripts/panel_tf.js", "content_scripts/panel_gc.js", "content_scripts/menu.js", "content_scripts/init.js" ], "run_at": "document_idle" } ], | > > > | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | "matches": ["<all_urls>"], "exclude_matches": [ "*://*.wikisource.org/*", "*://*.wikipedia.org/*", "*://*.wiktionary.org/*" ], "js": [ "content_scripts/editor.js", "content_scripts/html_src.js", "content_scripts/panel.js", "grammalecte/fr/textformatter.js", "content_scripts/panel_tf.js", "content_scripts/panel_gc.js", "content_scripts/message_box.js", "content_scripts/menu.js", "content_scripts/init.js" ], "run_at": "document_end" }, { "matches": [ "*://*.wikisource.org/*", "*://*.wikipedia.org/*", "*://*.wiktionary.org/*" ], "js": [ "content_scripts/editor.js", "content_scripts/html_src.js", "content_scripts/panel.js", "grammalecte/fr/textformatter.js", "content_scripts/panel_tf.js", "content_scripts/panel_gc.js", "content_scripts/message_box.js", "content_scripts/menu.js", "content_scripts/init.js" ], "run_at": "document_idle" } ], |
︙ | ︙ |
Modified gc_lang/fr/webext/panel/conjugueur.html from [78627e28af] to [9eb29a89d3].
1 2 3 4 5 6 7 | <!DOCTYPE HTML> <html> <head> <link rel="stylesheet" type="text/css" href="conjugueur.css" /> <title>Grammalecte · Conjugueur</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> </head> | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <!DOCTYPE HTML> <html> <head> <link rel="stylesheet" type="text/css" href="conjugueur.css" /> <title>Grammalecte · Conjugueur</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> </head> <body> <header> <div class="mainflow"> <div class="logo" style="margin: -10px 0 0 0;"> <img src="../img/logo-96.png" alt="" /> </div> </div> |
︙ | ︙ | |||
23 24 25 26 27 28 29 | <div id="conjugate">Conjuguer</div> </div> <h1 id="verb_title" class="center"> </h1> <p id="info" class="center"> </p> <p id="options"> | | | | | | 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 | <div id="conjugate">Conjuguer</div> </div> <h1 id="verb_title" class="center"> </h1> <p id="info" class="center"> </p> <p id="options"> <label for="oneg">Négation</label> <input type="checkbox" id="oneg" name="oneg" value="ON" /> · <label for="oint">Interrogatif</label> <input type="checkbox" id="oint" name="oint" value="ON" /> · <label for="ofem">Féminin</label> <input type="checkbox" id="ofem" name="ofem" value="ON" /> · <label id="opro_lbl" for="opro">Pronominal</label> <input type="checkbox" id="opro" name="opro" value="ON" /> · <label id="otco_lbl" for="otco">Temps composés</label> <input type="checkbox" id="otco" name="otco" value="ON" /> </p> <p id="smallnote">❦</p> <div class="clearer"></div> <!-- section 1 --> <div class="container"> <div class="colonne"> <div id="infinitif" class="box"> <h2 id="infinitif_title">Infinitif</h2> <p id="infi"> </p> </div> <div id="imperatif" class="box"> <h2 id="imperatif_title">Impératif</h2> <h3 id="impe_temps">Présent</h3> <p id="impe1"> </p> <p id="impe2"> </p> <p id="impe3"> </p> </div> </div> <div class="colonne"> <div id="partpre" class="box"> <h2 id="partpre_title">Participe présent</h2> <p id="ppre"> </p> </div> <div id="partpas" class="box"> <h2 id="partpas_title">Participes passés</h2> |
︙ | ︙ | |||
109 110 111 112 113 114 115 | <p id="ifut3"> </p> <p id="ifut4"> </p> <p id="ifut5"> </p> <p id="ifut6"> </p> </div> </div> </div> | | | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | <p id="ifut3"> </p> <p id="ifut4"> </p> <p id="ifut5"> </p> <p id="ifut6"> </p> </div> </div> </div> <div class="colonne"> <div id="subjonctif" class="box"> <h2 id="subjontif_title">Subjonctif</h2> <div id="spre"> <h3 id="spre_temps">Présent</h3> <p id="spre1"> </p> <p id="spre2"> </p> |
︙ | ︙ | |||
167 168 169 170 171 172 173 | </div> <script src="../grammalecte/graphspell/helpers.js"></script> <script src="../grammalecte/fr/conj.js"></script> <script src="conjugueur.js"></script> </body> | | | 167 168 169 170 171 172 173 174 175 | </div> <script src="../grammalecte/graphspell/helpers.js"></script> <script src="../grammalecte/fr/conj.js"></script> <script src="conjugueur.js"></script> </body> </html> |
Modified gc_lang/fr/webext/panel/conjugueur.js from [d64a44e001] to [bcf093f6ff].
︙ | ︙ | |||
73 74 75 76 77 78 79 | document.getElementById('otco').disabled = true; document.getElementById('otco_lbl').style = "color: #CCC;"; document.getElementById('smallnote').textContent = "Ce verbe n’a pas encore été vérifié. C’est pourquoi les options “pronominal” et “temps composés” sont désactivées."; } else { document.getElementById('otco').disabled = false; document.getElementById('otco_lbl').style = "color: #000;"; if (oVerb.nPronominable == 0) { | < | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | document.getElementById('otco').disabled = true; document.getElementById('otco_lbl').style = "color: #CCC;"; document.getElementById('smallnote').textContent = "Ce verbe n’a pas encore été vérifié. C’est pourquoi les options “pronominal” et “temps composés” sont désactivées."; } else { document.getElementById('otco').disabled = false; document.getElementById('otco_lbl').style = "color: #000;"; if (oVerb.nPronominable == 0) { document.getElementById('opro').disabled = false; document.getElementById('opro_lbl').style = "color: #000;"; } else if (oVerb.nPronominable == 1) { document.getElementById('opro').checked = true; document.getElementById('opro').disabled = true; document.getElementById('opro_lbl').style = "color: #CCC;"; } else { // -1 or 1 or error |
︙ | ︙ |
Modified helpers.py from [20b8bddd75] to [36dfdf0199].
︙ | ︙ | |||
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 143 | 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): "add a file to zip archive and file it with <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) |