Grammalecte  Diff

Differences From Artifact [52fcb1616a]:

To Artifact [e2b39bc09c]:


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 Cu = Components.utils;
const { require } = Cu.import("resource://gre/modules/commonjs/toolkit/require.js", {});
const conj = require("resource://grammalecte/fr/conj.js");


function echo (...args) {
    Services.console.logStringMessage(args.join(" -- ") + "\n");
}


let oConj = {
    init: function () {
        let that = this;
        try {
            // button
            document.getElementById('conjugate').addEventListener("click", function (event) {
                that.getVerbAndConjugate();
            });
            // text field
            document.getElementById('verb').addEventListener("change", function (event) {
                that.getVerbAndConjugate();
            });
            // options
            document.getElementById('oneg').addEventListener("click", function (event) {
                that._displayResults();
            });
            document.getElementById('opro').addEventListener("click", function (event) {
                that._displayResults();
            });
            document.getElementById('oint').addEventListener("click", function (event) {
                that._displayResults();
            });
            document.getElementById('ofem').addEventListener("click", function (event) {
                that._displayResults();
            });
            document.getElementById('otco').addEventListener("click", function (event) {
                that._displayResults();
            });
        }
        catch (e) {
            Cu.reportError(e);
        }
        this.conjugate("être");
    },



|
|
<
<
<
<
<




|


|
|


|
|


|
|

|
|

|
|

|
|

|
|







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
// 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) {
            Cu.reportError(e);
        }
        this.conjugate("être");
    },
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95

                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 conj.Verb(sVerb);
                    let sRawInfo = this.oVerb._sRawInfo;
                    document.getElementById('info').textContent = this.oVerb.sInfo;
                    document.getElementById('opro').textContent = "pronominal";
                    if (sRawInfo.endsWith("zz")) {
                        document.getElementById('opro').checked = false;
                        document.getElementById('opro').disabled = true;
                        document.getElementById('opro').style = "color: #CCC;";







|







76
77
78
79
80
81
82
83
84
85
86
87
88
89
90

                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);
                    let sRawInfo = this.oVerb._sRawInfo;
                    document.getElementById('info').textContent = this.oVerb.sInfo;
                    document.getElementById('opro').textContent = "pronominal";
                    if (sRawInfo.endsWith("zz")) {
                        document.getElementById('opro').checked = false;
                        document.getElementById('opro').disabled = true;
                        document.getElementById('opro').style = "color: #CCC;";
269
270
271
272
273
274
275

276
277
        }
        catch (e) {
            Cu.reportError(e);
        }
    }
};


oConj.init();








>

<
264
265
266
267
268
269
270
271
272

        }
        catch (e) {
            Cu.reportError(e);
        }
    }
};

conj.init(helpers.loadFile("resource://grammalecte/fr/conj_data.json"));
oConj.init();