Grammalecte  Diff

Differences From Artifact [f9a15fdf35]:

To Artifact [66c74db008]:


46
47
48
49
50
51
52










































53
54
55
56
57
58
59
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







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







    if (document.getElementById(sElemId)) {
        document.getElementById(sElemId).style.display = "none";
    } else {
        console.log("HTML node named <" + sElemId + "> not found.")
    }
}

async function hashText (sText, sAlgorithm = 'SHA-256') {
    let msgBuffer = new TextEncoder('utf-8').encode(sText);
    let hashBuffer = await crypto.subtle.digest(sAlgorithm, msgBuffer);
    let hashArray = Array.from(new Uint8Array(hashBuffer));
    return hashArray.map(b => ('00' + b.toString(16)).slice(-2)).join('');
}


oConnect = {
    bConnected: false,

    init: function () {
        if (bChrome) {
            browser.storage.local.get("credentials", this._init().bind(this));
            return;
        }
        let xPromise = browser.storage.local.get("credentials");
        xPromise.then(this._init.bind(this), showError);
    },

    _init: function (oData) {
        if (oData.hasOwnProperty("credentials")) {
            hideElement("connect_form");
            showElement("connect_info");
            this.bConnected = true;
        }
        else {
            hideElement("connect_form");
            showElement("connect_info");
        }
    },

    listen: function () {
        document.getElementById("submit_button").addEventListener("click", (xEvent) => { this.connect() });
    },

    connect: function () {
        let sEmail = document.getElementById("email").value;
        let sPassword = document.getElementById("password").value;
        console.log(sEmail, sPassword);
    }
}


class Table {

    constructor (sNodeId, lColumn, sProgressBarId, sResultId="", bDeleteButtons=true, bActionButtons) {
        this.sNodeId = sNodeId;
        this.xTable = document.getElementById(sNodeId);
310
311
312
313
314
315
316



352
353
354
355
356
357
358
359
360
361







+
+
+
        browser.runtime.sendMessage({ sCommand: "setDictionary", dParam: {sDictionary: "community", oDict: oDict}, dInfo: {} });
    }
}

const oDicTable = new Table("dictionaries_table", ["Nom", "Entrées", "Description", "Date"], "wait_progress", "num_dic", false, true);

oDicTable.init();

oConnect.init();
oConnect.listen();