Grammalecte  Check-in [5ffa64be0b]

Overview
Comment:[fx] lexicon editor: adjustments
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fx | multid
Files: files | file ages | folders
SHA3-256: 5ffa64be0b3dfc207eb92dbd6263fa8790ca987906c2eb7f88342555f2e8b6bb
User & Date: olr on 2018-03-09 21:18:47
Other Links: branch diff | manifest | tags
Context
2018-03-10
04:38
[fr][bug] conj_generator: false -> False check-in: dc1776bb2d user: olr tags: fr, multid
2018-03-09
21:18
[fx] lexicon editor: adjustments check-in: 5ffa64be0b user: olr tags: fx, multid
21:00
[fr][bug] conj_generator: wrong var name check-in: 130e7f56ac user: olr tags: fr, multid
Changes

Modified gc_lang/fr/webext/panel/lex_editor.css from [8fbc80c764] to [134b1e8bcd].

32
33
34
35
36
37
38
39
40
41
42
43
44
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
    padding: 10px 30px 30px 30px;
    background: hsl(0, 0%, 100%);
    border: 2px solid #F0F0F0;
    border-radius: 20px;
}

h1 {
    margin: 5px 0 20px 0;
    color: hsl(210, 50%, 50%);
    font: bold 30px "Trebuchet MS", "Fira Sans", "Liberation Sans", sans-serif;
    text-align: center;
}
h2 {
    margin: 5px 0 2px 0;
    color: hsl(0, 50%, 50%);
    font: bold 20px "Trebuchet MS", "Fira Sans", "Liberation Sans", sans-serif;
}
h3 {
    margin: 3px 0 2px 0;
    color: hsl(210, 50%, 50%);
    font: bold 16px "Trebuchet MS", "Fira Sans", "Liberation Sans", sans-serif;
}

#buttons {
    padding: 10px;
    justify-content: center;
}
#lexicon_button {
    background-color: hsl(210, 80%, 90%);
}
.main_button {
    margin: 0 5px;
    padding: 10px 30px;
    background-color: hsl(210, 10%, 95%);
    border-radius: 5px;
    cursor: pointer;
}


.big_block {
    margin: 10px 0;
    padding: 10px;
    background-color: hsl(210, 20%, 96%);
    border-radius: 5px;
}


#add_word_page {
    display: none;
}

.columns {
    display: flex;
}








#editor {
    display: none;
}


#word_section2 {







|
















|













<







<







>
>
>
>
>
>
>







32
33
34
35
36
37
38
39
40
41
42
43
44
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
    padding: 10px 30px 30px 30px;
    background: hsl(0, 0%, 100%);
    border: 2px solid #F0F0F0;
    border-radius: 20px;
}

h1 {
    margin: 5px 0 5px 0;
    color: hsl(210, 50%, 50%);
    font: bold 30px "Trebuchet MS", "Fira Sans", "Liberation Sans", sans-serif;
    text-align: center;
}
h2 {
    margin: 5px 0 2px 0;
    color: hsl(0, 50%, 50%);
    font: bold 20px "Trebuchet MS", "Fira Sans", "Liberation Sans", sans-serif;
}
h3 {
    margin: 3px 0 2px 0;
    color: hsl(210, 50%, 50%);
    font: bold 16px "Trebuchet MS", "Fira Sans", "Liberation Sans", sans-serif;
}

#buttons {
    padding: 2px;
    justify-content: center;
}
#lexicon_button {
    background-color: hsl(210, 80%, 90%);
}
.main_button {
    margin: 0 5px;
    padding: 10px 30px;
    background-color: hsl(210, 10%, 95%);
    border-radius: 5px;
    cursor: pointer;
}


.big_block {
    margin: 10px 0;
    padding: 10px;
    background-color: hsl(210, 20%, 96%);
    border-radius: 5px;
}


#add_word_page {
    display: none;
}

.columns {
    display: flex;
}

#word_generator {
    width: 400px;
}
#generated_words {
    width: 400px;
}

#editor {
    display: none;
}


#word_section2 {
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149

.examples_true {
    flex-grow: 1;
    margin: 2px;
    padding: 10px;
    background-color: hsl(120, 10%, 90%);
    color: hsl(120, 10%, 50%);
    font-size: 14px;
    border-radius: 3px;
}
.examples_false {
    flex-grow: 1;
    margin: 2px;
    padding: 10px;
    background-color: hsl(0, 10%, 90%);







|







140
141
142
143
144
145
146
147
148
149
150
151
152
153
154

.examples_true {
    flex-grow: 1;
    margin: 2px;
    padding: 10px;
    background-color: hsl(120, 10%, 90%);
    color: hsl(120, 10%, 50%);
    font-size: 12px;
    border-radius: 3px;
}
.examples_false {
    flex-grow: 1;
    margin: 2px;
    padding: 10px;
    background-color: hsl(0, 10%, 90%);
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
    color: hsl(0, 0%, 20%);
}
input[placeholder] {
    color: hsl(0, 0%, 50%);
}


#generated_words {
    
}

#results {
    padding: 10px;
    background-color: hsl(210, 10%, 90%);
    border-radius: 3px;
    margin: 5px 0;
    font-family: "Courier New", Courier, "Lucida Sans Typewriter", "Lucida Typewriter", monospace;
}

#buttonline {

    text-align: right;
}

#add_to_lexicon {
    display: inline-block;
    padding: 7px 10px;
    font-size: 18px;







<
|
|
<
<
<
<
<
<
<
<
<

>







174
175
176
177
178
179
180

181
182









183
184
185
186
187
188
189
190
191
    color: hsl(0, 0%, 20%);
}
input[placeholder] {
    color: hsl(0, 0%, 50%);
}














#buttonline {
    margin-top: 10px;
    text-align: right;
}

#add_to_lexicon {
    display: inline-block;
    padding: 7px 10px;
    font-size: 18px;
236
237
238
239
240
241
242

243
244





245
246
247
248
249
250
251
252
253
254
255
256
257
258








}
#import_button {
    display: none;
}

#wait_progress {
    width: 100%;

}






th {
    padding: 5px 10px;
    border-left: 1px solid hsl(210, 10%, 90%);
    text-align: left;
}
td {
    padding: 0 10px;
}

.delete_entry {
    cursor: pointer;
    font-weight: bold;
    color: hsl(0, 100%, 50%);
}















>


>
>
>
>
>














>
>
>
>
>
>
>
>
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
}
#import_button {
    display: none;
}

#wait_progress {
    width: 100%;
    height: 4px;
}

table {
    border: 1px solid hsl(210, 10%, 50%);
    width: 100%;
    min-height: 200px;
}
th {
    padding: 5px 10px;
    border-left: 1px solid hsl(210, 10%, 90%);
    text-align: left;
}
td {
    padding: 0 10px;
}

.delete_entry {
    cursor: pointer;
    font-weight: bold;
    color: hsl(0, 100%, 50%);
}


details {
    font-size: 11px;
    font-variant: small-caps;
    color: hsl(210, 50%, 50%);
    cursor: pointer;
}

Modified gc_lang/fr/webext/panel/lex_editor.html from [a3b533c54c] to [673f7e7e9b].

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
        <div id="import_button" class="fright">
          Importer
        </div>
        <p>
          Dictionnaire <span id="dic_name">personnel</span> : <span id="dic_num_entries">0</span> entrées.<br/>
          Date d’enregistrement : <span id="dic_save_date">néant</span>.
        </p>
        <p><progress id="wait_progress" value="0" /></p>
      </div>

      

      <div id="add_word_page">
        <div class="columns">
          <div id="new_word_generator">
            <h2>Nouveau mot (lemme)</h2>
            <input type="text" id="lemma" name="lemma" maxlength="60" value="" placeholder="votre mot" pattern="^[a-zA-Zà-ö0-9À-Öø-ÿØ-ßĀ-ʯ._-]+$" autofocus />

            <div id="editor">

              <div id="sections">
                <h3 class="category" id="select_nom" data-tag="N">Nom, adjectif</h3>







|


<
<


|







25
26
27
28
29
30
31
32
33
34


35
36
37
38
39
40
41
42
43
44
        <div id="import_button" class="fright">
          Importer
        </div>
        <p>
          Dictionnaire <span id="dic_name">personnel</span> : <span id="dic_num_entries">0</span> entrées.<br/>
          Date d’enregistrement : <span id="dic_save_date">néant</span>.
        </p>
        <progress id="wait_progress" value="0"></progress>
      </div>



      <div id="add_word_page">
        <div class="columns">
          <div id="word_generator">
            <h2>Nouveau mot (lemme)</h2>
            <input type="text" id="lemma" name="lemma" maxlength="60" value="" placeholder="votre mot" pattern="^[a-zA-Zà-ö0-9À-Öø-ÿØ-ßĀ-ʯ._-]+$" autofocus />

            <div id="editor">

              <div id="sections">
                <h3 class="category" id="select_nom" data-tag="N">Nom, adjectif</h3>

Modified gc_lang/fr/webext/panel/lex_editor.js from [0a0dbd3647] to [d1ce88a730].

86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
        this.nEntry = 0
        this._createHeader();
        this.listen();
    }

    _createHeader () {
        let xRowNode = createNode("tr");
        xRowNode.appendChild(createNode("th", { textContent: "·" }));
        xRowNode.appendChild(createNode("th", { textContent: "#" }));
        for (let sColumn of this.lColumn) {
            xRowNode.appendChild(createNode("th", { textContent: sColumn }));
        }
        this.xTable.appendChild(xRowNode);
    }

    clear () {







|
|







86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
        this.nEntry = 0
        this._createHeader();
        this.listen();
    }

    _createHeader () {
        let xRowNode = createNode("tr");
        xRowNode.appendChild(createNode("th", { textContent: "·", width: "12px" }));
        //xRowNode.appendChild(createNode("th", { textContent: "#" }));
        for (let sColumn of this.lColumn) {
            xRowNode.appendChild(createNode("th", { textContent: sColumn }));
        }
        this.xTable.appendChild(xRowNode);
    }

    clear () {
113
114
115
116
117
118
119

120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
            this.xProgressBar.value = 1;
            for (let lData of lFlex) {
                this._addRow(lData);
                this.xProgressBar.value += 1;
            }
            this.xProgressBar.value = this.xProgressBar.max;
        }

        this.nEntry = lFlex.length;
        this.showEntryNumber();
    }

    addEntries (lFlex) {
        this.lEntry.push(...lFlex);
        for (let lData of lFlex) {
            this._addRow(lData);
        }
        this.nEntry += lFlex.length;
        this.showEntryNumber();
    }

    showEntryNumber () {
        if (this.xNumEntry) {
            this.xNumEntry.textContent = "Entrées : " + this.nEntry;
        }
    }

    _addRow (lData) {
        let xRowNode = createNode("tr", { id: this.sNodeId + "_row_" + this.iEntryIndex });
        xRowNode.appendChild(createNode("td", { textContent: "×", className: "delete_entry", title: "Effacer cette entrée" }, { id_entry: this.iEntryIndex }));
        xRowNode.appendChild(createNode("td", { textContent: this.iEntryIndex }));
        for (let data of lData) {
            xRowNode.appendChild(createNode("td", { textContent: data }));
        }
        this.xTable.appendChild(xRowNode);
        this.iEntryIndex += 1;
    }








>















|






|







113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
            this.xProgressBar.value = 1;
            for (let lData of lFlex) {
                this._addRow(lData);
                this.xProgressBar.value += 1;
            }
            this.xProgressBar.value = this.xProgressBar.max;
        }
        this.lEntry = lFlex;
        this.nEntry = lFlex.length;
        this.showEntryNumber();
    }

    addEntries (lFlex) {
        this.lEntry.push(...lFlex);
        for (let lData of lFlex) {
            this._addRow(lData);
        }
        this.nEntry += lFlex.length;
        this.showEntryNumber();
    }

    showEntryNumber () {
        if (this.xNumEntry) {
            this.xNumEntry.textContent = this.nEntry;
        }
    }

    _addRow (lData) {
        let xRowNode = createNode("tr", { id: this.sNodeId + "_row_" + this.iEntryIndex });
        xRowNode.appendChild(createNode("td", { textContent: "×", className: "delete_entry", title: "Effacer cette entrée" }, { id_entry: this.iEntryIndex }));
        //xRowNode.appendChild(createNode("td", { textContent: this.iEntryIndex }));
        for (let data of lData) {
            xRowNode.appendChild(createNode("td", { textContent: data }));
        }
        this.xTable.appendChild(xRowNode);
        this.iEntryIndex += 1;
    }

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
        document.getElementById("lemma2").addEventListener("keyup", () => { this.onWrite2(); }, false);
        document.getElementById("verb_pattern").addEventListener("keyup", () => { this.update(); }, false);
        document.getElementById("flexion").addEventListener("keyup", () => { this.update(); }, false);
        document.getElementById("tags").addEventListener("keyup", () => { this.update(); }, false);
        document.getElementById("add_to_lexicon").addEventListener("click", () => { this.addToLexicon(); }, false);
    },

    lSection: ["section_nom", "section_verbe", "section_adverbe", "section_prenom", "section_patronyme", "section_nom_propre", "section_autre"],

    hideAllSections: function () {
        for (let sSection of this.lSection) {
            hideElement(sSection);

        }
    },

    showSection: function (sName) {
        this.clear();
        this.hideAllSections();

        showElement(sName);



    },

    clear: function () {
        try {
            document.getElementById("lemma2").value = "";
            hideElement("word_section2");
            // nom, adjectif, noms propres







|



|
>






>
|
>
>
>







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
        document.getElementById("lemma2").addEventListener("keyup", () => { this.onWrite2(); }, false);
        document.getElementById("verb_pattern").addEventListener("keyup", () => { this.update(); }, false);
        document.getElementById("flexion").addEventListener("keyup", () => { this.update(); }, false);
        document.getElementById("tags").addEventListener("keyup", () => { this.update(); }, false);
        document.getElementById("add_to_lexicon").addEventListener("click", () => { this.addToLexicon(); }, false);
    },

    lSection: ["nom", "verbe", "adverbe", "prenom", "patronyme", "nom_propre", "autre"],

    hideAllSections: function () {
        for (let sSection of this.lSection) {
            hideElement("section_" + sSection);
            document.getElementById("select_" + sSection).style.backgroundColor = "";
        }
    },

    showSection: function (sName) {
        this.clear();
        this.hideAllSections();
        if (document.getElementById(sName).style.display == "none") {
            showElement(sName);
        } else {
            hideElement(sName);
        }
    },

    clear: function () {
        try {
            document.getElementById("lemma2").value = "";
            hideElement("word_section2");
            // nom, adjectif, noms propres
253
254
255
256
257
258
259

260
261
262
263
264
265
266

    onSelectionClick: function (xEvent) {
        try {
            let xElem = xEvent.target;
            if (xElem.id) {
                if (xElem.id.startsWith("select_")) {
                    this.showSection("section_" + xElem.id.slice(7));

                    this.cMainTag = xElem.dataset.tag;
                    this.update();
                } else if (xElem.id.startsWith("up_")) {
                    this.update();
                }
            }
        }







>







259
260
261
262
263
264
265
266
267
268
269
270
271
272
273

    onSelectionClick: function (xEvent) {
        try {
            let xElem = xEvent.target;
            if (xElem.id) {
                if (xElem.id.startsWith("select_")) {
                    this.showSection("section_" + xElem.id.slice(7));
                    xElem.style.backgroundColor = "hsl(210, 50%, 90%)";
                    this.cMainTag = xElem.dataset.tag;
                    this.update();
                } else if (xElem.id.startsWith("up_")) {
                    this.update();
                }
            }
        }
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448

449
450
451
452
453
454
455
456
457
        }
        return null;
    },

    createFlexLemmaTagArray: function () {
        let sLemma = document.getElementById("lemma").value.trim();
        let lEntry = [];
        for (let [sFlex, sTags] of this.lFlexion) {
            lEntry.push([sFlex, sLemma, sTags]);
        }
        return lEntry;
    },

    addToLexicon: function () {
        try {
            oLexiconTable.addEntries(this.createFlexLemmaTagArray());
            oGenWordsTable.clear();
            document.getElementById("lemma").value = "";
            document.getElementById("lemma").focus();

            hideElement("editor");
            oGenerator.clear();
            showElement("save_button");
            this.clear();
            this.cMainTag = "";
        }
        catch (e) {
            showError(e);
        }







|











>

<







437
438
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
        }
        return null;
    },

    createFlexLemmaTagArray: function () {
        let sLemma = document.getElementById("lemma").value.trim();
        let lEntry = [];
        for (let [sFlex, sTags] of oGenWordsTable.getEntries()) {
            lEntry.push([sFlex, sLemma, sTags]);
        }
        return lEntry;
    },

    addToLexicon: function () {
        try {
            oLexiconTable.addEntries(this.createFlexLemmaTagArray());
            oGenWordsTable.clear();
            document.getElementById("lemma").value = "";
            document.getElementById("lemma").focus();
            this.hideAllSections();
            hideElement("editor");

            showElement("save_button");
            this.clear();
            this.cMainTag = "";
        }
        catch (e) {
            showError(e);
        }