Grammalecte  Diff

Differences From Artifact [a0448c9bfb]:

To Artifact [6855918a57]:


30
31
32
33
34
35
36

37
38
39
40
41
42
43
...
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526

527
528
529
530




531
532
533
534
535
536
537
538


539
540

541


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

document.getElementById("table").addEventListener("click", (xEvent) => { oWidgets.onTableClick(xEvent); }, false);
document.getElementById("save_button").addEventListener("click", () => { oLexicon.save(); }, false);


document.getElementById("editor").addEventListener("click", (xEvent) => { oWidgets.onSelectionClick(xEvent); }, false);
document.getElementById("lemma").addEventListener("keyup", () => { oWidgets.onWrite(); }, false);
document.getElementById("lemma2").addEventListener("keyup", () => { oWidgets.onWrite2(); }, false);
document.getElementById("verb_pattern").addEventListener("keyup", () => { oFlexGen.update(); }, false);
document.getElementById("flexion").addEventListener("keyup", () => { oFlexGen.update(); }, false);
document.getElementById("tags").addEventListener("keyup", () => { oFlexGen.update(); }, false);
................................................................................
            this.lFlexion = dResult.lexicon_list;
        }
        oWidgets.displayTable(this.lFlexion);
    },

    save: function () {
        oWidgets.hideElement("save_button");
        let lResult = [];
        for (let e of this.lFlexion) {
            if (e !== null) {
                lResult.push(e);
            }
        }
        browser.storage.local.set({ "lexicon_list": lResult });
        this.lFlexion = lResult;
        oWidgets.displayTable(this.lFlexion);

    },

    build: function () {
        return null;




    },

    export: function () {
        let xBlob = new Blob(['{ "app": "grammalecte", "data": ' + JSON.stringify(this.lFlexion) + ' }'], {type: 'application/json'}); 
        let sURL = URL.createObjectURL(xBlob);
        browser.downloads.download({ filename: "grammalecte_dictionnaire_personnel.json", url: sURL, saveAs: true });
    }
}





oLexicon.load();







>







 







|


|


|
|

>



|
>
>
>
>






|
|
>
>
|
|
>

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
...
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550


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

document.getElementById("table").addEventListener("click", (xEvent) => { oWidgets.onTableClick(xEvent); }, false);
document.getElementById("save_button").addEventListener("click", () => { oLexicon.save(); }, false);
document.getElementById("export_button").addEventListener("click", () => { oLexicon.export(); }, false);

document.getElementById("editor").addEventListener("click", (xEvent) => { oWidgets.onSelectionClick(xEvent); }, false);
document.getElementById("lemma").addEventListener("keyup", () => { oWidgets.onWrite(); }, false);
document.getElementById("lemma2").addEventListener("keyup", () => { oWidgets.onWrite2(); }, false);
document.getElementById("verb_pattern").addEventListener("keyup", () => { oFlexGen.update(); }, false);
document.getElementById("flexion").addEventListener("keyup", () => { oFlexGen.update(); }, false);
document.getElementById("tags").addEventListener("keyup", () => { oFlexGen.update(); }, false);
................................................................................
            this.lFlexion = dResult.lexicon_list;
        }
        oWidgets.displayTable(this.lFlexion);
    },

    save: function () {
        oWidgets.hideElement("save_button");
        let lEntry = [];
        for (let e of this.lFlexion) {
            if (e !== null) {
                lEntry.push(e);
            }
        }
        browser.storage.local.set({ "lexicon_list": lEntry });
        this.lFlexion = lEntry;
        oWidgets.displayTable(this.lFlexion);
        this.build();
    },

    build: function () {
        oWidgets.showElement("build_progress");
        let xProgressNode = document.getElementById("build_progress");
        let oDAWG = new DAWG(this.lFlexion, "Français - dictionnaire personnel", "S", xProgressNode);
        let lMorph = oDAWG.morph("finis");
        console.log(lMorph);
    },

    export: function () {
        let xBlob = new Blob(['{ "app": "grammalecte", "data": ' + JSON.stringify(this.lFlexion) + ' }'], {type: 'application/json'}); 
        let sURL = URL.createObjectURL(xBlob);
        browser.downloads.download({ filename: "grammalecte_dictionnaire_personnel.json", url: sURL, saveAs: true });
    },

    import: function () {
        // TO DO
    }
}

oLexicon.load();