Grammalecte  Diff

Differences From Artifact [a010e7113e]:

To Artifact [9439cc3700]:


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













-
+

-
-

+







// Grammalecte - Conjugueur
// License: GPL 3

/* jshint esversion:6, -W097 */
/* jslint esversion:6 */
/* global require, exports, console, self, browser, chrome, __dirname */

"use strict";

${map}
${set}


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


var conj = {
    _lVtyp: [],
    _lTags: [],
    _dPatternConj: {},
    _dVerb: {},
    _dVerbNames: {},
599
600
601
602
603
604
605
606

607
608
609
610

611
612
613

614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
598
599
600
601
602
603
604

605
606
607
608

609
610
611

612









613
614
615
616
617
618
619







-
+



-
+


-
+
-
-
-
-
-
-
-
-
-







        return oConjTable;
    }
}


// Initialization
if(!conj.bInit && typeof(process) !== 'undefined') {
    // Work with nodejs
    // NodeJS
    conj.init(helpers.loadFile(__dirname+"/conj_data.json"));
} else if (!conj.bInit && typeof(browser) !== 'undefined') {
    // WebExtension Standard (but not in Worker)
    conj.init(helpers.loadFile(browser.extension.getURL("grammalecte/fr/conj_data.json")));
    conj.init(helpers.loadFile(browser.runtime.getURL("grammalecte/fr/conj_data.json")));
} else if (!conj.bInit && typeof(chrome) !== 'undefined') {
    // WebExtension Chrome (but not in Worker)
    conj.init(helpers.loadFile(chrome.extension.getURL("grammalecte/fr/conj_data.json")));
    conj.init(helpers.loadFile(chrome.runtime.getURL("grammalecte/fr/conj_data.json")));
} else if (!conj.bInit && typeof(require) !== 'undefined') {
    // Add-on SDK and Thunderbird
    conj.init(helpers.loadFile("resource://grammalecte/fr/conj_data.json"));
} else if (!conj.bInit && 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.bInit){
    console.log("Module conj déjà initialisé");
} else {
    //console.log("Module conj non initialisé");
}