Grammalecte  Check-in [4cb15368e7]

Overview
Comment:[fx] cancel code cosmetics
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fx | comunicate
Files: files | file ages | folders
SHA3-256: 4cb15368e76d37a75491cc56d5ec830e0efc5ca256234a24e0d39389c3128bf8
User & Date: olr on 2020-03-10 08:41:11
Other Links: branch diff | manifest | tags
Context
2020-03-10
08:43
[fx] cancel code cosmetics check-in: bcfa44ecc9 user: olr tags: comunicate, fx
08:41
[fx] cancel code cosmetics check-in: 4cb15368e7 user: olr tags: comunicate, fx
08:33
[fx] cancel code cosmetics check-in: 686c43591b user: olr tags: comunicate, fx
Changes

Modified gc_lang/fr/webext/content_scripts/init.js from [6855746abd] to [5009f6ca62].

    17     17       // console can’t display error objects from content scripts
    18     18       console.error(e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message);
    19     19   }
    20     20   
    21     21   // Chrome don’t follow the W3C specification:
    22     22   // https://browserext.github.io/browserext/
    23     23   let bChrome = false;
    24         -if (typeof browser !== "object") {
           24  +if (typeof(browser) !== "object") {
    25     25       var browser = chrome;
    26     26       bChrome = true;
    27     27   }
    28     28   
    29     29   /*
    30     30   function loadImage (sContainerClass, sImagePath) {
    31     31       let xRequest = new XMLHttpRequest();
................................................................................
    58     58       xObserver: null,
    59     59   
    60     60       sExtensionUrl: null,
    61     61   
    62     62       listenRightClick: function () {
    63     63           // Node where a right click is done
    64     64           // Bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=1325814
    65         -        document.addEventListener("contextmenu", function (xEvent) {
           65  +        document.addEventListener('contextmenu', function (xEvent) {
    66     66               this.xRightClickedNode = xEvent.target;
    67     67           }.bind(this), true);
    68     68       },
    69     69   
    70     70       clearRightClickedNode: function () {
    71     71           this.xRightClickedNode = null;
    72     72       },
................................................................................
   173    173       },
   174    174   
   175    175       createTFPanel: function () {
   176    176           if (this.oTFPanel === null) {
   177    177               this.oTFPanel = new GrammalecteTextFormatter("grammalecte_tf_panel", "Formateur de texte", 760, 615, false);
   178    178               //this.oTFPanel.logInnerHTML();
   179    179               this.oTFPanel.insertIntoPage();
   180         -            window.setTimeout(function(self) {
          180  +            window.setTimeout(function(self){
   181    181                   self.oTFPanel.adjustHeight();
   182    182               }, 50, this);
   183    183           }
   184    184       },
   185    185   
   186    186       createLxgPanel: function () {
   187    187           if (this.oLxgPanel === null) {
................................................................................
   260    260               Object.assign(xNode, {
   261    261                   rel: "stylesheet",
   262    262                   type: "text/css",
   263    263                   media: "all",
   264    264                   href: this.sExtensionUrl + sLinkCss
   265    265               });
   266    266               if (sLinkId) {
   267         -                Object.assign(xNode, { id: sLinkId });
          267  +                Object.assign(xNode, {id: sLinkId});
   268    268               }
   269    269               if (xNodeToAppendTo) {
   270    270                   xNodeToAppendTo.appendChild(xNode);
   271    271               }
   272    272               return xNode;
   273    273           }
   274    274           catch (e) {
................................................................................
   276    276           }
   277    277       }
   278    278   };
   279    279   
   280    280   /*
   281    281       Connexion to the background
   282    282   */
   283         -let xGrammalectePort = browser.runtime.connect({ name: "content-script port" });
          283  +let xGrammalectePort = browser.runtime.connect({name: "content-script port"});
   284    284   
   285    285   xGrammalectePort.onMessage.addListener(function (oMessage) {
   286         -    let { sActionDone, result, dInfo, bEnd, bError } = oMessage;
          286  +    let {sActionDone, result, dInfo, bEnd, bError} = oMessage;
   287    287       let sText = "";
   288    288       switch (sActionDone) {
   289    289           case "init":
   290    290               oGrammalecte.sExtensionUrl = oMessage.sUrl;
   291    291               // Start
   292    292               oGrammalecte.listenRightClick();
   293    293               oGrammalecte.createMenus();
................................................................................
   320    320           // Grammar checker commands
   321    321           case "rightClickGCEditableNode":
   322    322               if (oGrammalecte.xRightClickedNode !== null) {
   323    323                   oGrammalecte.startGCPanel(oGrammalecte.xRightClickedNode);
   324    324                   sText = oGrammalecte.xRightClickedNode.tagName == "TEXTAREA" ? oGrammalecte.xRightClickedNode.value : oGrammalecte.xRightClickedNode.innerText;
   325    325                   xGrammalectePort.postMessage({
   326    326                       sCommand: "parseAndSpellcheck",
   327         -                    dParam: { sText: sText, sCountry: "FR", bDebug: false, bContext: false },
   328         -                    dInfo: { sTextAreaId: oGrammalecte.xRightClickedNode.id }
          327  +                    dParam: {sText: sText, sCountry: "FR", bDebug: false, bContext: false},
          328  +                    dInfo: {sTextAreaId: oGrammalecte.xRightClickedNode.id}
   329    329                   });
   330    330               } else {
   331    331                   oGrammalecte.showMessage("Erreur. Le node sur lequel vous avez cliqué n’a pas pu être identifié. Sélectionnez le texte à corriger et relancez le correcteur via le menu contextuel.");
   332    332               }
   333    333               break;
   334    334           case "rightClickGCPage":
   335    335               oGrammalecte.startGCPanel();
   336    336               xGrammalectePort.postMessage({
   337    337                   sCommand: "parseAndSpellcheck",
   338         -                dParam: { sText: oGrammalecte.getPageText(), sCountry: "FR", bDebug: false, bContext: false },
          338  +                dParam: {sText: oGrammalecte.getPageText(), sCountry: "FR", bDebug: false, bContext: false},
   339    339                   dInfo: {}
   340    340               });
   341    341               break;
   342    342           case "rightClickGCSelectedText":
   343    343               oGrammalecte.startGCPanel();
   344    344               // selected text is sent to the GC worker in the background script.
   345    345               break;
................................................................................
   346    346           // Lexicographer commands
   347    347           case "rightClickLxgEditableNode":
   348    348               if (oGrammalecte.xRightClickedNode !== null) {
   349    349                   oGrammalecte.startLxgPanel();
   350    350                   sText = oGrammalecte.xRightClickedNode.tagName == "TEXTAREA" ? oGrammalecte.xRightClickedNode.value : oGrammalecte.xRightClickedNode.innerText;
   351    351                   xGrammalectePort.postMessage({
   352    352                       sCommand: "getListOfTokens",
   353         -                    dParam: { sText: sText },
   354         -                    dInfo: { sTextAreaId: oGrammalecte.xRightClickedNode.id }
          353  +                    dParam: {sText: sText},
          354  +                    dInfo: {sTextAreaId: oGrammalecte.xRightClickedNode.id}
   355    355                   });
   356    356               } else {
   357    357                   oGrammalecte.showMessage("Erreur. Le node sur lequel vous avez cliqué n’a pas pu être identifié. Sélectionnez le texte à analyser et relancez le lexicographe via le menu contextuel.");
   358    358               }
   359    359               break;
   360    360           case "rightClickLxgPage":
   361    361               oGrammalecte.startLxgPanel();
   362    362               xGrammalectePort.postMessage({
   363    363                   sCommand: "getListOfTokens",
   364         -                dParam: { sText: oGrammalecte.getPageText() },
          364  +                dParam: {sText: oGrammalecte.getPageText()},
   365    365                   dInfo: {}
   366    366               });
   367    367               break;
   368    368           case "rightClickLxgSelectedText":
   369    369               oGrammalecte.startLxgPanel();
   370    370               // selected text is sent to the GC worker in the background script.
   371    371               break;