Comment: | [tb] update: another day in the endless JS pile of shit |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | tb | tbnext |
Files: | files | file ages | folders |
SHA3-256: |
ebe0fa16637a3438e44f19c338034f4b |
User & Date: | olr on 2018-04-11 16:02:28 |
Other Links: | branch diff | manifest | tags |
2018-04-12
| ||
08:56 | [tb] disable dictionaries selection feature (dead feature) check-in: 2df5bf202b user: olr tags: tb, tbnext | |
2018-04-11
| ||
16:02 | [tb] update: another day in the endless JS pile of shit check-in: ebe0fa1663 user: olr tags: tb, tbnext | |
14:04 | [tb] attempt to fix windows height, but it’s broken… check-in: fb01f0170d user: olr tags: tb, tbnext | |
Modified gc_lang/fr/build.py from [a54b2ffcfb] to [039403a815].
︙ | ︙ | |||
87 88 89 90 91 92 93 | helpers.addFolderToZipAndFileFile(hZip, "gc_lang/"+sLang+"/tb", "", dVars, True) spDict = "gc_lang/"+sLang+"/xpi/data/dictionaries" for sp in os.listdir(spDict): if os.path.isdir(spDict+"/"+sp): hZip.write(spDict+"/"+sp+"/"+sp+".dic", "content/dictionaries/"+sp+"/"+sp+".dic") hZip.write(spDict+"/"+sp+"/"+sp+".aff", "content/dictionaries/"+sp+"/"+sp+".aff") hZip.close() | | | | | > | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | helpers.addFolderToZipAndFileFile(hZip, "gc_lang/"+sLang+"/tb", "", dVars, True) spDict = "gc_lang/"+sLang+"/xpi/data/dictionaries" for sp in os.listdir(spDict): if os.path.isdir(spDict+"/"+sp): hZip.write(spDict+"/"+sp+"/"+sp+".dic", "content/dictionaries/"+sp+"/"+sp+".dic") hZip.write(spDict+"/"+sp+"/"+sp+".aff", "content/dictionaries/"+sp+"/"+sp+".aff") hZip.close() spDebugProfile = dVars['win_tb_debug_extension_path'] if platform.system() == "Windows" else dVars['linux_tb_debug_extension_path'] helpers.unzip(spfZip, spDebugProfile) spfBetaExtension = dVars['win_tb_beta_extension_filepath'] if platform.system() == "Windows" else dVars['linux_tb_beta_extension_filepath'] #helpers.unzip(spfZip, spBetaProfile) file_util.copy_file(spfZip, spfBetaExtension) def _createOptionsForThunderbird (dVars): dVars['sXULTabs'] = "" dVars['sXULTabPanels'] = "" # dialog options for sSection, lOpt in dVars['lStructOpt']: |
︙ | ︙ |
Modified gc_lang/fr/config.ini from [5bcacb50e3] to [76ab9009a0].
︙ | ︙ | |||
46 47 48 49 50 51 52 | linux_fx_nightly_path = /usr/bin/firefox # Thunderbird tb_identifier = French-GC-TB@grammalecte.net tb_name = Grammalecte [fr] win_tb_path = C:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe #win_tb_beta_path = C:\Program Files (x86)\Mozilla Thunderbird (Beta)\thunderbird.exe | | | | | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | linux_fx_nightly_path = /usr/bin/firefox # Thunderbird tb_identifier = French-GC-TB@grammalecte.net tb_name = Grammalecte [fr] win_tb_path = C:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe #win_tb_beta_path = C:\Program Files (x86)\Mozilla Thunderbird (Beta)\thunderbird.exe win_tb_beta_path = C:\Program Files (x86)\Mozilla Thunderbird (Beta)\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\French-GC-TB@grammalecte.net linux_tb_debug_extension_path = ~/tb-debug.profile/extensions/French-GC-TB@grammalecte.net win_tb_beta_extension_filepath = D:\_temp\tb-beta.profile\extensions\French-GC-TB@grammalecte.net.xpi linux_tb_beta_extension_filepath = ~/tb-beta.profile/extensions/French-GC-TB@grammalecte.net.xpi # Set Thunderbird folder in your PATH variable # Create a local profile: # thunderbird -CreateProfile "debug _build\tb-debug.profile" # Or you can use the GUI with: # thunderbird -P # To launch Thunderbird with the profile debug, type: # thunderbird -P debug |
︙ | ︙ |
Modified gc_lang/fr/tb/content/about.js from [c5c1006b2d] to [94f44e1159].
1 2 3 4 | // JavaScript const Cc = Components.classes; const Ci = Components.interfaces; | | > | > | | 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 | // JavaScript const Cc = Components.classes; const Ci = Components.interfaces; //const Cu = Components.utils; function openInBrowserURL (sURL) { // method found in S3.Google.Translator try { openURL(sURL); // Works in overlay.js, but not here… Seems there is no documentation available about this feature on Mozilla.org } catch (e) { console.error(e); //Cu.reportError(e); } } function openInTabURL (sURL) { // method found in S3.Google.Translator try { let xWM = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator); let xWin = xWM.getMostRecentWindow("mail:3pane"); let xTabmail = xWin.document.getElementById('tabmail'); xWin.focus(); if (xTabmail) { xTabmail.openTab('contentTab', { contentPage: sURL }); } } catch (e) { console.error(e); //Cu.reportError(e); } } |
Modified gc_lang/fr/tb/content/about.xul from [f0d3116bf2] to [9407ba6c78].
1 2 3 4 5 6 7 8 9 10 11 12 | <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <?xml-stylesheet href="chrome://grammarchecker/content/about.css" type="text/css"?> <!DOCTYPE dialog SYSTEM "chrome://grammarchecker/locale/about.dtd"> <dialog id="grammalecte-about-window" title="&windowtitle;" orient="vertical" buttons="accept" width="300" | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <?xml-stylesheet href="chrome://grammarchecker/content/about.css" type="text/css"?> <!DOCTYPE dialog SYSTEM "chrome://grammarchecker/locale/about.dtd"> <dialog id="grammalecte-about-window" title="&windowtitle;" orient="vertical" buttons="accept" width="300" onload="document.getElementById('grammalecte-about-window').centerWindowOnScreen();" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <!-- Other elements go here --> <description style="text-align: center;"> <image src="chrome://grammarchecker/skin/logo120_text.png" /> </description> |
︙ | ︙ |
Modified gc_lang/fr/tb/content/conjugueur.js from [e2b39bc09c] to [7858c1ae9f].
1 2 | // JavaScript | | | 1 2 3 4 5 6 7 8 9 10 | // JavaScript //const Cu = Components.utils; //const { require } = Cu.import("resource://gre/modules/commonjs/toolkit/require.js", {}); //const conj = require("resource://grammalecte/fr/conj.js"); let oConj = { init: function () { console.log("Init conjugueur"); |
︙ | ︙ | |||
31 32 33 34 35 36 37 | this._displayResults(); }); document.getElementById('otco').addEventListener("click", (xEvent) => { this._displayResults(); }); } catch (e) { | > | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | this._displayResults(); }); document.getElementById('otco').addEventListener("click", (xEvent) => { this._displayResults(); }); } catch (e) { console.error(e); // Cu.reportError(e); } this.conjugate("être"); }, oVerb: null, getVerbAndConjugate: function () { |
︙ | ︙ | |||
120 121 122 123 124 125 126 | document.getElementById('otco').style = "color: #000;"; } this._displayResults(); } } } catch (e) { | > | | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | document.getElementById('otco').style = "color: #000;"; } this._displayResults(); } } } catch (e) { console.error(e); // Cu.reportError(e); } }, _displayResults: function () { if (this.oVerb === null) { return; } |
︙ | ︙ | |||
230 231 232 233 234 235 236 | document.getElementById('condb4').textContent = " "; document.getElementById('condb5').textContent = " "; document.getElementById('condb6').textContent = " "; } document.getElementById('verb').Text = ""; } catch (e) { | > | | 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | document.getElementById('condb4').textContent = " "; document.getElementById('condb5').textContent = " "; document.getElementById('condb6').textContent = " "; } document.getElementById('verb').Text = ""; } catch (e) { console.error(e); // Cu.reportError(e); } }, _setTitles: function () { try { if (!document.getElementById('otco').checked) { document.getElementById('ipre_temps').textContent = "Présent"; |
︙ | ︙ | |||
259 260 261 262 263 264 265 | document.getElementById('simp_temps').textContent = "Plus-que-parfait"; document.getElementById('conda_temps').textContent = "Passé (1ʳᵉ forme)"; document.getElementById('condb_temps').textContent = "Passé (2ᵉ forme)"; document.getElementById('impe_temps').textContent = "Passé"; } } catch (e) { | > | | 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | document.getElementById('simp_temps').textContent = "Plus-que-parfait"; document.getElementById('conda_temps').textContent = "Passé (1ʳᵉ forme)"; document.getElementById('condb_temps').textContent = "Passé (2ᵉ forme)"; document.getElementById('impe_temps').textContent = "Passé"; } } catch (e) { console.error(e); // Cu.reportError(e); } } }; conj.init(helpers.loadFile("resource://grammalecte/fr/conj_data.json")); oConj.init(); |
Modified gc_lang/fr/tb/content/conjugueur.xul from [9ec6ffe985] to [70a4bfd479].
1 2 3 4 5 6 7 8 9 | <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <?xml-stylesheet href="chrome://grammarchecker/content/conjugueur.css" type="text/css"?> <dialog id="grammalecte-conjugueur-window" title="Grammalecte · Conjugueur…" orient="vertical" width="580" | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <?xml-stylesheet href="chrome://grammarchecker/content/conjugueur.css" type="text/css"?> <dialog id="grammalecte-conjugueur-window" title="Grammalecte · Conjugueur…" orient="vertical" width="580" buttons="extra1" buttonlabelextra1="Conjuguer" ondialogextra1="oConj.getVerbAndConjugate();" defaultButton="extra1" onload="" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
︙ | ︙ |
Modified gc_lang/fr/tb/content/editor.js from [8eea7833f2] to [80f443c01c].
︙ | ︙ | |||
33 34 35 36 37 38 39 | yield xNode; } else if (this.lRootNodes.includes(xNode.tagName)) { yield* this._getParsableNodes(xNode); } } } } catch (e) { | > | > | > | > | > | > | | 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 | yield xNode; } else if (this.lRootNodes.includes(xNode.tagName)) { yield* this._getParsableNodes(xNode); } } } } catch (e) { console.error(e); // Cu.reportError(e); } }; * getParagraphs () { try { let i = 0; for (let xNode of this._getParsableNodes()) { this.lNode.push(xNode); yield [i, this._getTextFromNode(xNode)]; i += 1; } } catch (e) { console.error(e); // Cu.reportError(e); } }; getContent () { try { let sContent = ""; for (let [i, sHTML] of this.getParagraphs()) { if (sContent.length > 0) { sContent += "\n"; } sContent += sHTML; } return sContent; } catch (e) { console.error(e); // Cu.reportError(e); } }; getParagraph (iPara) { try { return this._getTextFromNode(this.lNode[iPara]); } catch (e) { console.error(e); // Cu.reportError(e); } }; writeParagraph (iPara, sText) { try { let xNode = this.lNode[iPara]; if ("innerHTML" in xNode) { xNode.innerHTML = sText; } else { xNode.textContent = sText; } } catch (e) { console.error(e); // Cu.reportError(e); } }; changeParagraph (iPara, sModif, iStart, iEnd) { let sText = this.getParagraph(iPara); this.writeParagraph(iPara, sText.slice(0, iStart) + sModif + sText.slice(iEnd)); }; getLangFromSpellChecker () { try { let gSpellChecker = this.xEditor.getInlineSpellChecker(true); let sLang = gSpellChecker.spellChecker.GetCurrentDictionary(); return sLang.slice(0, 2); } catch (e) { console.error(e); // Cu.reportError(e); } }; } |
Modified gc_lang/fr/tb/content/gc_options.js from [aee78a8d90] to [ed480efba2].
1 2 3 4 | // JavaScript const Cc = Components.classes; const Ci = Components.interfaces; | | > | > | | 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 | // JavaScript const Cc = Components.classes; const Ci = Components.interfaces; // const Cu = Components.utils; const prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService).getBranch("extensions.grammarchecker."); var oOptControl = { oOptions: null, load: function () { this._setDialogOptions(false); }, _setDialogOptions: function (bDefaultOptions=false) { try { sOptions = bDefaultOptions ? prefs.getCharPref("sGCDefaultOptions") : prefs.getCharPref("sGCOptions"); this.oOptions = JSON.parse(sOptions); for (let sParam in this.oOptions) { if (document.getElementById("option_"+sParam) !== null) { document.getElementById("option_"+sParam).checked = this.oOptions[sParam]; } } } catch (e) { console.error(e); // Cu.reportError(e); } }, save: function () { try { for (let xNode of document.getElementsByClassName("option")) { this.oOptions[xNode.id.slice(7)] = xNode.checked; } prefs.setCharPref("sGCOptions", JSON.stringify(this.oOptions)); } catch (e) { console.error(e); // Cu.reportError(e); } }, reset: function () { this._setDialogOptions(true); } } oOptControl.load(); |
Modified gc_lang/fr/tb/content/gc_options.xul from [94eab1cdbb] to [65926a1200].
︙ | ︙ | |||
11 12 13 14 15 16 17 | buttons="accept, cancel, extra1" ondialogaccept="oOptControl.save();" ondialogcancel="return;" buttonlabelextra1="&defaultbutton.label;" ondialogextra1="oOptControl.reset();" defaultButton="accept" width="400" | < | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | buttons="accept, cancel, extra1" ondialogaccept="oOptControl.save();" ondialogcancel="return;" buttonlabelextra1="&defaultbutton.label;" ondialogextra1="oOptControl.reset();" defaultButton="accept" width="400" onload="document.getElementById('grammalecte-gcoptions-window').centerWindowOnScreen();" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <!-- Other elements go here --> <dialogheader id="grammalecte-title" title="&dialogheader.label;" description="" /> |
︙ | ︙ |
Modified gc_lang/fr/tb/content/options.js from [73166a402f] to [7635023546].
1 2 3 4 5 6 7 | // JavaScript "use strict"; const Cc = Components.classes; const Ci = Components.interfaces; | | > | > | | 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 | // JavaScript "use strict"; const Cc = Components.classes; const Ci = Components.interfaces; // const Cu = Components.utils; const prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService).getBranch("extensions.grammarchecker."); var oOptControl = { load: function () { try { document.getElementById('check_signature').checked = prefs.getBoolPref('bCheckSignature'); } catch (e) { console.error(e); // Cu.reportError(e); } }, save: function () { try { prefs.setBoolPref('bCheckSignature', document.getElementById('check_signature').checked); } catch (e) { console.error(e); // Cu.reportError(e); } } } oOptControl.load(); |
Modified gc_lang/fr/tb/content/options.xul from [8d98ebc654] to [b4b7f2b7c3].
︙ | ︙ | |||
9 10 11 12 13 14 15 | title="&window.title;" orient="vertical" buttons="accept, cancel" ondialogaccept="oOptControl.save();" ondialogcancel="return;" defaultButton="accept" width="400" | < | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | title="&window.title;" orient="vertical" buttons="accept, cancel" ondialogaccept="oOptControl.save();" ondialogcancel="return;" defaultButton="accept" width="400" onload="document.getElementById('grammalecte-options-window').centerWindowOnScreen();" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <!-- Other elements go here --> <dialogheader id="grammalecte-title" title="&dialogheader.label;" description="" /> |
︙ | ︙ |
Modified gc_lang/fr/tb/content/overlay.js from [fcc7e4e2d6] to [7e10d11d8c].
1 2 3 4 5 6 7 8 9 10 | // JavaScript "use strict"; const Cc = Components.classes; const Ci = Components.interfaces; const Cu = Components.utils; //const { require } = Cu.import("resource://gre/modules/commonjs/toolkit/require.js", {}); | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | // JavaScript "use strict"; const Cc = Components.classes; const Ci = Components.interfaces; const Cu = Components.utils; //const { require } = Cu.import("resource://gre/modules/commonjs/toolkit/require.js", {}); const { BasePromiseWorker } = ChromeUtils.import('resource://gre/modules/PromiseWorker.jsm', {}); const Task = ChromeUtils.import("resource://gre/modules/Task.jsm").Task; const prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService).getBranch("extensions.grammarchecker."); //const text = require("resource://grammalecte/text.js"); //const tf = require("resource://grammalecte/fr/textformatter.js"); const oConverterToExponent = { |
︙ | ︙ | |||
158 159 160 161 162 163 164 | document.getElementById("grammalecte-errors").appendChild(xNodeP); } return nParagraph; }).then(function (res) { that.setInfo("Nombre de paragraphes analysés : " + res); }, function (e) { that.setInfo("Erreur : " + e.message); | > | | 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | document.getElementById("grammalecte-errors").appendChild(xNodeP); } return nParagraph; }).then(function (res) { that.setInfo("Nombre de paragraphes analysés : " + res); }, function (e) { that.setInfo("Erreur : " + e.message); console.error(e); // Cu.reportError(e); }); }, createResultNode: function (xEditor, sParagraph, iParagraph, aGrammErr, aSpellErr) { let xResultNode = document.createElement("div"); xResultNode.setAttribute("id", "resnode" + iParagraph); this.fillResultNode(xResultNode, xEditor, sParagraph, iParagraph, aGrammErr, aSpellErr); return xResultNode; |
︙ | ︙ | |||
186 187 188 189 190 191 192 | that.fillResultNode(xResultNode, xEditor, sParagraph, iParagraph, oRes.aGrammErr, oRes.aSpellErr); } }, function (res) { xResultNode.textContent = "Erreur: " + res; }); } catch (e) { | > | | 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | that.fillResultNode(xResultNode, xEditor, sParagraph, iParagraph, oRes.aGrammErr, oRes.aSpellErr); } }, function (res) { xResultNode.textContent = "Erreur: " + res; }); } catch (e) { console.error(e); // Cu.reportError(e); } }, fillResultNode: function (xResultNode, xEditor, sParagraph, iParagraph, aGrammErr, aSpellErr) { try { if (aGrammErr.length === 0 && aSpellErr.length === 0) { return null; } |
︙ | ︙ | |||
236 237 238 239 240 241 242 | xParagraphNode.appendChild(document.createTextNode(this._purgeTags(sParagraph.slice(nEndLastErr)))); xResultNode.appendChild(xParagraphNode); for (let xNode of lNodeError) { xResultNode.appendChild(xNode); } } catch (e) { | > | | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | xParagraphNode.appendChild(document.createTextNode(this._purgeTags(sParagraph.slice(nEndLastErr)))); xResultNode.appendChild(xParagraphNode); for (let xNode of lNodeError) { xResultNode.appendChild(xNode); } } catch (e) { console.error(e); // Cu.reportError(e); xResultNode.textContent = "# Error: " + e.message; } }, _createNodeGCErrorDescription: function (xEditor, nError, dErr, iParagraph) { let xNodeDiv = document.createElement("div"); let that = this; // message |
︙ | ︙ | |||
350 351 352 353 354 355 356 | } } else { xNodeSuggLine.appendChild(document.createTextNode("Aucune suggestion.")); } } catch (e) { xNodeSuggLine.appendChild(document.createTextNode("# Erreur : dictionnaire orthographique introuvable.")); | > | | 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | } } else { xNodeSuggLine.appendChild(document.createTextNode("Aucune suggestion.")); } } catch (e) { xNodeSuggLine.appendChild(document.createTextNode("# Erreur : dictionnaire orthographique introuvable.")); console.error(e); // Cu.reportError(e); } }); xNodeSuggLine.appendChild(xNodeSuggButton); xNodeDiv.appendChild(xNodeSuggLine); return xNodeDiv; }, loadUI: function() { |
︙ | ︙ | |||
387 388 389 390 391 392 393 | xNavBar.setAttribute("currentset", aSet.join(",")); xNavBar.currentSet = aSet.join(","); document.persist(xNavBar.id, "currentset"); try { BrowserToolboxCustomizeDone(true); } catch (e) { | > | > | > | > | > | | 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 | xNavBar.setAttribute("currentset", aSet.join(",")); xNavBar.currentSet = aSet.join(","); document.persist(xNavBar.id, "currentset"); try { BrowserToolboxCustomizeDone(true); } catch (e) { console.error(e); // Cu.reportError(e); } } }, clearPreview: function() { let xPreview = document.getElementById("grammalecte-errors"); while (xPreview.firstChild) { xPreview.removeChild(xPreview.firstChild); }; let xEditor = GetCurrentEditor(); if (xEditor != null) { try { xEditor.QueryInterface(Ci.nsIEditorStyleSheets); xEditor.addOverrideStyleSheet("chrome://grammarchecker/content/overlay.css"); } catch (e) { console.error(e); // Cu.reportError(e); } } this.setInfo("[vide]"); }, setInfo: function (sText) { document.getElementById("grammalecte-info").textContent = sText; }, openPanel: function () { document.getElementById("textformatter-splitter").setAttribute("state", "collapsed"); document.getElementById("grammarchecker-splitter").setAttribute("state", "open"); }, closePanel: function () { document.getElementById("grammarchecker-splitter").setAttribute("state", "collapsed"); }, openDialog: function (sWhat, sName="", sOptions="") { try { window.openDialog(sWhat, sName, sOptions); } catch (e) { console.error(e); // Cu.reportError(e); } }, openInTabURL: function (sURL) { // method found in S3.Google.Translator try { let xWM = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator); let xWin = xWM.getMostRecentWindow("mail:3pane"); let xTabmail = xWin.document.getElementById('tabmail'); xWin.focus(); if (xTabmail) { xTabmail.openTab('contentTab', { contentPage: sURL }); } } catch (e) { console.error(e); // Cu.reportError(e); } }, openInBrowserURL: function (sURL) { // method found in S3.Google.Translator try { openURL(sURL); } catch (e) { console.error(e); // Cu.reportError(e); } }, onParseText: function (e) { this.parse(); }, onClosePanel: function (e) { this.closePanel(); |
︙ | ︙ | |||
511 512 513 514 515 516 517 | } }, _setDictionary: function (sDicName, sOptName) { try { oSpellControl.setExtensionDictFolder(sDicName, prefs.getBoolPref(sOptName)); } catch (e) { | > | > | > | | 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 | } }, _setDictionary: function (sDicName, sOptName) { try { oSpellControl.setExtensionDictFolder(sDicName, prefs.getBoolPref(sOptName)); } catch (e) { console.error(e); // Cu.reportError(e); } } } var oTextFormatter = { init: function () { try { this.closePanel(); let sTFOptions = prefs.getCharPref("sTFOptions"); if (sTFOptions !== "") { this.setOptionsInPanel(JSON.parse(sTFOptions)); this.resetProgressBar(); } else { this.reset(); } } catch (e) { console.error(e); // Cu.reportError(e); } }, apply: function () { try { this.saveOptions(); this.resetProgressBar(); let xEditor = new Editor(); let sText = xEditor.getContent(); let iParagraph = 0; sText = this.applyOptions(sText); for (let sParagraph of text.getParagraph(sText)) { xEditor.writeParagraph(iParagraph, sParagraph); iParagraph += 1; } } catch (e) { console.error(e); // Cu.reportError(e); } }, saveOptions: function () { let oOptions = {}; for (let xNode of document.getElementsByClassName("option")) { oOptions[xNode.id] = xNode.checked; } |
︙ | ︙ | |||
590 591 592 593 594 595 596 | xNode.checked = (xNode.getAttribute('data-default') === "true"); if (xNode.id.startsWith("o_group_")) { this.switchGroup(xNode.id); } } } catch (e) { | > | | 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 | xNode.checked = (xNode.getAttribute('data-default') === "true"); if (xNode.id.startsWith("o_group_")) { this.switchGroup(xNode.id); } } } catch (e) { console.error(e); // Cu.reportError(e); } }, resetProgressBar: function () { document.getElementById('progressbar').value = 0; document.getElementById('time_res').textContent = ""; }, getTimeRes: function (n) { |
︙ | ︙ | |||
862 863 864 865 866 867 868 | // end of processing //window.setCursor("auto"); // restore pointer const t1 = Date.now(); document.getElementById('time_res').textContent = this.getTimeRes((t1-t0)/1000); } catch (e) { | > | > | | 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 | // end of processing //window.setCursor("auto"); // restore pointer const t1 = Date.now(); document.getElementById('time_res').textContent = this.getTimeRes((t1-t0)/1000); } catch (e) { console.error(e); // Cu.reportError(e); } return sText; }, formatText: function (sText, sOptName) { let nCount = 0; try { if (!oReplTable.hasOwnProperty(sOptName)) { console.log("# Error. TF: there is no option “" + sOptName+ "”."); return [sText, nCount]; } for (let [zRgx, sRep] of oReplTable[sOptName]) { nCount += (sText.match(zRgx) || []).length; sText = sText.replace(zRgx, sRep); } } catch (e) { console.error(e); // Cu.reportError(e); } return [sText, nCount]; } } /* EVENTS */ |
︙ | ︙ |
Modified gc_lang/fr/tb/content/spell_options.js from [4444b40148] to [9eecd62e61].
1 2 3 4 5 6 7 | // JavaScript "use strict"; const Cc = Components.classes; const Ci = Components.interfaces; | | > | > | | 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 | // JavaScript "use strict"; const Cc = Components.classes; const Ci = Components.interfaces; // const Cu = Components.utils; const prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService).getBranch("extensions.grammarchecker."); var oDialogControl = { load: function () { try { document.getElementById('fr-FR-modern').checked = prefs.getBoolPref('bDictModern'); document.getElementById('fr-FR-classic').checked = prefs.getBoolPref('bDictClassic'); document.getElementById('fr-FR-reform').checked = prefs.getBoolPref('bDictReform'); document.getElementById('fr-FR-classic-reform').checked = prefs.getBoolPref('bDictClassicReform'); document.getElementById('grammalecte-spelloptions-window').centerWindowOnScreen(); } catch (e) { console.error(e); // Cu.reportError(e); } }, setDictionaries: function () { oSpellControl.init(); this._setDictionary('fr-FR-modern', 'bDictModern'); this._setDictionary('fr-FR-classic', 'bDictClassic'); this._setDictionary('fr-FR-reform', 'bDictReform'); this._setDictionary('fr-FR-classic-reform', 'bDictClassicReform'); }, _setDictionary: function (sDicName, sOptName) { try { let bActivate = document.getElementById(sDicName).checked; oSpellControl.setExtensionDictFolder(sDicName, bActivate); prefs.setBoolPref(sOptName, bActivate); } catch (e) { console.error(e); // Cu.reportError(e); } } }; |
Modified gc_lang/fr/tb/content/spell_options.xul from [5934b250e2] to [9ae03c5ef3].
︙ | ︙ | |||
8 9 10 11 12 13 14 | id="grammalecte-spelloptions-window" title="&window.title;" orient="vertical" buttons="accept,cancel" ondialogaccept="oDialogControl.setDictionaries();" ondialogcancel="return;" width="400" | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | id="grammalecte-spelloptions-window" title="&window.title;" orient="vertical" buttons="accept,cancel" ondialogaccept="oDialogControl.setDictionaries();" ondialogcancel="return;" width="400" height="680" onload="oDialogControl.load();" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <!-- Other elements go here --> <dialogheader id="grammalecte-title" title="&dialogheader.label;" description=""/> |
︙ | ︙ |
Modified gc_lang/fr/tb/content/spellchecker.js from [bf36be002a] to [f4fc6376bf].
︙ | ︙ | |||
20 21 22 23 24 25 26 | // Loaded in another file const Cc = Components.classes; const Ci = Components.interfaces; const Cu = Components.utils; const { require } = Cu.import("resource://gre/modules/commonjs/toolkit/require.js", {}); */ | < | | > | > | > | > | > | > | > | | 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 | // Loaded in another file const Cc = Components.classes; const Ci = Components.interfaces; const Cu = Components.utils; const { require } = Cu.import("resource://gre/modules/commonjs/toolkit/require.js", {}); */ const FileUtils = ChromeUtils.import("resource://gre/modules/FileUtils.jsm").FileUtils; const AddonManager = ChromeUtils.import("resource://gre/modules/AddonManager.jsm").AddonManager; var oSpellControl = { xSCEngine: null, init: function () { if (this.xSCEngine === null) { try { let sSpellchecker = "@mozilla.org/spellchecker/myspell;1"; if ("@mozilla.org/spellchecker/hunspell;1" in Cc) { sSpellchecker = "@mozilla.org/spellchecker/hunspell;1"; } if ("@mozilla.org/spellchecker/engine;1" in Cc) { sSpellchecker = "@mozilla.org/spellchecker/engine;1"; } this.xSCEngine = Cc[sSpellchecker].getService(Ci.mozISpellCheckingEngine); } catch (e) { console.log("Can’t initiate the spellchecker."); console.error(e); // Cu.reportError(e); } } }, getDictionariesList: function () { this.init(); try { let l = {}; let c = {}; this.xSCEngine.getDictionaryList(l, c); return l.value; } catch (e) { console.error(e); // Cu.reportError(e); return []; } }, setDictionary: function (sLocale) { if (this.getDictionariesList().includes(sLocale)) { try { this.xSCEngine.dictionary = sLocale; // en-US, fr, etc. return true; } catch (e) { console.error(e); // Cu.reportError(e); return false; } } else { console.log("Warning. No dictionary for locale: " + sLocale); console.log("Existing dictionaries: " + this.getDictionariesList().join(" | ")); } return false; }, check: function (sWord) { // todo: check in personal dict? try { return this.xSCEngine.check(sWord); } catch (e) { console.error(e); // Cu.reportError(e); return false; } }, suggest: function (sWord) { try { let lSugg = {}; this.xSCEngine.suggest(sWord, lSugg, {}); return lSugg.value; // lSugg.value is a JavaScript Array of strings } catch (e) { console.error(e); // Cu.reportError(e); return ['#Erreur.']; } }, addDirectory: function (sFolder) { try { let xNsiFolder = new FileUtils.File(sFolder); this.xSCEngine.addDirectory(xNsiFolder); } catch (e) { console.log("Unable to add directory: " + sFolder); console.error(e); // Cu.reportError(e); } }, removeDirectory: function (sFolder) { // does not work but no exception raised (bug?) try { let xNsiFolder = new FileUtils.File(sFolder); this.xSCEngine.removeDirectory(xNsiFolder); } catch (e) { console.log("Unable to remove directory: " + sFolder); console.error(e); // Cu.reportError(e); } }, setExtensionDictFolder: function (sDictName, bActivate) { try { let that = this; let sPath = "/content/dictionaries/" + sDictName; AddonManager.getAddonByID("French-GC-TB@grammalecte.net", function (addon) { |
︙ | ︙ | |||
141 142 143 144 145 146 147 | that.removeDirectory(sFolder); } } }); } catch (e) { console.log("Unable to add extension folder"); | > | | 147 148 149 150 151 152 153 154 155 156 157 158 | that.removeDirectory(sFolder); } } }); } catch (e) { console.log("Unable to add extension folder"); console.error(e); // Cu.reportError(e); } } }; |
Modified gc_lang/fr/tb/install.rdf from [95227f9159] to [b2386a183b].
︙ | ︙ | |||
11 12 13 14 15 16 17 | <em:homepageURL>${link}</em:homepageURL> <!--<em:optionsURL>chrome://grammarchecker/content/options.xul</em:optionsURL>--> <em:unpack>true</em:unpack> <em:targetApplication> <Description> <em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id> <!-- thunderbird --> | | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 | <em:homepageURL>${link}</em:homepageURL> <!--<em:optionsURL>chrome://grammarchecker/content/options.xul</em:optionsURL>--> <em:unpack>true</em:unpack> <em:targetApplication> <Description> <em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id> <!-- thunderbird --> <em:minVersion>52.0</em:minVersion> <em:maxVersion>60.*</em:maxVersion> </Description> </em:targetApplication> </Description> </RDF> |