Grammalecte  Diff

Differences From Artifact [eeccdb3d27]:

To Artifact [172790a753]:


45
46
47
48
49
50
51
52
53
54
55
56
57
58

59



60


61


62

63




64

65






66

67

68
69


70
71
72
73
74
75
76
77
78
79
    if (document.getElementById(sElemId)) {
        document.getElementById(sElemId).style.display = "none";
    } else {
        console.log("HTML node named <" + sElemId + "> not found.")
    }
}

function showPage (sPage) {
    if (sPage == "lexicon") {
        hideElement("add_word_page");
        showElement("lexicon_page");
        document.getElementById("lexicon_button").style.backgroundColor = "hsl(210, 80%, 90%)";
        document.getElementById("add_word_button").style.backgroundColor = "hsl(210, 10%, 95%)";
    } else {

        hideElement("lexicon_page");



        showElement("add_word_page");


        document.getElementById("lexicon_button").style.backgroundColor = "hsl(210, 10%, 95%)";


        document.getElementById("add_word_button").style.backgroundColor = "hsl(210, 80%, 90%)";

        document.getElementById("lemma").focus();




    }

}










document.getElementById("lexicon_button").addEventListener("click", () => { showPage("lexicon"); }, false);
document.getElementById("add_word_button").addEventListener("click", () => { showPage("lemma"); }, false);



document.getElementById("save_button").addEventListener("click", () => { oBinaryDict.build(); }, false);



class Table {

    constructor (sNodeId, lColumn, sProgressBarId, sResultId="") {
        this.sNodeId = sNodeId;
        this.xTable = document.getElementById(sNodeId);







|
|
|
|
|
|
|
>
|
>
>
>
|
>
>
|
>
>
|
>
|
>
>
>
>
|
>
|
>
>
>
>
>
>
|
>

>
|
|
>
>
|
<
|







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94

95
96
97
98
99
100
101
102
    if (document.getElementById(sElemId)) {
        document.getElementById(sElemId).style.display = "none";
    } else {
        console.log("HTML node named <" + sElemId + "> not found.")
    }
}


const oTabulations = {

    lPage: ["lexicon_page", "add_page", "search_page", "info_page"],

    showPage: function (sRequestedPage) {
        for (let sPage of this.lPage) {
            if (sPage !== sRequestedPage) {
                hideElement(sPage);
                this.downlightButton(sPage.slice(0,-5) + "_button");
            }
        }
        showElement(sRequestedPage);
        this.highlightButton(sRequestedPage.slice(0,-5) + "_button");
        if (sRequestedPage == "add_page") {
            document.getElementById("lemma").focus();
        }
    },

    highlightButton: function (sButton) {
        if (document.getElementById(sButton)) {
            let xButton = document.getElementById(sButton);
            xButton.style.backgroundColor = "hsl(210, 80%, 90%)";
            xButton.style.color = "hsl(210, 80%, 30%)";
            xButton.style.fontWeight = "bold";
        }
    },

    downlightButton: function (sButton) {
        if (document.getElementById(sButton)) {
            let xButton = document.getElementById(sButton);
            xButton.style.backgroundColor = "hsl(210, 10%, 95%)";
            xButton.style.color = "hsl(210, 10%, 50%)";
            xButton.style.fontWeight = "normal";
        }
    },

    listen: function () {
        document.getElementById("lexicon_button").addEventListener("click", () => { this.showPage("lexicon_page"); }, false);
        document.getElementById("add_button").addEventListener("click", () => { this.showPage("add_page"); }, false);
        document.getElementById("search_button").addEventListener("click", () => { this.showPage("search_page"); }, false);
        document.getElementById("info_button").addEventListener("click", () => { this.showPage("info_page"); }, false);
    }

}


class Table {

    constructor (sNodeId, lColumn, sProgressBarId, sResultId="") {
        this.sNodeId = sNodeId;
        this.xTable = document.getElementById(sNodeId);
490
491
492
493
494
495
496

497
498
499
500
501
502
503

    setDictData: function (nEntries, sDate) {
        document.getElementById("dic_num_entries").textContent = nEntries;
        document.getElementById("dic_save_date").textContent = sDate;
    },

    listen: function () {

        document.getElementById("export_button").addEventListener("click", () => { this.export(); }, false);
        document.getElementById("import_button").addEventListener("click", () => { this.import(); }, false);
    },

    build: function () {
        let xProgressNode = document.getElementById("wait_progress");
        let lEntry = oLexiconTable.getEntries();







>







513
514
515
516
517
518
519
520
521
522
523
524
525
526
527

    setDictData: function (nEntries, sDate) {
        document.getElementById("dic_num_entries").textContent = nEntries;
        document.getElementById("dic_save_date").textContent = sDate;
    },

    listen: function () {
        document.getElementById("save_button").addEventListener("click", () => { this.build(); }, false);
        document.getElementById("export_button").addEventListener("click", () => { this.export(); }, false);
        document.getElementById("import_button").addEventListener("click", () => { this.import(); }, false);
    },

    build: function () {
        let xProgressNode = document.getElementById("wait_progress");
        let lEntry = oLexiconTable.getEntries();
530
531
532
533
534
535
536


const oLexiconTable = new Table("lexicon_table", ["Flexions", "Lemmes", "Étiquettes"], "wait_progress", "num_entries");
const oGenWordsTable = new Table("generated_words_table", ["Flexions", "Étiquettes"], "wait_progress");

oBinaryDict.load();
oBinaryDict.listen();
oGenerator.listen();








>
554
555
556
557
558
559
560
561

const oLexiconTable = new Table("lexicon_table", ["Flexions", "Lemmes", "Étiquettes"], "wait_progress", "num_entries");
const oGenWordsTable = new Table("generated_words_table", ["Flexions", "Étiquettes"], "wait_progress");

oBinaryDict.load();
oBinaryDict.listen();
oGenerator.listen();
oTabulations.listen();