Grammalecte  Check-in [a646054ced]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:[fx] dictionaries manager: update
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fx | comdic
Files: files | file ages | folders
SHA3-256:a646054cedde110bd53d63b85a6e33af665407f62f217bbcbb9008b02dc4284c
User & Date: olr 2019-02-09 14:07:22
Context
2019-02-09
20:27
merge trunk check-in: aea2e8d9ee user: olr tags: comdic
14:07
[fx] dictionaries manager: update check-in: a646054ced user: olr tags: comdic, fx
2019-02-05
18:40
merge trunk check-in: 521f9f5963 user: olr tags: comdic
Changes

Changes to gc_lang/fr/webext/panel/dictionaries.html.

7
8
9
10
11
12
13

















14
15
16
17
18
19
20
  </head>

  <body>

    <div class="inbox">

      <h1>Dictionnaires communautaires</h1>


















        <div id="apply" class="apply">Appliquer les modifications</div>
        <h2>Dictionnaires sélectionnés</h2>
        <p id="dictionaries_list">[Aucun]<p>


        <h2><span id="num_dic">0</span> dictionnaires disponibles</h2>







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
  </head>

  <body>

    <div class="inbox">

      <h1>Dictionnaires communautaires</h1>

        <div id="connect_panel">
            <div id="connect_form">
                <div>Inscription</div>
                <p>Vous n’êtes pas identifié.</p>
                <p>
                    <label value="E-mail"><input type="text" name="email"></label>
                    <label value="Mot de passe"><input type="password" name="pw"></label>
                    <div id="submit_button">Envoyer</div>
                </p>
            </div>
            <div id="connect_info">
                <p>
                    Identifiants : <span id="login_label"> </span>, <span id="email_label"> </span>
                </p>
            </div>
        </div>

        <div id="apply" class="apply">Appliquer les modifications</div>
        <h2>Dictionnaires sélectionnés</h2>
        <p id="dictionaries_list">[Aucun]<p>


        <h2><span id="num_dic">0</span> dictionnaires disponibles</h2>

Changes to gc_lang/fr/webext/panel/dictionaries.js.

46
47
48
49
50
51
52










































53
54
55
56
57
58
59
...
310
311
312
313
314
315
316



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













































class Table {

    constructor (sNodeId, lColumn, sProgressBarId, sResultId="", bDeleteButtons=true, bActionButtons) {
        this.sNodeId = sNodeId;
        this.xTable = document.getElementById(sNodeId);
................................................................................
        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();










>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
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
...
352
353
354
355
356
357
358
359
360
361
    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);
................................................................................
        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();