Grammalecte  Changes On Branch 5a4cc905e2b33e03

Changes In Branch webext2_fix Through [5a4cc905e2] Excluding Merge-Ins

This is equivalent to a diff from b844f2ba25 to 5a4cc905e2

2017-08-09
06:46
[core][js] merge webext2_fix: better init, mimetype for JSON loading, comments for JSHint check-in: 2591cec595 user: olr tags: core, webext2
2017-08-08
18:28
[core] force text/json mimetype in helpers.loadFile check-in: ccebd25f43 user: IllusionPerdu tags: core, fx, webext2_fix
17:51
[fx] merge webext2 check-in: 5a4cc905e2 user: IllusionPerdu tags: fx, webext2_fix
17:45
[core] set isInit to true when the object was initialized check-in: 6cea30d5de user: IllusionPerdu tags: core, webext2_fix
17:44
[core][js] use typeof(require) instead of typeof(exports) check-in: b844f2ba25 user: olr tags: core, webext2
17:25
[fx] conjugueur: panneau et onglet check-in: 1f91810c3d user: olr tags: fx, webext2
16:49
[core][fr] change typeof(exports) before the require block check-in: 6c8ee6edcf user: IllusionPerdu tags: core, webext2_fix

Modified gc_lang/fr/modules-js/conj.js from [abb72eabf4] to [f441399830].

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
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







+
+
+
+







+







+







// Grammalecte - Conjugueur
// License: GPL 3

"use strict";

${map}


if (typeof(require) !== 'undefined') {
    var helpers = require("resource://grammalecte/helpers.js");
}

var conj = {
    _lVtyp: [],
    _lTags: [],
    _dPatternConj: {},
    _dVerb: {},

    isInit: false,
    init: function (sJSONData) {
        try {
            let _oData = JSON.parse(sJSONData);
            this._lVtyp = _oData.lVtyp;
            this._lTags = _oData.lTags;
            this._dPatternConj = _oData.dPatternConj;
            this._dVerb = _oData.dVerb;
            this.isInit = true;
        }
        catch (e) {
            console.error(e);
        }
    },

    _zStartVoy: new RegExp("^[aeéiouœê]"),
474
475
476
477
478
479
480
481

482
483
484

485
486
487
488

489
490
491
492
493


494
495
496
497
498
499
500
480
481
482
483
484
485
486

487
488
489

490
491

492

493
494
495
496
497
498
499
500
501
502
503
504
505
506
507







-
+


-
+

-

-
+





+
+







        }
        return (this.dConj.get(":PQ").get(":Q4")) ? this.dConj.get(":PQ").get(":Q4") : this.dConj.get(":PQ").get(":Q1");
    }
}


// Initialization
if (typeof(browser) !== 'undefined') {
if (!conj.isInit && typeof(browser) !== 'undefined') {
    // WebExtension (but not in Worker)
    conj.init(helpers.loadFile(browser.extension.getURL("grammalecte/fr/conj_data.json")));
} else if (typeof(require) !== 'undefined') {
} else if (!conj.isInit && typeof(require) !== 'undefined') {
    // Add-on SDK and Thunderbird
    let helpers = require("resource://grammalecte/helpers.js");
    conj.init(helpers.loadFile("resource://grammalecte/fr/conj_data.json"));
} else if (typeof(self) !== 'undefined' && typeof(self.port) !== 'undefined' && typeof(self.port.on) !== "undefined") {
} else if ( !conj.isInit && typeof(self) !== 'undefined' && typeof(self.port) !== 'undefined' && typeof(self.port.on) !== "undefined") {
    // used within Firefox content script (conjugation panel).
    // can’t load JSON from here, so we do it in ui.js and send it here.
    self.port.on("provideConjData", function (sJSONData) {
        conj.init(sJSONData);
    });    
} else if (conj.isInit){
    console.log("Module conj déjà initialisé");
} else {
    console.log("Module conj non initialisé");
}


if (typeof(exports) !== 'undefined') {
    exports._lVtyp = conj._lVtyp;

Modified gc_lang/fr/modules-js/mfsp.js from [5ce8b4f9f6] to [689f0a7f0b].

13
14
15
16
17
18
19

20
21
22
23
24
25
26

27
28
29
30
31
32
33
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35







+







+







    _lTagMiscPlur: [],
    _lTagMasForm: [],
    // dictionary of words with uncommon plurals (-x, -ux, english, latin and italian plurals) and tags to generate them
    _dMiscPlur: new Map(),
    // dictionary of feminine forms and tags to generate masculine forms (singular and plural)
    _dMasForm: new Map(),

    isInit: false,
    init: function (sJSONData) {
        try {
            let _oData = JSON.parse(sJSONData);
            this._lTagMiscPlur = _oData.lTagMiscPlur;
            this._lTagMasForm = _oData.lTagMasForm;
            this._dMiscPlur = helpers.objectToMap(_oData.dMiscPlur);
            this._dMasForm = helpers.objectToMap(_oData.dMasForm);
            this.isInit = true;
        }
        catch (e) {
            console.error(e);
        }
    },

    isFemForm: function (sWord) {
96
97
98
99
100
101
102
103

104
105
106

107
108


109
110
111
112
113
114
115
98
99
100
101
102
103
104

105
106
107

108
109
110
111
112
113
114
115
116
117
118
119







-
+


-
+


+
+







            return "## erreur, code : " + sSfx + " ##";
        }
    }
};


// Initialization
if (typeof(browser) !== 'undefined') {
if (!mfsp.isInit && typeof(browser) !== 'undefined') {
    // WebExtension
    mfsp.init(helpers.loadFile(browser.extension.getURL("grammalecte/fr/mfsp_data.json")));
} else if (typeof(require) !== 'undefined') {
} else if (!mfsp.isInit && typeof(require) !== 'undefined') {
    // Add-on SDK and Thunderbird
    mfsp.init(helpers.loadFile("resource://grammalecte/fr/mfsp_data.json"));
} else if (mfsp.isInit){
    console.log("Module mfsp déjà initialisé");
} else {
    console.log("Module mfsp non initialisé");
}


if (typeof(exports) !== 'undefined') {
    exports._lTagMiscPlur = mfsp._lTagMiscPlur;

Modified gc_lang/fr/modules-js/phonet.js from [742b1a34db] to [2b1a025d02].

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
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












+






+







// Grammalecte - Suggestion phonétique

if (typeof(require) !== 'undefined') {
    var helpers = require("resource://grammalecte/helpers.js");
}


var phonet = {
    _dWord: new Map(),
    _lSet: [],
    _dMorph: new Map(),

    isInit: false,
    init: function (sJSONData) {
        try {
            let _oData = JSON.parse(sJSONData);
            this._dWord = helpers.objectToMap(_oData.dWord);
            this._lSet = _oData.lSet;
            this._dMorph = helpers.objectToMap(_oData.dMorph);
            this.isInit = true;
        }
        catch (e) {
            console.error(e);
        }
    },

    hasSimil: function (sWord, sPattern=null) {
77
78
79
80
81
82
83
84

85
86
87

88
89


90
91
92
93
94
95
96
79
80
81
82
83
84
85

86
87
88

89
90
91
92
93
94
95
96
97
98
99
100







-
+


-
+


+
+







        }
        return aSelect;
    }
};


// Initialization
if (typeof(browser) !== 'undefined') {
if (!phonet.isInit && typeof(browser) !== 'undefined') {
    // WebExtension
    phonet.init(helpers.loadFile(browser.extension.getURL("grammalecte/fr/phonet_data.json")));
} else if (typeof(require) !== 'undefined') {
} else if (!phonet.isInit && typeof(require) !== 'undefined') {
    // Add-on SDK and Thunderbird
    phonet.init(helpers.loadFile("resource://grammalecte/fr/phonet_data.json"));
} else if (phonet.isInit){
    console.log("Module phonet déjà initialisé");
} else {
    console.log("Module phonet non initialisé");
}


if (typeof(exports) !== 'undefined') {
    exports._dWord = phonet._dWord;