Grammalecte  Diff

Differences From Artifact [acda1aa76b]:

To Artifact [8d106a1ae2]:


157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
    },

    onWrite: function () {
        if (document.getElementById("lemma").value.trim() !== "") {
            this.showElement("editor");
            oFlexGen.update();
        } else {
            this.showSection("section_vide");
            this.hideElement("editor");
            this.hideElement("actions");
        }
    },

    onWrite2: function () {
        if (document.getElementById("lemma2").value.trim() !== "") {
            this.showElement("word_section2");
            oFlexGen.update();
        } else {
            this.hideElement("word_section2");
        }
    },

    createTableHeader: function () {
        let xRowNode = createNode("tr");
        xRowNode.appendChild(createNode("th", { textContent: "·" }));
        xRowNode.appendChild(createNode("th", { textContent: "#" }));
        xRowNode.appendChild(createNode("th", { textContent: "Forme fléchie" }));
        xRowNode.appendChild(createNode("th", { textContent: "Lemme" }));
        xRowNode.appendChild(createNode("th", { textContent: "Étiquettes" }));
        return xRowNode;
    },

    createRowNode: function (n, sFlexion, sLemma, sTags) {
        let xRowNode = createNode("tr", { id: "row_" + n });
        xRowNode.appendChild(createNode("td", { textContent: "×", className: "delete_entry", title: "Effacer cette entrée" }, { id_entry: n }));
        xRowNode.appendChild(createNode("td", { textContent: n }));
        xRowNode.appendChild(createNode("td", { textContent: sFlexion }));
        xRowNode.appendChild(createNode("td", { textContent: sLemma }));
        xRowNode.appendChild(createNode("td", { textContent: sTags }));
        return xRowNode;
    },

    displayTable: function (lFlex) {
        this.clearTable();
        if (lFlex.length > 0) {
            this.showElement("display_progress");
            let xDisplayProgress = document.getElementById("display_progress");
            let xTable = document.getElementById("table");
            let n = 0;
            xDisplayProgress.max = lFlex.length;
            xDisplayProgress.value = 1;
            this.hideElement("no_elem_line");
            xTable.appendChild(this.createTableHeader());
            for (let [sFlexion, sLemma, sTags] of lFlex) {
                xTable.appendChild(this.createRowNode(n, sFlexion, sLemma, sTags));
                n += 1;
                xDisplayProgress.value += 1;
            }
            xDisplayProgress.value = xDisplayProgress.max;
            this.hideElement("display_progress");
        } else {
            this.showElement("no_elem_line");
        }
        this.updateData();
    },

    clearTable: function () {
        let xTable = document.getElementById("table");
        while (xTable.firstChild) {
            xTable.removeChild(xTable.firstChild);
        }
    },

    onTableClick: function (xEvent) {
        try {







<

<












|









|









|
|








|

|











|
|







157
158
159
160
161
162
163

164

165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
    },

    onWrite: function () {
        if (document.getElementById("lemma").value.trim() !== "") {
            this.showElement("editor");
            oFlexGen.update();
        } else {

            this.hideElement("editor");

        }
    },

    onWrite2: function () {
        if (document.getElementById("lemma2").value.trim() !== "") {
            this.showElement("word_section2");
            oFlexGen.update();
        } else {
            this.hideElement("word_section2");
        }
    },

    createLexiconHeader: function () {
        let xRowNode = createNode("tr");
        xRowNode.appendChild(createNode("th", { textContent: "·" }));
        xRowNode.appendChild(createNode("th", { textContent: "#" }));
        xRowNode.appendChild(createNode("th", { textContent: "Forme fléchie" }));
        xRowNode.appendChild(createNode("th", { textContent: "Lemme" }));
        xRowNode.appendChild(createNode("th", { textContent: "Étiquettes" }));
        return xRowNode;
    },

    createLexiconRow: function (n, sFlexion, sLemma, sTags) {
        let xRowNode = createNode("tr", { id: "row_" + n });
        xRowNode.appendChild(createNode("td", { textContent: "×", className: "delete_entry", title: "Effacer cette entrée" }, { id_entry: n }));
        xRowNode.appendChild(createNode("td", { textContent: n }));
        xRowNode.appendChild(createNode("td", { textContent: sFlexion }));
        xRowNode.appendChild(createNode("td", { textContent: sLemma }));
        xRowNode.appendChild(createNode("td", { textContent: sTags }));
        return xRowNode;
    },

    fillLexiconTable: function (lFlex) {
        this.clearTable("table");
        if (lFlex.length > 0) {
            this.showElement("display_progress");
            let xDisplayProgress = document.getElementById("display_progress");
            let xTable = document.getElementById("table");
            let n = 0;
            xDisplayProgress.max = lFlex.length;
            xDisplayProgress.value = 1;
            this.hideElement("no_elem_line");
            xTable.appendChild(this.createLexiconHeader());
            for (let [sFlexion, sLemma, sTags] of lFlex) {
                xTable.appendChild(this.createLexiconRow(n, sFlexion, sLemma, sTags));
                n += 1;
                xDisplayProgress.value += 1;
            }
            xDisplayProgress.value = xDisplayProgress.max;
            this.hideElement("display_progress");
        } else {
            this.showElement("no_elem_line");
        }
        this.updateData();
    },

    clearTable: function (sNodeId) {
        let xTable = document.getElementById(sNodeId);
        while (xTable.firstChild) {
            xTable.removeChild(xTable.firstChild);
        }
    },

    onTableClick: function (xEvent) {
        try {
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
    },

    addEntriesToTable: function (iStart, lFlex) {
        let xTable = document.getElementById("table");
        if (lFlex.length > 0) {
            if (document.getElementById("no_elem_line").style.display !== "none") {
                this.hideElement("no_elem_line");
                xTable.appendChild(this.createTableHeader());
            }
            for (let [sFlexion, sLemma, sTags] of lFlex) {
                xTable.appendChild(this.createRowNode(iStart, sFlexion, sLemma, sTags));
                iStart += 1;
            }
        }
        this.updateData();
    },

    deleteEntry: function (iEntry) {







|


|







240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
    },

    addEntriesToTable: function (iStart, lFlex) {
        let xTable = document.getElementById("table");
        if (lFlex.length > 0) {
            if (document.getElementById("no_elem_line").style.display !== "none") {
                this.hideElement("no_elem_line");
                xTable.appendChild(this.createLexiconHeader());
            }
            for (let [sFlexion, sLemma, sTags] of lFlex) {
                xTable.appendChild(this.createLexiconRow(iStart, sFlexion, sLemma, sTags));
                iStart += 1;
            }
        }
        this.updateData();
    },

    deleteEntry: function (iEntry) {
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295

    cMainTag: "",

    lFlexion: [],

    clear: function () {
        this.lFlexion = [];
        oWidgets.hideElement("actions");
    },

    setMainTag: function (sValue) {
        this.cMainTag = sValue;
    },

    addFlexion: function (sFlexion, sLemma, sTag) {







<







279
280
281
282
283
284
285

286
287
288
289
290
291
292

    cMainTag: "",

    lFlexion: [],

    clear: function () {
        this.lFlexion = [];

    },

    setMainTag: function (sValue) {
        this.cMainTag = sValue;
    },

    addFlexion: function (sFlexion, sLemma, sTag) {
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
        }
        return null;
    },

    show: function () {
        let sText = "";
        for (let [sFlexion, sLemma, sTag] of this.lFlexion) {
            sText += sFlexion + " (" + sLemma + ") " + sTag + "\n";
        }
        if (sText) {
            document.getElementById("results").textContent = sText;
            oWidgets.showElement("actions");
        } else {
            oWidgets.hideElement("actions");
        }
    },

    addToLexicon: function () {
        try {
            oLexicon.addFlexions(this.lFlexion);
            document.getElementById("lemma").value = "";
            document.getElementById("lemma").focus();
            oWidgets.showSection("section_vide");
            oWidgets.hideElement("editor");
            oWidgets.hideElement("actions");
            oWidgets.clear();
            oWidgets.showElement("save_button");
            this.clear();
            this.cMainTag = "";
        }
        catch (e) {
            showError(e);







|

<
|
<
<
<
<







<

<







436
437
438
439
440
441
442
443
444

445




446
447
448
449
450
451
452

453

454
455
456
457
458
459
460
        }
        return null;
    },

    show: function () {
        let sText = "";
        for (let [sFlexion, sLemma, sTag] of this.lFlexion) {
            sText += sFlexion + "\t" + sTag + "\n";
        }

        document.getElementById("results").textContent = sText;




    },

    addToLexicon: function () {
        try {
            oLexicon.addFlexions(this.lFlexion);
            document.getElementById("lemma").value = "";
            document.getElementById("lemma").focus();

            oWidgets.hideElement("editor");

            oWidgets.clear();
            oWidgets.showElement("save_button");
            this.clear();
            this.cMainTag = "";
        }
        catch (e) {
            showError(e);
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
    nEntries: 0,
    nDeletedEntries: 0,
    nAddedEntries: 0,

    set: function (lFlexion) {
        this.lFlexion = lFlexion;
        this.resetModif();
        oWidgets.displayTable(this.lFlexion);
        if (this.lFlexion.length > 0) {
            oWidgets.showElement("export_button");
        } else {
            oWidgets.hideElement("export_button");
        }
    },








|







470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
    nEntries: 0,
    nDeletedEntries: 0,
    nAddedEntries: 0,

    set: function (lFlexion) {
        this.lFlexion = lFlexion;
        this.resetModif();
        oWidgets.fillLexiconTable(this.lFlexion);
        if (this.lFlexion.length > 0) {
            oWidgets.showElement("export_button");
        } else {
            oWidgets.hideElement("export_button");
        }
    },

515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
    },

    save: function () {
        oWidgets.hideElement("save_button");
        this.lFlexion = this.lFlexion.filter((e) => e !== null);
        oBinaryDict.build(this.lFlexion);
        this.resetModif();
        oWidgets.displayTable(this.lFlexion);
        oWidgets.updateData();
    }
}


const oBinaryDict = {
    







|







505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
    },

    save: function () {
        oWidgets.hideElement("save_button");
        this.lFlexion = this.lFlexion.filter((e) => e !== null);
        oBinaryDict.build(this.lFlexion);
        this.resetModif();
        oWidgets.fillLexiconTable(this.lFlexion);
        oWidgets.updateData();
    }
}


const oBinaryDict = {