Grammalecte  Check-in [89947a9517]

Overview
Comment:[fx] update: lexicon editor
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | fx
Files: files | file ages | folders
SHA3-256: 89947a95175c8995e7b656fa26f107e9c1e1a02bd5a6429b887c4a2370043e21
User & Date: olr on 2018-01-22 15:47:32
Other Links: manifest | tags
Context
2018-01-23
11:31
[fx] update: lexicon editor check-in: 70d86a32b0 user: olr tags: trunk, fx
2018-01-22
15:47
[fx] update: lexicon editor check-in: 89947a9517 user: olr tags: trunk, fx
13:53
[fx] lexicon editor check-in: 9cf43b3e45 user: olr tags: trunk, fx
Changes

Modified gc_lang/fr/webext/panel/lex_editor.css from [c26a7cee32] to [8493426f17].

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


#categories {
    display: flex;
    padding: 10px 0;
}

#another_word_section {
    opacity: .33;
}

.category {
    padding: 10px;
    border-radius: 3px;
    cursor: pointer;
}
.category:hover {
    background-color: hsl(0, 0%, 90%);
}


.empty_section {
    padding: 80px;
    font-size: 24px;
    text-align: center;

    color: hsl(0, 0%, 50%);

}
.section {
    display: none;
    padding: 10px;
}

.container {







|
|












|
|


>
|
>







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


#categories {
    display: flex;
    padding: 10px 0;
}

#word_section2 {
    display: none;
}

.category {
    padding: 10px;
    border-radius: 3px;
    cursor: pointer;
}
.category:hover {
    background-color: hsl(0, 0%, 90%);
}


#section_vide {
    padding: 50px;
    font-size: 24px;
    text-align: center;
    background-color: hsl(0, 20%, 90%);
    color: hsl(0, 20%, 50%);
    border-radius: 5px;
}
.section {
    display: none;
    padding: 10px;
}

.container {
140
141
142
143
144
145
146








147
148
149
150
151
152
153
}


#actions {
    display: none;
    padding: 10px;
}









#buttonline {
    text-align: right;
}

#add_to_dictionary {
    display: inline-block;







>
>
>
>
>
>
>
>







142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
}


#actions {
    display: none;
    padding: 10px;
}

#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_dictionary {
    display: inline-block;

Modified gc_lang/fr/webext/panel/lex_editor.html from [e847e96074] to [531ffaf2e4].

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
38
39
40
41
42
43
    
    <body>

        <div class="inbox">

            <h1>Éditeur lexical</h1>


            <input type="text" id="word" name="word" maxlength="60" value="" placeholder="votre mot" autofocus />



            <div id="categories">
                <div class="category" id="select_nom" data-tag="N">Nom, adjectif</div>
                <div class="category" id="select_verbe" data-tag="V">Verbe</div>
                <div class="category" id="select_adverbe" data-tag="W">Adverbe</div>

                <div class="separator"></div>

                <div class="category" id="select_prenom" data-tag="M1">Prénom</div>
                <div class="category" id="select_patronyme" data-tag="M2">Patronyme</div>
                <div class="category" id="select_nom_propre" data-tag="MP">Nom propre</div>

                <div class="separator"></div>

                <div class="category" id="select_autre" data-tag="X">Autre</div>
            </div>


            <div id="editor">

                <div id="section_vide" class="empty_section">
                    Sélectionnez une catégorie.
                </div>

                <div id="section_nom" class="section">
                    <h2>Nom, adjectif</h2>
                    <p class="typeline">
                        <input type="radio" id="up_type_nom" name="POS" value=":N" /> <label class="widelabel" for="up_type_nom">Nom</label>







>

>
>


















|

|







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
38
39
40
41
42
43
44
45
46
    
    <body>

        <div class="inbox">

            <h1>Éditeur lexical</h1>

            <h2>Nouveau mot</h2>
            <input type="text" id="word" name="word" maxlength="60" value="" placeholder="votre mot" autofocus />

            <div id="editor">

            <div id="categories">
                <div class="category" id="select_nom" data-tag="N">Nom, adjectif</div>
                <div class="category" id="select_verbe" data-tag="V">Verbe</div>
                <div class="category" id="select_adverbe" data-tag="W">Adverbe</div>

                <div class="separator"></div>

                <div class="category" id="select_prenom" data-tag="M1">Prénom</div>
                <div class="category" id="select_patronyme" data-tag="M2">Patronyme</div>
                <div class="category" id="select_nom_propre" data-tag="MP">Nom propre</div>

                <div class="separator"></div>

                <div class="category" id="select_autre" data-tag="X">Autre</div>
            </div>


                <div id="sections">

                    <div id="section_vide">
                    Sélectionnez une catégorie.
                </div>

                <div id="section_nom" class="section">
                    <h2>Nom, adjectif</h2>
                    <p class="typeline">
                        <input type="radio" id="up_type_nom" name="POS" value=":N" /> <label class="widelabel" for="up_type_nom">Nom</label>
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
                            <p><input type="radio" id="up_nom_pluriel_x" name="pluriel" value="x" /><label for="up_nom_pluriel_x"> pluriel en ·x</label></p>
                            <p><input type="radio" id="up_nom_pluriel_i" name="pluriel" value="i" /><label for="up_nom_pluriel_i"> invariable</label></p>
                        </div>
                    </div>

                    <h2>[optionnel] Autre forme (masculine, féminine, variante, etc.)</h2>
                    <input type="text" id="word2" name="word2" maxlength="60" value="" placeholder="votre mot" />
                    <div id="another_word_section">
                        <p class="typeline">
                            <input type="radio" id="up_type_nom2" name="POS2" value=":N" /> <label class="widelabel" for="up_type_nom2">Nom</label>
                            <input type="radio" id="up_type_adj2" name="POS2" value=":A" /> <label class="widelabel" for="up_type_adj2">Adjectif</label>
                            <input type="radio" id="up_type_nomadj2" name="POS2" value=":N:A" /> <label class="widelabel" for="up_type_nomadj2">Nom &amp; adjectif</label>
                        </p>
                        <div class="container">
                            <div class="block">







|







60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
                            <p><input type="radio" id="up_nom_pluriel_x" name="pluriel" value="x" /><label for="up_nom_pluriel_x"> pluriel en ·x</label></p>
                            <p><input type="radio" id="up_nom_pluriel_i" name="pluriel" value="i" /><label for="up_nom_pluriel_i"> invariable</label></p>
                        </div>
                    </div>

                    <h2>[optionnel] Autre forme (masculine, féminine, variante, etc.)</h2>
                    <input type="text" id="word2" name="word2" maxlength="60" value="" placeholder="votre mot" />
                        <div id="word_section2">
                        <p class="typeline">
                            <input type="radio" id="up_type_nom2" name="POS2" value=":N" /> <label class="widelabel" for="up_type_nom2">Nom</label>
                            <input type="radio" id="up_type_adj2" name="POS2" value=":A" /> <label class="widelabel" for="up_type_adj2">Adjectif</label>
                            <input type="radio" id="up_type_nomadj2" name="POS2" value=":N:A" /> <label class="widelabel" for="up_type_nomadj2">Nom &amp; adjectif</label>
                        </p>
                        <div class="container">
                            <div class="block">
216
217
218
219
220
221
222

223
224
225

226
227
228
229
230
231
232
                    <p>Indiquez les étiquettes grammaticales que vous voulez appliquer au mot. À utiliser seulement si vous savez ce que vous faites. Dans le cas contraire, tant pis pour vous.</p>
                    <h3>Lemme</h3>
                    <p><input type="text" id="up_lemma" name="lemma" maxlength="20" value="" placeholder="lemme" /></p>
                    <h3>Étiquettes</h3>
                    <p><input type="text" id="up_tags" name="tags" maxlength="20" value="" placeholder="étiquettes" /></p>
                </div>
            </div>

            
            <div id="actions">
                <h2>Mots générés</h2>

                <div id="results">
                    
                </div>
                
                <div id="buttonline">
                    <div id="add_to_dictionary">Ajouter au dictionnaire</div>
                </div>







>



>







219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
                    <p>Indiquez les étiquettes grammaticales que vous voulez appliquer au mot. À utiliser seulement si vous savez ce que vous faites. Dans le cas contraire, tant pis pour vous.</p>
                    <h3>Lemme</h3>
                    <p><input type="text" id="up_lemma" name="lemma" maxlength="20" value="" placeholder="lemme" /></p>
                    <h3>Étiquettes</h3>
                    <p><input type="text" id="up_tags" name="tags" maxlength="20" value="" placeholder="étiquettes" /></p>
                </div>
            </div>
            </div>
            
            <div id="actions">
                <h2>Mots générés</h2>
                <h3>Forme fléchie (lemme), étiquettes</h3>
                <div id="results">
                    
                </div>
                
                <div id="buttonline">
                    <div id="add_to_dictionary">Ajouter au dictionnaire</div>
                </div>

Modified gc_lang/fr/webext/panel/lex_editor.js from [1b700c4d5d] to [9390e65a7b].

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
38
39
40
41
42
43
44








45
46
47
48
49
50
51
52
53

function onSelectionClick (xEvent) {
    try {
        let xElem = xEvent.target;
        if (xElem.id) {
            if (xElem.id.startsWith("select_")) {
                oPage.showSection("section_" + xElem.id.slice(7));
                oFlex.getLemma();
                oFlex.setMainTag(xElem.dataset.tag);
                oFlex.update();
            } else if (xElem.id.startsWith("up_")) {
                oFlex.update();
            }
        } else {
            
        }
    }
    catch (e) {
        showError(e);
    }
}









document.getElementById("categories").addEventListener("click", onSelectionClick, false);

document.getElementById("editor").addEventListener("click", onSelectionClick, false);













/*
    ACTIONS
*/

const oPage = {









    hideAllSections: function () {
        for (let xElem of document.getElementById("editor").childNodes) {
            if (xElem.id) {
                xElem.style.display = "none";
            }
        }
    },

    showSection: function (sName) {







<





<
<







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









>
>
>
>
>
>
>
>

|







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

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

                oFlex.setMainTag(xElem.dataset.tag);
                oFlex.update();
            } else if (xElem.id.startsWith("up_")) {
                oFlex.update();
            }


        }
    }
    catch (e) {
        showError(e);
    }
}

function onWrite (xEvent) {
    if (document.getElementById("word").value.trim() !== "") {
        oPage.showEditor();
    } else {
        oPage.hideEditor();
        oPage.hideActions();
    }
}

function onWrite2 (xEvent) {
    if (document.getElementById("word2").value.trim() !== "") {
        oPage.showWord2();
    } else {
        oPage.hideWord2();
    }
}


document.getElementById("editor").addEventListener("click", onSelectionClick, false);
document.getElementById("word").addEventListener("keyup", onWrite, false);
document.getElementById("word2").addEventListener("keyup", onWrite2, false);



/*
    ACTIONS
*/

const oPage = {

    showEditor: function () {
        document.getElementById("editor").style.display = "block";
    },

    hideEditor: function () {
        document.getElementById("editor").style.display = "none";
    },

    hideAllSections: function () {
        for (let xElem of document.getElementById("sections").childNodes) {
            if (xElem.id) {
                xElem.style.display = "none";
            }
        }
    },

    showSection: function (sName) {
90
91
92
93
94
95
96
















97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
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
151
            // autre
            document.getElementById("up_lemma").value = "";
            document.getElementById("up_tags").value = "";
        }
        catch (e) {
            showError(e);
        }
















    }
}



const oFlex = {

    sWord: "",
    cMainTag: "",

    lFlexion: [],

    clear: function () {
        this.lFlexion = [];
        document.getElementById("actions").style.display = "none";
    },

    getLemma: function () {
        this.sWord = document.getElementById("word").value.trim();
    },

    setMainTag: function (sValue) {
        this.cMainTag = sValue;
    },

    addFlexion: function (sFlexion, sLemma, sTag) {
        this.lFlexion.push( [sFlexion, sLemma, sTag] );
    },

    update: function () {
        try {
            this.clear();
            let sGenderTag = "";

            if (this.sWord.length > 0) {
                switch (this.cMainTag) {
                    case "N":
                        let sTag = this.getRadioValue("POS") + this.getRadioValue("genre");
                        switch (this.getRadioValue("pluriel")) {
                            case "s":
                                this.addFlexion(this.sWord, this.sWord, sTag+":s");
                                this.addFlexion(this.sWord+"s", this.sWord, sTag+":p");
                                break;
                            case "x":
                                this.addFlexion(this.sWord, this.sWord, sTag+":s");
                                this.addFlexion(this.sWord+"x", this.sWord, sTag+":p");
                                break;
                            case "i":
                                this.addFlexion(this.sWord, this.sWord, sTag+":i");
                                break;
                        }
                        let sWord2 = document.getElementById("word2").value.trim();
                        if (sWord2.length > 0) {
                            let sTag2 = this.getRadioValue("POS2") + this.getRadioValue("genre2");
                            switch (this.getRadioValue("pluriel2")) {
                                case "s":







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







<









<
<
<
<












>
|





|
|


|
|


|







112
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




151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
            // autre
            document.getElementById("up_lemma").value = "";
            document.getElementById("up_tags").value = "";
        }
        catch (e) {
            showError(e);
        }
    },

    showWord2: function () {
        document.getElementById("word_section2").style.display = "block";
    },

    hideWord2: function () {
        document.getElementById("word_section2").style.display = "none";
    },

    showActions: function () {
        document.getElementById("actions").style.display = "block";
    },

    hideActions: function () {
        document.getElementById("actions").style.display = "none";
    }
}



const oFlex = {


    cMainTag: "",

    lFlexion: [],

    clear: function () {
        this.lFlexion = [];
        document.getElementById("actions").style.display = "none";
    },





    setMainTag: function (sValue) {
        this.cMainTag = sValue;
    },

    addFlexion: function (sFlexion, sLemma, sTag) {
        this.lFlexion.push( [sFlexion, sLemma, sTag] );
    },

    update: function () {
        try {
            this.clear();
            let sGenderTag = "";
            let sWord = document.getElementById("word").value.trim();
            if (sWord.length > 0) {
                switch (this.cMainTag) {
                    case "N":
                        let sTag = this.getRadioValue("POS") + this.getRadioValue("genre");
                        switch (this.getRadioValue("pluriel")) {
                            case "s":
                                this.addFlexion(sWord, sWord, sTag+":s");
                                this.addFlexion(sWord+"s", sWord, sTag+":p");
                                break;
                            case "x":
                                this.addFlexion(sWord, sWord, sTag+":s");
                                this.addFlexion(sWord+"x", sWord, sTag+":p");
                                break;
                            case "i":
                                this.addFlexion(sWord, sWord, sTag+":i");
                                break;
                        }
                        let sWord2 = document.getElementById("word2").value.trim();
                        if (sWord2.length > 0) {
                            let sTag2 = this.getRadioValue("POS2") + this.getRadioValue("genre2");
                            switch (this.getRadioValue("pluriel2")) {
                                case "s":
159
160
161
162
163
164
165
166
167
168
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
196
197
198
199
200
201
202
203
204
205
206
207
                                case "i":
                                    this.addFlexion(sWord2, sWord2, sTag2+":i");
                                    break;
                            }
                        }
                        break;
                    case "V":
                        if (!this.sWord.endsWith("er") && !this.sWord.endsWith("ir")) {
                            break;
                        }
                        let c_g = (this.sWord.endsWith("er")) ? "1" : "2";
                        let c_i = (document.getElementById("up_v_i").checked) ? "i" : "_";
                        let c_t = (document.getElementById("up_v_t").checked) ? "t" : "_";
                        let c_n = (document.getElementById("up_v_n").checked) ? "n" : "_";
                        let c_p = (document.getElementById("up_v_p").checked) ? "p" : "_";
                        let c_m = (document.getElementById("up_v_m").checked) ? "m" : "_";
                        let c_ae = (document.getElementById("up_v_ae").checked) ? "e" : "_";
                        let c_aa = (document.getElementById("up_v_aa").checked) ? "a" : "_";
                        let sVerbTag = c_i + c_t + c_n + c_p + c_m + c_ae + c_aa;
                        if (!sVerbTag.endsWith("__") && !sVerbTag.startsWith("____")) {
                            this.addFlexion(this.sWord, this.sWord, ":V" + c_g + "_" + sVerbTag);
                        }
                        break;
                    case "W":
                        this.addFlexion(this.sWord, this.sWord, ":W");
                        break;
                    case "M1":
                        sGenderTag = this.getRadioValue("genre_m1");
                        if (sGenderTag) {
                            this.addFlexion(this.sWord, this.sWord, ":M1"+sGenderTag+":i");
                        }
                        break;
                    case "M2":
                        sGenderTag = this.getRadioValue("genre_m2");
                        if (sGenderTag) {
                            this.addFlexion(this.sWord, this.sWord, ":M2"+sGenderTag+":i");
                        }
                        break;
                    case "MP":
                        sGenderTag = this.getRadioValue("genre_mp");
                        if (sGenderTag) {
                            this.addFlexion(this.sWord, this.sWord, ":MP"+sGenderTag+":i");
                        }
                        break;
                }
            }
            this.show();
        }
        catch (e) {







|


|









|



|




|





|





|







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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
                                case "i":
                                    this.addFlexion(sWord2, sWord2, sTag2+":i");
                                    break;
                            }
                        }
                        break;
                    case "V":
                        if (!sWord.endsWith("er") && !sWord.endsWith("ir")) {
                            break;
                        }
                        let c_g = (sWord.endsWith("er")) ? "1" : "2";
                        let c_i = (document.getElementById("up_v_i").checked) ? "i" : "_";
                        let c_t = (document.getElementById("up_v_t").checked) ? "t" : "_";
                        let c_n = (document.getElementById("up_v_n").checked) ? "n" : "_";
                        let c_p = (document.getElementById("up_v_p").checked) ? "p" : "_";
                        let c_m = (document.getElementById("up_v_m").checked) ? "m" : "_";
                        let c_ae = (document.getElementById("up_v_ae").checked) ? "e" : "_";
                        let c_aa = (document.getElementById("up_v_aa").checked) ? "a" : "_";
                        let sVerbTag = c_i + c_t + c_n + c_p + c_m + c_ae + c_aa;
                        if (!sVerbTag.endsWith("__") && !sVerbTag.startsWith("____")) {
                            this.addFlexion(sWord, sWord, ":V" + c_g + "_" + sVerbTag);
                        }
                        break;
                    case "W":
                        this.addFlexion(sWord, sWord, ":W");
                        break;
                    case "M1":
                        sGenderTag = this.getRadioValue("genre_m1");
                        if (sGenderTag) {
                            this.addFlexion(sWord, sWord, ":M1"+sGenderTag+":i");
                        }
                        break;
                    case "M2":
                        sGenderTag = this.getRadioValue("genre_m2");
                        if (sGenderTag) {
                            this.addFlexion(sWord, sWord, ":M2"+sGenderTag+":i");
                        }
                        break;
                    case "MP":
                        sGenderTag = this.getRadioValue("genre_mp");
                        if (sGenderTag) {
                            this.addFlexion(sWord, sWord, ":MP"+sGenderTag+":i");
                        }
                        break;
                }
            }
            this.show();
        }
        catch (e) {
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
    show: function () {
        let sText = "";
        for (let [sFlexion, sLemma, sTag] of this.lFlexion) {
            sText += sFlexion + " (" + sLemma + ") " + sTag + "<br/>\n";
        }
        if (sText) {
            document.getElementById("results").innerHTML = sText;
            document.getElementById("actions").style.display = "block";
        } else {
            document.getElementById("actions").style.display = "none";
        }
        
    },

    addToDictionary: function () {

    }
}







|

|

<






253
254
255
256
257
258
259
260
261
262
263

264
265
266
267
268
269
    show: function () {
        let sText = "";
        for (let [sFlexion, sLemma, sTag] of this.lFlexion) {
            sText += sFlexion + " (" + sLemma + ") " + sTag + "<br/>\n";
        }
        if (sText) {
            document.getElementById("results").innerHTML = sText;
            oPage.showActions();
        } else {
            oPage.hideActions();
        }

    },

    addToDictionary: function () {

    }
}