DELETED gc_lang/fr/mailext/content/about.css
Index: gc_lang/fr/mailext/content/about.css
==================================================================
--- gc_lang/fr/mailext/content/about.css
+++ /dev/null
@@ -1,46 +0,0 @@
-/* CSS */
-
-.descr {
- font-size: 18px;
- font-weight: bold;
- text-align: center;
-}
-
-.stdlabel {
- font-size: 16px;
- text-align: center;
-}
-
-#website {
- font-size: 16px;
- font-weight: bold;
- color: hsl(210, 50%, 50%);
- text-align: center;
- cursor: pointer;
-}
-
-#contrib {
- font-size: 16px;
- text-align: center;
- color: hsl(210, 50%, 50%);
- cursor: pointer;
-}
-
-
-/*
- TB Next: fix dialogheaders
-*/
-dialogheader {
- -moz-binding: url("chrome://messenger/content/generalBindings.xml#dialogheader");
- margin: 0 5px 5px;
- border: 1px solid ThreeDDarkShadow;
- padding: 5px 8px;
- background-color: Highlight;
- color: HighlightText;
-}
-
-.dialogheader-title {
- margin: 0 !important;
- font-size: larger;
- font-weight: bold;
-}
DELETED gc_lang/fr/mailext/content/about.js
Index: gc_lang/fr/mailext/content/about.js
==================================================================
--- gc_lang/fr/mailext/content/about.js
+++ /dev/null
@@ -1,35 +0,0 @@
-// 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);
- }
-}
DELETED gc_lang/fr/mailext/content/about.xul
Index: gc_lang/fr/mailext/content/about.xul
==================================================================
--- gc_lang/fr/mailext/content/about.xul
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
-
-
-
DELETED gc_lang/fr/mailext/content/conjugueur.css
Index: gc_lang/fr/mailext/content/conjugueur.css
==================================================================
--- gc_lang/fr/mailext/content/conjugueur.css
+++ /dev/null
@@ -1,48 +0,0 @@
-/* CSS */
-
-#verb {
- width: 200px;
-}
-
-#verb_title {
- font-size: 24px;
- font-weight: bold;
- text-align: center;
- color: hsl(210, 50%, 50%);
-}
-
-#info {
- font-size: 16px;
- text-align: center;
- vertical-align: bottom;
-}
-
-
-.groupbox {
- margin-left: 5px;
- margin-bottom: 5px;
- width: 275px;
- border: 1px solid hsl(0, 0%, 90%);
- border-radius: 5px;
-}
-
-#smallnote {
- font-size: 10px;
- width: 250px;
-}
-
-.sub_header {
- color: hsl(0, 50%, 50%);
- font-size: 16px;
- font-weight: bold;
- border-bottom: 1px solid hsl(0, 0%, 80%);
-}
-
-label.temps {
- color: hsl(210, 50%, 50%);
- font-size: 13px;
- font-weight: bold;
-}
-label.cj {
- font-size: 11px;
-}
DELETED gc_lang/fr/mailext/content/conjugueur.js
Index: gc_lang/fr/mailext/content/conjugueur.js
==================================================================
--- gc_lang/fr/mailext/content/conjugueur.js
+++ /dev/null
@@ -1,218 +0,0 @@
-// 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");
- try {
- // button
- document.getElementById('conjugate').addEventListener("click", (xEvent) => {
- this.getVerbAndConjugate();
- });
- // text field
- document.getElementById('verb').addEventListener("change", (xEvent) => {
- this.getVerbAndConjugate();
- });
- // options
- document.getElementById('oneg').addEventListener("click", (xEvent) => {
- this._displayResults();
- });
- document.getElementById('opro').addEventListener("click", (xEvent) => {
- this._displayResults();
- });
- document.getElementById('oint').addEventListener("click", (xEvent) => {
- this._displayResults();
- });
- document.getElementById('ofem').addEventListener("click", (xEvent) => {
- this._displayResults();
- });
- document.getElementById('otco').addEventListener("click", (xEvent) => {
- this._displayResults();
- });
- }
- catch (e) {
- console.error(e);
- }
- this.conjugate("être");
- },
-
- oVerb: null,
-
- getVerbAndConjugate: function () {
- this.conjugate(document.getElementById('verb').value);
- },
-
- conjugate: function (sVerb) {
- try {
- document.getElementById('oneg').checked = false;
- document.getElementById('opro').checked = false;
- document.getElementById('oint').checked = false;
- document.getElementById('otco').checked = false;
- document.getElementById('ofem').checked = false;
- document.getElementById('smallnote').hidden = true;
-
- // request analyzing
- sVerb = sVerb.trim().toLowerCase().replace(/’/g, "'").replace(/ +/g, " ");
- if (sVerb) {
- if (sVerb.startsWith("ne pas ")) {
- document.getElementById('oneg').checked = true;
- sVerb = sVerb.slice(7);
- }
- if (sVerb.startsWith("se ")) {
- document.getElementById('opro').checked = true;
- sVerb = sVerb.slice(3);
- } else if (sVerb.startsWith("s'")) {
- document.getElementById('opro').checked = true;
- sVerb = sVerb.slice(2);
- }
- if (sVerb.endsWith("?")) {
- document.getElementById('oint').checked = true;
- sVerb = sVerb.slice(0,-1).trim();
- }
-
- if (!conj.isVerb(sVerb)) {
- document.getElementById('verb').style = "color: #BB4411;";
- } else {
- document.getElementById('verb_title').textContent = sVerb;
- document.getElementById('verb').style = "color: #999999;";
- document.getElementById('verb').value = "";
- this.oVerb = new Verb(sVerb);
- document.getElementById('info').textContent = this.oVerb.sInfo;
- document.getElementById('opro').label = this.oVerb.sProLabel;
- if (this.oVerb.bUncomplete) {
- document.getElementById('opro').checked = false;
- document.getElementById('opro').disabled = true;
- document.getElementById('opro').style = "color: #CCC;";
- document.getElementById('otco').checked = false;
- document.getElementById('otco').disabled = true;
- document.getElementById('otco').style = "color: #CCC;";
- document.getElementById('smallnote').hidden = false;
- } else {
- document.getElementById('otco').disabled = false;
- document.getElementById('otco').style = "color: #000;";
- if (this.oVerb.nPronominable == 0) {
- document.getElementById('opro').checked = false;
- document.getElementById('opro').disabled = false;
- document.getElementById('opro').style = "color: #000;";
- } else if (this.oVerb.nPronominable == 1) {
- document.getElementById('opro').checked = true;
- document.getElementById('opro').disabled = true;
- document.getElementById('opro').style = "color: #CCC;";
- } else { // -1 or 1 or error
- document.getElementById('opro').checked = false;
- document.getElementById('opro').disabled = true;
- document.getElementById('opro').style = "color: #CCC;";
- }
- document.getElementById('smallnote').hidden = true;
- }
- this._displayResults();
- }
- }
- }
- catch (e) {
- console.error(e);
- }
- },
-
- _displayResults: function () {
- if (this.oVerb === null) {
- return;
- }
- try {
- let bPro = document.getElementById('opro').checked;
- let bNeg = document.getElementById('oneg').checked;
- let bTCo = document.getElementById('otco').checked;
- let bInt = document.getElementById('oint').checked;
- let bFem = document.getElementById('ofem').checked;
- let oConjTable = this.oVerb.createConjTable(bPro, bNeg, bTCo, bInt, bFem);
- document.getElementById('verb').Text = "";
- // infinitif
- document.getElementById('infi').textContent = oConjTable["infi"] || " "; // something or nbsp
- // participe présent
- document.getElementById('ppre').textContent = oConjTable["ppre"] || " ";
- // participes passés
- document.getElementById('ppas1').textContent = oConjTable["ppas1"] || " ";
- document.getElementById('ppas2').textContent = oConjTable["ppas2"] || " ";
- document.getElementById('ppas3').textContent = oConjTable["ppas3"] || " ";
- document.getElementById('ppas4').textContent = oConjTable["ppas4"] || " ";
- // impératif
- document.getElementById('impe_temps').textContent = oConjTable["t_impe"] || " ";
- document.getElementById('impe1').textContent = oConjTable["impe1"] || " ";
- document.getElementById('impe2').textContent = oConjTable["impe2"] || " ";
- document.getElementById('impe3').textContent = oConjTable["impe3"] || " ";
- // présent
- document.getElementById('ipre_temps').textContent = oConjTable["t_ipre"] || " ";
- document.getElementById('ipre1').textContent = oConjTable["ipre1"] || " ";
- document.getElementById('ipre2').textContent = oConjTable["ipre2"] || " ";
- document.getElementById('ipre3').textContent = oConjTable["ipre3"] || " ";
- document.getElementById('ipre4').textContent = oConjTable["ipre4"] || " ";
- document.getElementById('ipre5').textContent = oConjTable["ipre5"] || " ";
- document.getElementById('ipre6').textContent = oConjTable["ipre6"] || " ";
- // imparfait
- document.getElementById('iimp_temps').textContent = oConjTable["t_iimp"] || " ";
- document.getElementById('iimp1').textContent = oConjTable["iimp1"] || " ";
- document.getElementById('iimp2').textContent = oConjTable["iimp2"] || " ";
- document.getElementById('iimp3').textContent = oConjTable["iimp3"] || " ";
- document.getElementById('iimp4').textContent = oConjTable["iimp4"] || " ";
- document.getElementById('iimp5').textContent = oConjTable["iimp5"] || " ";
- document.getElementById('iimp6').textContent = oConjTable["iimp6"] || " ";
- // passé simple
- document.getElementById('ipsi_temps').textContent = oConjTable["t_ipsi"] || " ";
- document.getElementById('ipsi1').textContent = oConjTable["ipsi1"] || " ";
- document.getElementById('ipsi2').textContent = oConjTable["ipsi2"] || " ";
- document.getElementById('ipsi3').textContent = oConjTable["ipsi3"] || " ";
- document.getElementById('ipsi4').textContent = oConjTable["ipsi4"] || " ";
- document.getElementById('ipsi5').textContent = oConjTable["ipsi5"] || " ";
- document.getElementById('ipsi6').textContent = oConjTable["ipsi6"] || " ";
- // futur
- document.getElementById('ifut_temps').textContent = oConjTable["t_ifut"] || " ";
- document.getElementById('ifut1').textContent = oConjTable["ifut1"] || " ";
- document.getElementById('ifut2').textContent = oConjTable["ifut2"] || " ";
- document.getElementById('ifut3').textContent = oConjTable["ifut3"] || " ";
- document.getElementById('ifut4').textContent = oConjTable["ifut4"] || " ";
- document.getElementById('ifut5').textContent = oConjTable["ifut5"] || " ";
- document.getElementById('ifut6').textContent = oConjTable["ifut6"] || " ";
- // Conditionnel
- document.getElementById('conda_temps').textContent = oConjTable["t_conda"] || " ";
- document.getElementById('conda1').textContent = oConjTable["conda1"] || " ";
- document.getElementById('conda2').textContent = oConjTable["conda2"] || " ";
- document.getElementById('conda3').textContent = oConjTable["conda3"] || " ";
- document.getElementById('conda4').textContent = oConjTable["conda4"] || " ";
- document.getElementById('conda5').textContent = oConjTable["conda5"] || " ";
- document.getElementById('conda6').textContent = oConjTable["conda6"] || " ";
- document.getElementById('condb_temps').textContent = oConjTable["t_condb"] || " ";
- document.getElementById('condb1').textContent = oConjTable["condb1"] || " ";
- document.getElementById('condb2').textContent = oConjTable["condb2"] || " ";
- document.getElementById('condb3').textContent = oConjTable["condb3"] || " ";
- document.getElementById('condb4').textContent = oConjTable["condb4"] || " ";
- document.getElementById('condb5').textContent = oConjTable["condb5"] || " ";
- document.getElementById('condb6').textContent = oConjTable["condb6"] || " ";
- // subjonctif présent
- document.getElementById('spre_temps').textContent = oConjTable["t_spre"] || " ";
- document.getElementById('spre1').textContent = oConjTable["spre1"] || " ";
- document.getElementById('spre2').textContent = oConjTable["spre2"] || " ";
- document.getElementById('spre3').textContent = oConjTable["spre3"] || " ";
- document.getElementById('spre4').textContent = oConjTable["spre4"] || " ";
- document.getElementById('spre5').textContent = oConjTable["spre5"] || " ";
- document.getElementById('spre6').textContent = oConjTable["spre6"] || " ";
- // subjonctif imparfait
- document.getElementById('simp_temps').textContent = oConjTable["t_simp"] || " ";
- document.getElementById('simp1').textContent = oConjTable["simp1"] || " ";
- document.getElementById('simp2').textContent = oConjTable["simp2"] || " ";
- document.getElementById('simp3').textContent = oConjTable["simp3"] || " ";
- document.getElementById('simp4').textContent = oConjTable["simp4"] || " ";
- document.getElementById('simp5').textContent = oConjTable["simp5"] || " ";
- document.getElementById('simp6').textContent = oConjTable["simp6"] || " ";
- }
- catch (e) {
- console.error(e);
- }
- }
-};
-
-conj.init(helpers.loadFile("resource://grammalecte/fr/conj_data.json"));
-oConj.init();
DELETED gc_lang/fr/mailext/content/conjugueur.xul
Index: gc_lang/fr/mailext/content/conjugueur.xul
==================================================================
--- gc_lang/fr/mailext/content/conjugueur.xul
+++ /dev/null
@@ -1,162 +0,0 @@
-
-
-
-
-
-
DELETED gc_lang/fr/mailext/content/gc_options.css
Index: gc_lang/fr/mailext/content/gc_options.css
==================================================================
--- gc_lang/fr/mailext/content/gc_options.css
+++ /dev/null
@@ -1,18 +0,0 @@
-/* CSS */
-
-.section {
- font-size: 16px;
- font-weight: bold;
- color: hsl(210, 50%, 50%);
-}
-
-.dialogheader-title {
- margin: 5px;
- padding: 5px 8px;
- border: 1px solid hsl(210, 50%, 80%);
- background-color: hsl(210, 50%, 50%);
- color: hsl(210, 10%, 90%);
- font-size: larger;
- font-weight: bold;
-}
-
DELETED gc_lang/fr/mailext/content/gc_options.js
Index: gc_lang/fr/mailext/content/gc_options.js
==================================================================
--- gc_lang/fr/mailext/content/gc_options.js
+++ /dev/null
@@ -1,53 +0,0 @@
-// 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);
- this.listen();
- },
- listen: function () {
- document.addEventListener("dialogaccept", (event) => {
- this.save();
- });
- document.addEventListener("dialogextra1", (event) => {
- this.reset();
- });
- },
- _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);
- }
- },
- 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);
- }
- },
- reset: function () {
- this._setDialogOptions(true);
- }
-}
-
-oOptControl.load();
DELETED gc_lang/fr/mailext/content/gc_options.xul
Index: gc_lang/fr/mailext/content/gc_options.xul
==================================================================
--- gc_lang/fr/mailext/content/gc_options.xul
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
-
-
DELETED gc_lang/fr/mailext/content/options.css
Index: gc_lang/fr/mailext/content/options.css
==================================================================
--- gc_lang/fr/mailext/content/options.css
+++ /dev/null
@@ -1,12 +0,0 @@
-/* CSS */
-
-
-.dialogheader-title {
- margin: 5px;
- padding: 5px 8px;
- border: 1px solid hsl(210, 50%, 80%);
- background-color: hsl(210, 50%, 50%);
- color: hsl(210, 10%, 90%);
- font-size: larger;
- font-weight: bold;
-}
DELETED gc_lang/fr/mailext/content/options.js
Index: gc_lang/fr/mailext/content/options.js
==================================================================
--- gc_lang/fr/mailext/content/options.js
+++ /dev/null
@@ -1,40 +0,0 @@
-// 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);
- }
- this.listen();
- },
-
- listen: function () {
- document.addEventListener("dialogaccept", (event) => {
- this.save();
- });
- },
-
- save: function () {
- try {
- prefs.setBoolPref('bCheckSignature', document.getElementById('check_signature').checked);
- }
- catch (e) {
- console.error(e);
- }
- }
-}
-
-oOptControl.load();
DELETED gc_lang/fr/mailext/content/options.xul
Index: gc_lang/fr/mailext/content/options.xul
==================================================================
--- gc_lang/fr/mailext/content/options.xul
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
DELETED gc_lang/fr/mailext/content/overlay.css
Index: gc_lang/fr/mailext/content/overlay.css
==================================================================
--- gc_lang/fr/mailext/content/overlay.css
+++ /dev/null
@@ -1,164 +0,0 @@
-#grammarchecker-toolbar-button {
- list-style-image: url("chrome://grammarchecker/skin/grammarcheck.png");
-}
-[iconsize="small"] #grammarchecker-toolbar-button {
- list-style-image: url("chrome://grammarchecker/skin/grammarcheck_small.png");
-}
-#grammarchecker-toolbar-button[disabled="true"] {
- list-style-image: url("chrome://grammarchecker/skin/grammarcheck_disabled.png");
-}
-[iconsize="small"] #grammarchecker-toolbar-button[disabled="true"] {
- list-style-image: url("chrome://grammarchecker/skin/grammarcheck_small_disabled.png");
-}
-
-#grammalecte-menu {
- list-style-image: url("chrome://grammarchecker/skin/grammarcheck.png");
-}
-menuitem#gl-item-analyze {
- list-style-image: url('chrome://grammarchecker/skin/grammarcheck.png');
-}
-
-#textformatter-panel {
- overflow: auto;
- height: 500px;
- max-height: 650px;
- color: hsl(0, 0%, 0%);
-}
-#textformatter-title {
- margin-top: 10px;
-}
-#textformatter-commands {
- margin: 10px 0;
-}
-#textformatter-infomsg {
- padding: 5px;
- font-size: 10px;
-}
-.optiongroup {
- color: hsl(210, 50%, 40%);
- font-size: 14px;
- font-weight: bold;
-}
-#textformatter-progressbar {
- width: 470px;
-}
-#textformatter-timer {
- padding: 5px;
-}
-
-
-#grammarchecker-panel {
- overflow: auto;
- margin-left: 0.5em;
- height: 400px;
- max-height: 600px;
-}
-
-#grammalecte-title {
- margin-top: 10px;
-}
-
-#grammalecte-infobox {
- display: block;
- margin: 20px 10px 5px 10px;
- padding: 10px;
- background-color: hsl(210, 20%, 40%);
- border-radius: 3px;
- color: hsl(210, 50%, 96%);
- font-weight: bold;
-}
-#grammalecte-info {
- padding: 1px 5px;
-}
-#closebutton {
- padding: 1px 5px;
- background-color: hsl(0, 50%, 50%);
- color: hsl(0, 10%, 96%);
- border-radius: 2px;
- cursor: pointer;
-}
-
-#grammalecte-errors div {
- display: block;
- /*display: list-item;
- list-style-position: inside;*/
- margin-top: 10px;
-}
-#grammalecte-errors p {
- display: block;
- margin-left: 10px;
- color: hsl(0, 0%, 0%);
-}
-#grammalecte-errors p.paragraph {
- margin-top: 20px;
- font-size: 16px;
- font-family: "Courier New", Courier, "Lucida Sans Typewriter", "Lucida Typewriter", monospace;
-}
-#grammalecte-errors p.message {
- margin-left: 20px;
-}
-#grammalecte-errors p.moreinfo {
- margin-left: 40px;
-}
-#grammalecte-errors p.suggestions {
- margin-left: 40px;
- color: hsl(120, 5%, 33%);
-}
-#grammalecte-errors span.suggestions_button {
- padding: 1px 6px;
- background-color: hsl(120, 40%, 60%);
- color: hsl(120, 10%, 96%);
- border-radius: 2px;
- cursor: pointer;
-}
-#grammalecte-errors {
- display: block;
-}
-
-a {
- font-weight: bold;
- color: hsl(30, 50%, 50%);
- text-decoration: underline;
- cursor: pointer;
-}
-.error {
- /* default color */
- background-color: hsl(210, 50%, 50%);
- color: hsl(210, 10%, 96%);
- font-weight: bold;
- border-radius: 3px;
- /*border-bottom: 2px solid hsl(210, 50%, 50%);*/
-}
-.errornum {
- color: hsl(210, 10%, 30%);
- font-weight: bold;
-}
-.sugg {
- padding: 1px 6px;
- background-color: hsl(120, 50%, 30%);
- color: hsl(210, 10%, 90%);
- border-radius: 2px;
- font-weight: bold;
- cursor: pointer;
-}
-.debug_info {
- color: hsl(0, 50%, 50%);
- font-style: italic;
-}
-
-.spell {
- background-color: hsl(0, 50%, 50%);
- color: hsl(0, 0%, 96%);
- border-radius: 3px;
-}
-
-
-.dialogheader-title {
- margin: 5px;
- padding: 5px 8px;
- border: 1px solid hsl(210, 50%, 80%);
- background-color: hsl(210, 50%, 50%);
- color: hsl(210, 10%, 90%);
- font-size: larger;
- font-weight: bold;
-}
DELETED gc_lang/fr/mailext/content/overlay.js
Index: gc_lang/fr/mailext/content/overlay.js
==================================================================
--- gc_lang/fr/mailext/content/overlay.js
+++ /dev/null
@@ -1,880 +0,0 @@
-// 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 xGrammalectePrefs = 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 = {
- dNumbers: new Map ([
- ["1", "¹"], ["2", "²"], ["3", "³"], ["4", "⁴"], ["5", "⁵"],
- ["6", "⁶"], ["7", "⁷"], ["8", "⁸"], ["9", "⁹"], ["0", "⁰"]
- ]),
- convert: function (sText) {
- let sRes = "";
- for (let c of sText) {
- sRes += (this.dNumbers.has(c)) ? this.dNumbers.get(c) : "⁻";
- }
- return sRes;
- }
-};
-
-
-var oGrammarChecker = {
- // you must use var to be able to call this object from elsewhere
- xGCEWorker: null,
- loadGC: function () {
- if (this.xGCEWorker === null) {
- // Grammar checker
- console.log('Loading Grammalecte');
- this.xGCEWorker = new BasePromiseWorker('chrome://promiseworker/content/gce_worker.js');
- let that = this;
- let xPromise = this.xGCEWorker.post('loadGrammarChecker', [xGrammalectePrefs.getCharPref("sGCOptions"), "Thunderbird"]);
- xPromise.then(
- function (aVal) {
- console.log(aVal);
- xGrammalectePrefs.setCharPref("sGCOptions", aVal);
- // spelling dictionary
- if (xGrammalectePrefs.getCharPref("sMainDicName")) {
- let sMainDicName = xGrammalectePrefs.getCharPref("sMainDicName");
- if (sMainDicName == "fr-classic.json" || sMainDicName == "fr-reform.json") {
- that.xGCEWorker.post("setDictionary", ["main", sMainDicName]);
- }
- }
- // personal dictionary
- if (xGrammalectePrefs.getBoolPref("bPersonalDictionary")) {
- let sDicJSON = oFileHandler.loadFile("fr.personal.json");
- if (sDicJSON) {
- that.xGCEWorker.post('setDictionary', ["personal", sDicJSON]);
- }
- }
- },
- function (aReason) { console.log('Promise rejected - ', aReason); }
- ).catch(
- function (aCaught) { console.log('Promise Error - ', aCaught); }
- );
- }
- },
- fullTests: function () {
- console.log('Performing tests... Wait...');
- let xPromise = this.xGCEWorker.post('fullTests', ['{"nbsp":true, "esp":true, "unit":true, "num":true}']);
- xPromise.then(
- function (aVal) {
- console.log('Done.');
- console.log(aVal);
- },
- function (aReason) { console.log('Promise rejected', aReason); }
- ).catch(
- function (aCaught) { console.log('Promise Error', aCaught); }
- );
- },
- test: function (sText) {
- console.log("Test...");
- let xPromise = this.xGCEWorker.post('parse', [sText, "FR", true]);
- xPromise.then(
- function (aVal) {
- let lErr = JSON.parse(aVal);
- if (lErr.length > 0) {
- for (let dErr of lErr) {
- console.log(text.getReadableError(dErr));
- }
- } else {
- console.log("no error found");
- }
- },
- function (aReason) { console.log('Promise rejected', aReason); }
- ).catch(
- function (aCaught) { console.log('Promise Error', aCaught); }
- );
- },
- setOptions: function () {
- console.log('Set options');
- let xPromise = this.xGCEWorker.post('setOptions', [xGrammalectePrefs.getCharPref("sGCOptions")]);
- xPromise.then(
- function (aVal) {
- console.log(aVal);
- xGrammalectePrefs.setCharPref("sGCOptions", aVal);
- },
- function (aReason) { console.log('Promise rejected', aReason); }
- ).catch(
- function (aCaught) { console.log('Promise Error', aCaught); }
- );
- },
- resetOptions: function () {
- let xPromise = this.xGCEWorker.post('resetOptions');
- xPromise.then(
- function (aVal) {
- console.log(aVal);
- xGrammalectePrefs.setCharPref("sGCOptions", aVal);
- },
- function (aReason) { console.log('Promise rejected', aReason); }
- ).catch(
- function (aCaught) { console.log('Promise Error', aCaught); }
- );
- },
- parse: async function () {
- this.clearPreview();
- this.openPanel();
- this.setInfo("Analyse en cours…");
- try {
- let xEditor = new Editor();
- let nParagraph = 0;
- let bIsError = false;
- for (let [iParagraph, sParagraph] of xEditor.getParagraphs()) {
- if (sParagraph.trim() !== "") {
- let sRes = await this.xGCEWorker.post('parseAndSpellcheck', [sParagraph, "FR", false, false]);
- let oRes = JSON.parse(sRes);
- if (oRes.aGrammErr.length > 0 || oRes.aSpellErr.length > 0) {
- document.getElementById("grammalecte-errors").appendChild(this.createResultNode(xEditor, sParagraph, iParagraph, oRes.aGrammErr, oRes.aSpellErr));
- bIsError = true;
- }
- nParagraph += 1;
- }
- }
- if (bIsError === false) {
- let xNodeP = document.createElement("p");
- xNodeP.setAttribute("class", "message");
- xNodeP.textContent = "Aucune erreur détectée…";
- document.getElementById("grammalecte-errors").appendChild(xNodeP);
- }
- this.setInfo("Nombre de paragraphes analysés : " + nParagraph);
- }
- catch (e) {
- this.setInfo("Erreur : " + e.message);
- console.error(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;
- },
- reparseParagraph: function (xEditor, iParagraph) {
- try {
- let that = this;
- let xResultNode = document.getElementById("resnode"+iParagraph);
- xResultNode.textContent = "…………… réanalyse en cours ……………";
- let sParagraph = xEditor.getParagraph(iParagraph);
- let xPromise = this.xGCEWorker.post('parseAndSpellcheck', [sParagraph, "FR", false, false]);
- xPromise.then(function (res) {
- xResultNode.textContent = "";
- let oRes = JSON.parse(res);
- if (oRes.aGrammErr.length > 0 || oRes.aSpellErr.length > 0) {
- that.fillResultNode(xResultNode, xEditor, sParagraph, iParagraph, oRes.aGrammErr, oRes.aSpellErr);
- }
- }, function (res) {
- xResultNode.textContent = "Erreur: " + res;
- });
- }
- catch (e) {
- console.error(e);
- }
- },
- fillResultNode: function (xResultNode, xEditor, sParagraph, iParagraph, aGrammErr, aSpellErr) {
- try {
- if (aGrammErr.length === 0 && aSpellErr.length === 0) {
- return null;
- }
- aGrammErr.push(...aSpellErr);
- aGrammErr.sort(function (a, b) {
- if (a["nStart"] < b["nStart"])
- return -1;
- if (a["nStart"] > b["nStart"])
- return 1;
- return 0;
- });
- let xParagraphNode = document.createElement("p");
- let lNodeError = [];
- let nEndLastErr = 0;
- let nError = 1;
- xParagraphNode.setAttribute("class", "paragraph");
- for (let dErr of aGrammErr) {
- let nStart = dErr["nStart"];
- let nEnd = dErr["nEnd"];
- if (nStart >= nEndLastErr) {
- xParagraphNode.appendChild(document.createTextNode(this._purgeTags(sParagraph.slice(nEndLastErr, nStart))));
- let xNodeError = document.createElement("b");
- if (dErr['sType'] !== 'WORD') {
- xNodeError.setAttribute("class", "error");
- xNodeError.textContent = oConverterToExponent.convert(nError.toString()) + sParagraph.slice(nStart, nEnd);
- xNodeError.style.backgroundColor = dErr["aColor"];
- xParagraphNode.appendChild(xNodeError);
- lNodeError.push(this._createNodeGCErrorDescription(xEditor, nError, dErr, iParagraph));
- }
- else {
- xNodeError.setAttribute("class", "error spell");
- xNodeError.textContent = oConverterToExponent.convert(nError.toString()) + sParagraph.slice(nStart, nEnd);
- xParagraphNode.appendChild(xNodeError);
- lNodeError.push(this._createNodeSpellErrorDescription(xEditor, nError, dErr, iParagraph));
- }
- nEndLastErr = nEnd;
- nError += 1;
- }
- }
- 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);
- xResultNode.textContent = "# Error: " + e.message;
- }
- },
- _createNodeGCErrorDescription: function (xEditor, nError, dErr, iParagraph) {
- let xNodeDiv = document.createElement("div");
- let that = this;
- // message
- let xNodeMessage = document.createElement("p");
- xNodeMessage.setAttribute("class", "message");
- let xNodeErrorNumber = document.createElement("b");
- xNodeErrorNumber.setAttribute("class", "errornum");
- xNodeErrorNumber.textContent = "[" + nError + "] ";
- xNodeMessage.appendChild(xNodeErrorNumber);
- xNodeMessage.appendChild(document.createTextNode(" " + dErr["sMessage"].replace(/ /g, " ") + " "));
- if (false) {
- // debug info
- let xNodeDebug = document.createElement("span");
- xNodeDebug.setAttribute("class", "debug_info");
- xNodeDebug.textContent = " #" + dErr["sRuleId"] + " #" + dErr["sLineId"];
- xNodeMessage.appendChild(xNodeDebug);
- }
- xNodeDiv.appendChild(xNodeMessage);
- // URL
- if (dErr["URL"]) {
- let xNodeP = document.createElement("p");
- xNodeP.setAttribute("class", "moreinfo");
- xNodeP.appendChild(document.createTextNode("→ "));
- let xNodeURL = document.createElement("a");
- xNodeURL.setAttribute("href", dErr["URL"]);
- xNodeURL.textContent = "Plus d’informations…";
- xNodeURL.addEventListener("click", function (e) {
- that.openInTabURL(dErr["URL"]);
- });
- xNodeP.appendChild(xNodeURL);
- xNodeDiv.appendChild(xNodeP);
- }
- // suggestions
- if (dErr["aSuggestions"].length > 0) {
- let xNodeSuggLine = document.createElement("p");
- xNodeSuggLine.setAttribute("class", "suggestions");
- xNodeSuggLine.textContent = "Suggestions : ";
- let n = 0;
- for (let sSugg of dErr["aSuggestions"]) {
- if (n > 0) {
- xNodeSuggLine.appendChild(document.createTextNode(" "));
- }
- let xNodeSugg = document.createElement("span");
- xNodeSugg.setAttribute("class", "sugg");
- xNodeSugg.textContent = sSugg.replace(" ", " "); // use nnbsp
- xNodeSugg.addEventListener("click", function (e) {
- xEditor.changeParagraph(iParagraph, sSugg, dErr["nStart"], dErr["nEnd"]);
- xNodeDiv.textContent = "";
- that.reparseParagraph(xEditor, iParagraph);
- });
- xNodeSuggLine.appendChild(xNodeSugg);
- n += 1;
- }
- xNodeDiv.appendChild(xNodeSuggLine);
- }
- return xNodeDiv;
- },
- _purgeTags: function (sText) {
- sText = sText.replace(/
/ig, " ");
- sText = sText.replace(//g, "");
- return sText.replace(/<\/? ?[a-zA-Z]+ ?>/g, "");
- },
- _createNodeSpellErrorDescription: function (xEditor, nError, dErr, iParagraph) {
- let xNodeDiv = document.createElement("div");
- let that = this;
- // message
- let xNodeMessage = document.createElement("p");
- xNodeMessage.setAttribute("class", "message");
- let xNodeErrorNumber = document.createElement("b");
- xNodeErrorNumber.setAttribute("class", "errornum");
- xNodeErrorNumber.textContent = "[" + nError + "] ";
- xNodeMessage.appendChild(xNodeErrorNumber);
- xNodeMessage.appendChild(document.createTextNode(" Mot inconnu du dictionnaire. "));
- xNodeDiv.appendChild(xNodeMessage);
- // suggestions
- let xNodeSuggLine = document.createElement("p");
- xNodeSuggLine.setAttribute("class", "suggestions");
- let xNodeSuggButton = document.createElement("span");
- xNodeSuggButton.setAttribute("class", "suggestions_button");
- xNodeSuggButton.textContent = "Suggestions : ";
- xNodeSuggButton.addEventListener("click", (e) => {
- let xPromise = this.xGCEWorker.post('suggest', [dErr['sValue'], 10]);
- xPromise.then(
- function (sVal) {
- if (sVal != "") {
- let lSugg = sVal.split("|");
- let n = 0;
- for (let sSugg of lSugg) {
- xNodeSuggLine.appendChild(document.createTextNode(" "));
- let xNodeSugg = document.createElement("span");
- xNodeSugg.setAttribute("class", "sugg");
- xNodeSugg.textContent = sSugg;
- xNodeSugg.addEventListener("click", function (e) {
- xEditor.changeParagraph(iParagraph, xNodeSugg.textContent, dErr["nStart"], dErr["nEnd"]);
- xNodeDiv.textContent = "";
- that.reparseParagraph(xEditor, iParagraph);
- });
- xNodeSuggLine.appendChild(xNodeSugg);
- n += 1;
- }
- } else {
- xNodeSuggLine.appendChild(document.createTextNode("Aucune suggestion."));
- }
- },
- function (aReason) { console.error('Promise rejected - ', aReason); }
- ).catch(
- function (aCaught) { console.error('Promise Error - ', aCaught); }
- );
- });
- xNodeSuggLine.appendChild(xNodeSuggButton);
- xNodeDiv.appendChild(xNodeSuggLine);
- return xNodeDiv;
- },
- loadUI: function () {
- this._strings = document.getElementById("grammarchecker-strings");
- let that = this;
- let nsGrammarCommand = {
- isCommandEnabled: function (aCommand, dummy) {
- return (IsDocumentEditable() && !IsInHTMLSourceMode());
- },
- getCommandStateParams: function (aCommand, aParams, aRefCon) {},
- doCommandParams: function (aCommand, aParams, aRefCon) {},
- doCommand: function (aCommand) {
- that.onParseText(aCommand);
- }
- };
- let xCommandTable = GetComposerCommandTable();
- xCommandTable.registerCommand("cmd_grammar", nsGrammarCommand);
- let sButtonId = "grammarchecker-toolbar-button";
- let sButtonId2 = "grammalecte-menu";
- let xNavBar = document.getElementById("composeToolbar2");
- let lCurSet = xNavBar.currentSet.split(",");
- if (lCurSet.indexOf(sButtonId) == -1) {
- let iPos = lCurSet.indexOf("spellingButton") + 1 || lCurSet.length;
- let aSet = lCurSet.slice(0, iPos).concat(sButtonId).concat(sButtonId2).concat(lCurSet.slice(iPos));
- xNavBar.setAttribute("currentset", aSet.join(","));
- //xNavBar.currentSet = aSet.join(",");
- Services.xulStore.persist(xNavBar, "currentset");
- //Ci.BrowserToolboxCustomizeDone(true);
- }
- },
- 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);
- }
- }
- 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);
- }
- },
- 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);
- }
- },
- openInBrowserURL: function (sURL) {
- // method found in S3.Google.Translator
- try {
- openURL(sURL);
- }
- catch (e) {
- console.error(e);
- }
- },
- onParseText: function (e) {
- this.parse();
- },
- onClosePanel: function (e) {
- this.closePanel();
- },
- onOpenGCOptions: function (e) {
- let that = this;
- let xPromise = this.xGCEWorker.post('getDefaultOptions');
- xPromise.then(
- function (aVal) {
- console.log(aVal);
- xGrammalectePrefs.setCharPref("sGCDefaultOptions", aVal);
- },
- function (aReason) { console.log('Promise rejected', aReason); }
- ).catch(
- function (aCaught) { console.log('Promise Error', aCaught); }
- ).then(
- function () {
- that.openDialog("chrome://grammarchecker/content/gc_options.xul", "", "chrome, dialog, modal, resizable=no");
- that.setOptions();
- },
- function (aReason) { console.log('Error options dialog', aReason); }
- ).catch(
- function (aCaught) { console.log('Error', aCaught); }
- );
- },
- onOpenSpellOptions: function (e) {
- this.openDialog("chrome://grammarchecker/content/spell_options.xul", "", "chrome, dialog, modal, resizable=no");
- },
- onOpenOptions: function (e) {
- this.openDialog("chrome://grammarchecker/content/options.xul", "", "chrome, dialog, modal, resizable=no");
- },
- onOpenTextFormatter: function (e) {
- oTextFormatter.openPanel();
- },
- onOpenConjugueur: function (e) {
- this.openDialog("chrome://grammarchecker/content/conjugueur.xul", "", "chrome, resizable=no");
- },
- onOpenLexiconEditor: function (e) {
- this.openDialog("chrome://grammarchecker/content/lex_editor.xul", "", "chrome, resizable=no");
- },
- onAbout: function (e) {
- this.openDialog("chrome://grammarchecker/content/about.xul", "", "chrome, dialog, modal, resizable=no");
- }
-};
-
-
-var oTextFormatter = {
- init: function () {
- try {
- this.closePanel();
- this.listen();
- let sTFOptions = xGrammalectePrefs.getCharPref("sTFOptions");
- if (sTFOptions !== "") {
- this.setOptionsInPanel(JSON.parse(sTFOptions));
- this.resetProgressBar();
- } else {
- this.reset();
- }
- }
- catch (e) {
- console.error(e);
- }
- },
- listen: function () {
- window.addEventListener("click", (xEvent) => {
- let xElem = xEvent.target;
- if (xElem.id && xElem.id.startsWith("o_group_")) {
- this.switchGroup(xElem.id);
- this.resetProgressBar();
- }
- }, false);
- },
- 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);
- }
- },
- saveOptions: function () {
- let oOptions = {};
- for (let xNode of document.getElementsByClassName("option")) {
- oOptions[xNode.id] = xNode.checked;
- }
- //console.log("save options: " + JSON.stringify(oOptions));
- xGrammalectePrefs.setCharPref("sTFOptions", JSON.stringify(oOptions));
- },
- setOptionsInPanel: function (oOptions) {
- for (let sOptName in oOptions) {
- //console.log(sOptName + ":" + oOptions[sOptName]);
- if (document.getElementById(sOptName) !== null) {
- document.getElementById(sOptName).checked = oOptions[sOptName];
- if (sOptName.startsWith("o_group_")) {
- this.switchGroup(sOptName);
- }
- if (document.getElementById("res_"+sOptName) !== null) {
- document.getElementById("res_"+sOptName).textContent = "";
- }
- }
- }
- },
- switchGroup: function (sOptName) {
- if (document.getElementById(sOptName).checked) {
- document.getElementById(sOptName.slice(2)).style.opacity = 1;
- } else {
- document.getElementById(sOptName.slice(2)).style.opacity = 0.3;
- }
- },
- reset: function () {
- try {
- this.resetProgressBar();
- for (let xNode of document.getElementsByClassName('option')) {
- xNode.checked = (xNode.getAttribute('data-default') === "true");
- if (xNode.id.startsWith("o_group_")) {
- this.switchGroup(xNode.id);
- }
- }
- }
- catch (e) {
- console.error(e);
- }
- },
- resetProgressBar: function () {
- document.getElementById('textformatter-progressbar').value = 0;
- document.getElementById('textformatter-timer').textContent = "";
- },
- getTimeRes: function (n) {
- // returns duration in seconds as string
- if (n < 10) {
- return n.toFixed(3).toString() + " s";
- }
- if (n < 100) {
- return n.toFixed(2).toString() + " s";
- }
- if (n < 1000) {
- return n.toFixed(1).toString() + " s";
- }
- return n.toFixed().toString() + " s";
- },
- openPanel: function () {
- document.getElementById("grammarchecker-splitter").setAttribute("state", "collapsed");
- document.getElementById("textformatter-splitter").setAttribute("state", "open");
- },
- closePanel: function () {
- document.getElementById("textformatter-splitter").setAttribute("state", "collapsed");
- },
- onOpenPanel: function (e) {
- this.openPanel();
- },
- onClosePanel: function (e) {
- this.closePanel();
- },
- onApply: function (e) {
- this.apply();
- },
- onReset: function (e) {
- this.reset();
- },
- //
- applyOptions: function (sText) {
- try {
- const t0 = Date.now();
- //window.setCursor("wait"); // change pointer
- document.getElementById('textformatter-progressbar').value = 0;
- document.getElementById('textformatter-progressbar').max = 6;
- let n1 = 0, n2 = 0, n3 = 0, n4 = 0, n5 = 0, n6 = 0, n7 = 0;
-
- // espaces surnuméraires
- if (document.getElementById("o_group_ssp").checked) {
- if (document.getElementById("o_end_of_paragraph").checked) {
- [sText, n1] = this.formatText(sText, "end_of_paragraph");
- document.getElementById('res_o_end_of_paragraph').textContent = n1;
- }
- if (document.getElementById("o_between_words").checked) {
- [sText, n1] = this.formatText(sText, "between_words");
- document.getElementById('res_o_between_words').textContent = n1;
- }
- if (document.getElementById("o_start_of_paragraph").checked) {
- [sText, n1] = this.formatText(sText, "start_of_paragraph");
- document.getElementById('res_o_start_of_paragraph').textContent = n1;
- }
- if (document.getElementById("o_before_punctuation").checked) {
- [sText, n1] = this.formatText(sText, "before_punctuation");
- document.getElementById('res_o_before_punctuation').textContent = n1;
- }
- if (document.getElementById("o_within_parenthesis").checked) {
- [sText, n1] = this.formatText(sText, "within_parenthesis");
- document.getElementById('res_o_within_parenthesis').textContent = n1;
- }
- if (document.getElementById("o_within_square_brackets").checked) {
- [sText, n1] = this.formatText(sText, "within_square_brackets");
- document.getElementById('res_o_within_square_brackets').textContent = n1;
- }
- if (document.getElementById("o_within_quotation_marks").checked) {
- [sText, n1] = this.formatText(sText, "within_quotation_marks");
- document.getElementById('res_o_within_quotation_marks').textContent = n1;
- }
- document.getElementById("o_group_ssp").checked = false;
- this.switchGroup("o_group_ssp");
- }
- document.getElementById('textformatter-progressbar').value = 1;
-
- // espaces insécables
- if (document.getElementById("o_group_nbsp").checked) {
- if (document.getElementById("o_nbsp_before_punctuation").checked) {
- [sText, n1] = this.formatText(sText, "nbsp_before_punctuation");
- [sText, n2] = this.formatText(sText, "nbsp_repair");
- document.getElementById('res_o_nbsp_before_punctuation').textContent = n1 - n2;
- }
- if (document.getElementById("o_nbsp_within_quotation_marks").checked) {
- [sText, n1] = this.formatText(sText, "nbsp_within_quotation_marks");
- document.getElementById('res_o_nbsp_within_quotation_marks').textContent = n1;
- }
- if (document.getElementById("o_nbsp_before_symbol").checked) {
- [sText, n1] = this.formatText(sText, "nbsp_before_symbol");
- document.getElementById('res_o_nbsp_before_symbol').textContent = n1;
- }
- if (document.getElementById("o_nbsp_within_numbers").checked) {
- [sText, n1] = this.formatText(sText, "nbsp_within_numbers");
- document.getElementById('res_o_nbsp_within_numbers').textContent = n1;
- }
- if (document.getElementById("o_nbsp_before_units").checked) {
- [sText, n1] = this.formatText(sText, "nbsp_before_units");
- document.getElementById('res_o_nbsp_before_units').textContent = n1;
- }
- if (document.getElementById("o_nbsp_titles").checked) {
- [sText, n1] = this.formatText(sText, "nbsp_titles");
- document.getElementById('res_o_nbsp_titles').textContent = n1;
- }
- document.getElementById("o_group_nbsp").checked = false;
- this.switchGroup("o_group_nbsp");
- }
- document.getElementById('textformatter-progressbar').value = 2;
-
- // espaces manquants
- if (document.getElementById("o_group_typo").checked) {
- if (document.getElementById("o_ts_units").checked) {
- [sText, n1] = this.formatText(sText, "ts_units");
- document.getElementById('res_o_ts_units').textContent = n1;
- }
- }
- if (document.getElementById("o_group_space").checked) {
- if (document.getElementById("o_add_space_after_punctuation").checked) {
- [sText, n1] = this.formatText(sText, "add_space_after_punctuation");
- [sText, n2] = this.formatText(sText, "add_space_repair");
- document.getElementById('res_o_add_space_after_punctuation').textContent = n1 - n2;
- }
- if (document.getElementById("o_add_space_around_hyphens").checked) {
- [sText, n1] = this.formatText(sText, "add_space_around_hyphens");
- document.getElementById('res_o_add_space_around_hyphens').textContent = n1;
- }
- document.getElementById("o_group_space").checked = false;
- this.switchGroup("o_group_space");
- }
- document.getElementById('textformatter-progressbar').value = 3;
-
- // suppression
- if (document.getElementById("o_group_delete").checked) {
- if (document.getElementById("o_erase_non_breaking_hyphens").checked) {
- [sText, n1] = this.formatText(sText, "erase_non_breaking_hyphens");
- document.getElementById('res_o_erase_non_breaking_hyphens').textContent = n1;
- }
- document.getElementById("o_group_delete").checked = false;
- this.switchGroup("o_group_delete");
- }
- document.getElementById('textformatter-progressbar').value = 4;
-
- // signes typographiques
- if (document.getElementById("o_group_typo").checked) {
- if (document.getElementById("o_ts_apostrophe").checked) {
- [sText, n1] = this.formatText(sText, "ts_apostrophe");
- document.getElementById('res_o_ts_apostrophe').textContent = n1;
- }
- if (document.getElementById("o_ts_ellipsis").checked) {
- [sText, n1] = this.formatText(sText, "ts_ellipsis");
- document.getElementById('res_o_ts_ellipsis').textContent = n1;
- }
- if (document.getElementById("o_ts_dash_start").checked) {
- if (document.getElementById("o_ts_m_dash_start").checked) {
- [sText, n1] = this.formatText(sText, "ts_m_dash_start");
- } else {
- [sText, n1] = this.formatText(sText, "ts_n_dash_start");
- }
- document.getElementById('res_o_ts_dash_start').textContent = n1;
- }
- if (document.getElementById("o_ts_dash_middle").checked) {
- if (document.getElementById("o_ts_m_dash_middle").checked) {
- [sText, n1] = this.formatText(sText, "ts_m_dash_middle");
- } else {
- [sText, n1] = this.formatText(sText, "ts_n_dash_middle");
- }
- document.getElementById('res_o_ts_dash_middle').textContent = n1;
- }
- if (document.getElementById("o_ts_quotation_marks").checked) {
- [sText, n1] = this.formatText(sText, "ts_quotation_marks");
- document.getElementById('res_o_ts_quotation_marks').textContent = n1;
- }
- if (document.getElementById("o_ts_spell").checked) {
- [sText, n1] = this.formatText(sText, "ts_spell");
- document.getElementById('res_o_ts_spell').textContent = n1;
- }
- if (document.getElementById("o_ts_ligature").checked) {
- // ligatures typographiques : fi, fl, ff, ffi, ffl, ft, st
- if (document.getElementById("o_ts_ligature_do").checked) {
- if (document.getElementById("o_ts_ligature_ffi").checked) {
- [sText, n1] = this.formatText(sText, "ts_ligature_ffi_do");
- }
- if (document.getElementById("o_ts_ligature_ffl").checked) {
- [sText, n2] = this.formatText(sText, "ts_ligature_ffl_do");
- }
- if (document.getElementById("o_ts_ligature_fi").checked) {
- [sText, n3] = this.formatText(sText, "ts_ligature_fi_do");
- }
- if (document.getElementById("o_ts_ligature_fl").checked) {
- [sText, n4] = this.formatText(sText, "ts_ligature_fl_do");
- }
- if (document.getElementById("o_ts_ligature_ff").checked) {
- [sText, n5] = this.formatText(sText, "ts_ligature_ff_do");
- }
- if (document.getElementById("o_ts_ligature_ft").checked) {
- [sText, n6] = this.formatText(sText, "ts_ligature_ft_do");
- }
- if (document.getElementById("o_ts_ligature_st").checked) {
- [sText, n7] = this.formatText(sText, "ts_ligature_st_do");
- }
- }
- if (document.getElementById("o_ts_ligature_undo").checked) {
- if (document.getElementById("o_ts_ligature_ffi").checked) {
- [sText, n1] = this.formatText(sText, "ts_ligature_ffi_undo");
- }
- if (document.getElementById("o_ts_ligature_ffl").checked) {
- [sText, n2] = this.formatText(sText, "ts_ligature_ffl_undo");
- }
- if (document.getElementById("o_ts_ligature_fi").checked) {
- [sText, n3] = this.formatText(sText, "ts_ligature_fi_undo");
- }
- if (document.getElementById("o_ts_ligature_fl").checked) {
- [sText, n4] = this.formatText(sText, "ts_ligature_fl_undo");
- }
- if (document.getElementById("o_ts_ligature_ff").checked) {
- [sText, n5] = this.formatText(sText, "ts_ligature_ff_undo");
- }
- if (document.getElementById("o_ts_ligature_ft").checked) {
- [sText, n6] = this.formatText(sText, "ts_ligature_ft_undo");
- }
- if (document.getElementById("o_ts_ligature_st").checked) {
- [sText, n7] = this.formatText(sText, "ts_ligature_st_undo");
- }
- }
- document.getElementById('res_o_ts_ligature').textContent = n1 + n2 + n3 + n4 + n5 + n6 + n7;
- }
- document.getElementById("o_group_typo").checked = false;
- this.switchGroup("o_group_typo");
- }
- document.getElementById('textformatter-progressbar').value = 5;
-
- // divers
- if (document.getElementById("o_group_misc").checked) {
- if (document.getElementById("o_ordinals_no_exponant").checked) {
- if (document.getElementById("o_ordinals_exponant").checked) {
- [sText, n1] = this.formatText(sText, "ordinals_exponant");
- } else {
- [sText, n1] = this.formatText(sText, "ordinals_no_exponant");
- }
- document.getElementById('res_o_ordinals_no_exponant').textContent = n1;
- }
- if (document.getElementById("o_etc").checked) {
- [sText, n1] = this.formatText(sText, "etc");
- document.getElementById('res_o_etc').textContent = n1;
- }
- if (document.getElementById("o_missing_hyphens").checked) {
- [sText, n1] = this.formatText(sText, "missing_hyphens");
- document.getElementById('res_o_missing_hyphens').textContent = n1;
- }
- if (document.getElementById("o_ma_word").checked) {
- [sText, n1] = this.formatText(sText, "ma_word");
- if (document.getElementById("o_ma_1letter_lowercase").checked) {
- [sText, n1] = this.formatText(sText, "ma_1letter_lowercase");
- if (document.getElementById("o_ma_1letter_uppercase").checked) {
- [sText, n1] = this.formatText(sText, "ma_1letter_uppercase");
- }
- }
- document.getElementById('res_o_ma_word').textContent = n1;
- }
- document.getElementById("o_group_misc").checked = false;
- this.switchGroup("o_group_misc");
- }
- document.getElementById('textformatter-progressbar').value = document.getElementById('textformatter-progressbar').max;
- // end of processing
-
- //window.setCursor("auto"); // restore pointer
- const t1 = Date.now();
- document.getElementById('textformatter-timer').textContent = this.getTimeRes((t1-t0)/1000);
- }
- catch (e) {
- console.error(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);
- }
- return [sText, nCount];
- }
-}
-
-
-/* EVENTS */
-
-window.addEventListener("load", function (xEvent) {
- oGrammarChecker.loadGC();
- //oGrammarChecker.fullTests();
-}, false);
-
-window.addEventListener("compose-window-init", function (xEvent) {
- oGrammarChecker.loadUI();
- oGrammarChecker.closePanel();
- oGrammarChecker.clearPreview();
- oTextFormatter.init();
-}, true);
DELETED gc_lang/fr/mailext/content/overlay.xul
Index: gc_lang/fr/mailext/content/overlay.xul
==================================================================
--- gc_lang/fr/mailext/content/overlay.xul
+++ /dev/null
@@ -1,377 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- &tf_infomsg;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
DELETED gc_lang/fr/mailext/content/spell_options.css
Index: gc_lang/fr/mailext/content/spell_options.css
==================================================================
--- gc_lang/fr/mailext/content/spell_options.css
+++ /dev/null
@@ -1,46 +0,0 @@
-/* CSS */
-
-#grouptitle {
- font-size: 16px;
- font-weight: bold;
- color: hsl(0, 50%, 50%);
-}
-
-.option {
- font-size: 16px;
- font-weight: bold;
- color: hsl(210, 50%, 50%);
-}
-
-.suboption {
- margin-left: 30px;
- font-size: 16px;
- font-weight: bold;
- color: hsl(210, 50%, 50%);
-}
-.suboption2 {
- margin-left: 30px;
-}
-
-description {
- width: 340px;
-}
-
-.dicdescr {
- margin-left: 27px;
-}
-
-.disabled {
- opacity: .25;
-}
-
-
-.dialogheader-title {
- margin: 5px;
- padding: 5px 8px;
- border: 1px solid hsl(210, 50%, 80%);
- background-color: hsl(210, 50%, 50%);
- color: hsl(210, 10%, 90%);
- font-size: larger;
- font-weight: bold;
-}
DELETED gc_lang/fr/mailext/content/spell_options.js
Index: gc_lang/fr/mailext/content/spell_options.js
==================================================================
--- gc_lang/fr/mailext/content/spell_options.js
+++ /dev/null
@@ -1,76 +0,0 @@
-// 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 {
- // center window
- document.getElementById('grammalecte-spelloptions-window').centerWindowOnScreen();
- // main spelling dictionary
- let sMainDicName = prefs.getCharPref('sMainDicName');
- console.log("spelling dictionary:", sMainDicName);
- if (sMainDicName == "fr-classic.json") {
- document.getElementById("classic").checked = true;
- }
- else if (sMainDicName == "fr-reform.json") {
- document.getElementById("reform").checked = true;
- }
- else if (sMainDicName == "fr-allvars.json") {
- document.getElementById("allvars").checked = true;
- }
- // personal dictionary
- document.getElementById('personal_dic').checked = prefs.getBoolPref('bPersonalDictionary');
- // listen
- this.listen();
- }
- catch (e) {
- console.error(e);
- }
- },
- listen: function () {
- document.addEventListener("dialogaccept", (event) => {
- oDialogControl.setDictionaries();
- });
- document.getElementById("classic").addEventListener("click", (event) => {
- oDialogControl.changeMainDicUI("classic");
- });
- document.getElementById("reform").addEventListener("click", (event) => {
- oDialogControl.changeMainDicUI("reform");
- });
- document.getElementById("allvars").addEventListener("click", (event) => {
- oDialogControl.changeMainDicUI("allvars");
- });
- },
- changeMainDicUI (sDic) {
- document.getElementById("classic").checked = ("classic" === sDic);
- document.getElementById("reform").checked = ("reform" === sDic);
- document.getElementById("allvars").checked = ("allvars" === sDic);
- },
- setDictionaries: function () {
- //oSpellControl.init();
- // main spelling dictionary
- let sMainDicName = "";
- if (document.getElementById("classic").checked) {
- sMainDicName = "fr-classic.json";
- }
- else if (document.getElementById("reform").checked) {
- sMainDicName = "fr-reform.json";
- }
- else if (document.getElementById("allvars").checked) {
- sMainDicName = "fr-allvars.json";
- }
- console.log("selected spelling dictionary:", sMainDicName);
- prefs.setCharPref("sMainDicName", sMainDicName);
- // personal dictionary
- let bActivate = document.getElementById('personal_dic').checked;
- prefs.setBoolPref("bPersonalDictionary", bActivate);
- }
-};
DELETED gc_lang/fr/mailext/content/spell_options.xul
Index: gc_lang/fr/mailext/content/spell_options.xul
==================================================================
--- gc_lang/fr/mailext/content/spell_options.xul
+++ /dev/null
@@ -1,67 +0,0 @@
-
-
-
-
-
-
-
DELETED gc_lang/fr/mailext/content/spellchecker.js
Index: gc_lang/fr/mailext/content/spellchecker.js
==================================================================
--- gc_lang/fr/mailext/content/spellchecker.js
+++ /dev/null
@@ -1,144 +0,0 @@
-// JavaScript
-
-/*
- Hunspell wrapper
-
- XPCOM obsolete (?), but there is nothing else...
- Overly complicated and weird. To throw away ASAP if possible.
-
- And you can’t access to this from a PromiseWorker (it sucks).
-
- https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/mozISpellCheckingEngine
- https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/Using_spell_checking_in_XUL
- https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIFile
- https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/FileUtils.jsm
-*/
-
-"use strict";
-
-
-const { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
-const { AddonManager } = ChromeUtils.import("resource://gre/modules/AddonManager.jsm");
-
-
-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);
- }
- }
- },
- getDictionariesList: function () {
- this.init();
- try {
- let l = {};
- let c = {};
- this.xSCEngine.getDictionaryList(l, c);
- return l.value;
- }
- catch (e) {
- console.error(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);
- 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);
- 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);
- 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);
- }
- },
- 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);
- }
- },
- setExtensionDictFolder: function (sDictName, bActivate) {
- try {
- let that = this;
- let sPath = "/content/dictionaries/" + sDictName;
- AddonManager.getAddonByID("French-GC-TB@grammalecte.net")
- .then(function (xAddon) {
- let xURI = xAddon.getResourceURI(sPath);
- //console.log(xURI);
- let sFolder = xURI.filePath;
- if (sFolder !== undefined) {
- if (/^\/[A-Z]:\//.test(sFolder)) {
- // Windows path
- sFolder = sFolder.slice(1).replace(/\//g, "\\\\");
- }
- console.log("folder: " + sFolder);
- if (bActivate) {
- that.addDirectory(sFolder);
- } else {
- that.removeDirectory(sFolder);
- }
- }
- });
- }
- catch (e) {
- console.log("Unable to add extension folder");
- console.error(e);
- }
- }
-};
DELETED gc_lang/fr/mailext/defaults/preferences/grammarchecker.js
Index: gc_lang/fr/mailext/defaults/preferences/grammarchecker.js
==================================================================
--- gc_lang/fr/mailext/defaults/preferences/grammarchecker.js
+++ /dev/null
@@ -1,10 +0,0 @@
-pref("extensions.grammarchecker.sGCOptions", "");
-pref("extensions.grammarchecker.sTFOptions", "");
-pref("extensions.grammarchecker.bDictModern", false);
-pref("extensions.grammarchecker.bDictClassic", true);
-pref("extensions.grammarchecker.bDictReform", false);
-pref("extensions.grammarchecker.bDictClassicReform", false);
-pref("extensions.grammarchecker.bCheckSignature", true);
-pref("extensions.grammarchecker.sMainDicName", "fr-allvars.json");
-pref("extensions.grammarchecker.bCommunityDictionary", false);
-pref("extensions.grammarchecker.bPersonalDictionary", true);
DELETED gc_lang/fr/mailext/locale/en/about.dtd
Index: gc_lang/fr/mailext/locale/en/about.dtd
==================================================================
--- gc_lang/fr/mailext/locale/en/about.dtd
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
DELETED gc_lang/fr/mailext/locale/en/gc_options.dtd
Index: gc_lang/fr/mailext/locale/en/gc_options.dtd
==================================================================
--- gc_lang/fr/mailext/locale/en/gc_options.dtd
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-${gc_options_labels_en}
DELETED gc_lang/fr/mailext/locale/en/grammarchecker.properties
Index: gc_lang/fr/mailext/locale/en/grammarchecker.properties
==================================================================
--- gc_lang/fr/mailext/locale/en/grammarchecker.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-processingMessage=Parsing in progress…
-errorMessage=Error…
-noErrorMessage=No error detected.
DELETED gc_lang/fr/mailext/locale/en/lex_editor.dtd
Index: gc_lang/fr/mailext/locale/en/lex_editor.dtd
==================================================================
--- gc_lang/fr/mailext/locale/en/lex_editor.dtd
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
DELETED gc_lang/fr/mailext/locale/en/options.dtd
Index: gc_lang/fr/mailext/locale/en/options.dtd
==================================================================
--- gc_lang/fr/mailext/locale/en/options.dtd
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
DELETED gc_lang/fr/mailext/locale/en/overlay.dtd
Index: gc_lang/fr/mailext/locale/en/overlay.dtd
==================================================================
--- gc_lang/fr/mailext/locale/en/overlay.dtd
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
DELETED gc_lang/fr/mailext/locale/en/spell_options.dtd
Index: gc_lang/fr/mailext/locale/en/spell_options.dtd
==================================================================
--- gc_lang/fr/mailext/locale/en/spell_options.dtd
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
DELETED gc_lang/fr/mailext/locale/fr/about.dtd
Index: gc_lang/fr/mailext/locale/fr/about.dtd
==================================================================
--- gc_lang/fr/mailext/locale/fr/about.dtd
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
DELETED gc_lang/fr/mailext/locale/fr/gc_options.dtd
Index: gc_lang/fr/mailext/locale/fr/gc_options.dtd
==================================================================
--- gc_lang/fr/mailext/locale/fr/gc_options.dtd
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-${gc_options_labels_fr}
DELETED gc_lang/fr/mailext/locale/fr/grammarchecker.properties
Index: gc_lang/fr/mailext/locale/fr/grammarchecker.properties
==================================================================
--- gc_lang/fr/mailext/locale/fr/grammarchecker.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-processingMessage=Analyse en cours
-errorMessage=Erreur…
-noErrorMessage=Aucune erreur détectée.
DELETED gc_lang/fr/mailext/locale/fr/lex_editor.dtd
Index: gc_lang/fr/mailext/locale/fr/lex_editor.dtd
==================================================================
--- gc_lang/fr/mailext/locale/fr/lex_editor.dtd
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
DELETED gc_lang/fr/mailext/locale/fr/options.dtd
Index: gc_lang/fr/mailext/locale/fr/options.dtd
==================================================================
--- gc_lang/fr/mailext/locale/fr/options.dtd
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
DELETED gc_lang/fr/mailext/locale/fr/overlay.dtd
Index: gc_lang/fr/mailext/locale/fr/overlay.dtd
==================================================================
--- gc_lang/fr/mailext/locale/fr/overlay.dtd
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
DELETED gc_lang/fr/mailext/locale/fr/spell_options.dtd
Index: gc_lang/fr/mailext/locale/fr/spell_options.dtd
==================================================================
--- gc_lang/fr/mailext/locale/fr/spell_options.dtd
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
DELETED gc_lang/fr/mailext/worker/gce_worker.js
Index: gc_lang/fr/mailext/worker/gce_worker.js
==================================================================
--- gc_lang/fr/mailext/worker/gce_worker.js
+++ /dev/null
@@ -1,161 +0,0 @@
-// JavaScript
-
-// Grammar checker engine
-// PromiseWorker
-// This code is executed in a separate thread (×20 faster too!!!)
-
-// Firefox WTF: it’s impossible to use require as in the main thread here,
-// so it is required to declare a resource in the file “chrome.manifest”.
-
-
-"use strict";
-
-// copy/paste
-// https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/PromiseWorker.jsm
-
-importScripts("resource://gre/modules/workers/require.js");
-let PromiseWorker = require("resource://gre/modules/workers/PromiseWorker.js");
-
-// Instantiate AbstractWorker (see below).
-let worker = new PromiseWorker.AbstractWorker();
-
-worker.dispatch = function(method, args = []) {
- // Dispatch a call to method `method` with args `args`
- return self[method](...args);
-};
-worker.postMessage = function(...args) {
- // Post a message to the main thread
- self.postMessage(...args);
-};
-worker.close = function() {
- // Close the worker
- self.close();
-};
-worker.log = function(...args) {
- // Log (or discard) messages (optional)
- dump("Worker: " + args.join(" ") + "\n");
-};
-
-// Connect it to message port.
-self.addEventListener("message", msg => worker.handleMessage(msg));
-
-// end of copy/paste
-
-
-// no console here, use “dump”
-
-let gce = null; // module: grammar checker engine
-let text = null;
-let tkz = null; // module: tokenizer
-let lxg = null; // module: lexicographer
-let helpers = null;
-
-let oTokenizer = null;
-let oSpellChecker = null;
-let oLxg = null;
-
-function loadGrammarChecker (sGCOptions="", sContext="JavaScript") {
- if (gce === null) {
- try {
- gce = require("resource://grammalecte/fr/gc_engine.js");
- helpers = require("resource://grammalecte/graphspell/helpers.js");
- text = require("resource://grammalecte/text.js");
- tkz = require("resource://grammalecte/graphspell/tokenizer.js");
- //lxg = require("resource://grammalecte/fr/lexicographe.js");
- oTokenizer = new tkz.Tokenizer("fr");
- gce.load(sContext, "sCSS");
- oSpellChecker = gce.getSpellChecker();
- if (sGCOptions !== "") {
- gce.setOptions(helpers.objectToMap(JSON.parse(sGCOptions)));
- }
- // we always retrieve options from the gce, for setOptions filters obsolete options
- return gce.getOptions().gl_toString();
- }
- catch (e) {
- console.log("# Error: " + e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message);
- }
- }
-}
-
-function setDictionary (sTypeDic, sDictionary) {
- try {
- console.log("set dictionary: " + sTypeDic);
- switch (sTypeDic) {
- case "main":
- oSpellChecker.setMainDictionary(sDictionary);
- break;
- case "community":
- break;
- case "personal":
- let oJSON = JSON.parse(sDictionary);
- oSpellChecker.setPersonalDictionary(oJSON);
- break;
- default:
- console.log("[GCE worker] unknown dictionary type");
- }
- }
- catch (e) {
- console.error(e);
- }
-}
-
-function parse (sText, sCountry, bDebug, bContext) {
- let aGrammErr = gce.parse(sText, sCountry, bDebug, bContext);
- return JSON.stringify(aGrammErr);
-}
-
-function parseAndSpellcheck (sText, sCountry, bDebug, bContext) {
- let aGrammErr = gce.parse(sText, sCountry, bDebug, null, bContext);
- let aSpellErr = oSpellChecker.parseParagraph(sText);
- return JSON.stringify({ aGrammErr: aGrammErr, aSpellErr: aSpellErr });
-}
-
-function suggest (sWord, nSuggLimit=10) {
- let lSugg = []
- for (let aSugg of oSpellChecker.suggest(sWord, nSuggLimit)) {
- lSugg.push(...aSugg);
- }
- return lSugg.join("|");
-}
-
-function getOptions () {
- return gce.getOptions().gl_toString();
-}
-
-function getDefaultOptions () {
- return gce.getDefaultOptions().gl_toString();
-}
-
-function setOptions (sGCOptions) {
- gce.setOptions(helpers.objectToMap(JSON.parse(sGCOptions)));
- return gce.getOptions().gl_toString();
-}
-
-function setOption (sOptName, bValue) {
- gce.setOptions(new Map([ [sOptName, bValue] ]));
- return gce.getOptions().gl_toString();
-}
-
-function resetOptions () {
- gce.resetOptions();
- return gce.getOptions().gl_toString();
-}
-
-function fullTests (sGCOptions="") {
- if (!gce || !oSpellChecker) {
- return "# Error: grammar checker or dictionary not loaded."
- }
- let dMemoOptions = gce.getOptions();
- if (sGCOptions) {
- gce.setOptions(helpers.objectToMap(JSON.parse(sGCOptions)));
- }
- let tests = require("resource://grammalecte/tests.js");
- let oTest = new tests.TestGrammarChecking(gce);
- let sAllRes = "";
- for (let sRes of oTest.testParse()) {
- console.log(sRes+"\n");
- sAllRes += sRes+"\n";
- }
- gce.setOptions(dMemoOptions);
- return sAllRes;
-}