Grammalecte  Check-in [6ac2cd76c8]

Overview
Comment:[fx] lexicon editor: code clarification + ui ongoing work
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fx | multid
Files: files | file ages | folders
SHA3-256: 6ac2cd76c8f3b4fcb9262acabc36776bc6d8acb3f1677628d81d903166d04e67
User & Date: olr on 2018-03-09 17:27:22
Other Links: branch diff | manifest | tags
Context
2018-03-09
21:00
[fr][bug] conj_generator: wrong var name check-in: 130e7f56ac user: olr tags: fr, multid
17:27
[fx] lexicon editor: code clarification + ui ongoing work check-in: 6ac2cd76c8 user: olr tags: fx, multid
08:26
[fx] lexicon editor: update (new draft) check-in: 19e588f821 user: olr tags: fx, multid
Changes

Modified gc_lang/fr/webext/panel/lex_editor.css from [953a945a5b] to [8fbc80c764].

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
    background: hsl(0, 0%, 100%) url(../img/lines.png);
    font: normal 16px "Trebuchet MS", "Fira Sans", "Liberation Sans", sans-serif;
    color: #505050;
}


.inbox {
    width: 900px;
    margin: 20px auto 10px auto;
    padding: 10px 30px 30px 30px;
    background: hsl(0, 0%, 100%);
    border: 2px solid #F0F0F0;
    border-radius: 20px;
}








|







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
    background: hsl(0, 0%, 100%) url(../img/lines.png);
    font: normal 16px "Trebuchet MS", "Fira Sans", "Liberation Sans", sans-serif;
    color: #505050;
}


.inbox {
    width: 800px;
    margin: 20px auto 10px auto;
    padding: 10px 30px 30px 30px;
    background: hsl(0, 0%, 100%);
    border: 2px solid #F0F0F0;
    border-radius: 20px;
}

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
102
103
104
105
106
107
108
109
110
111
    margin: 0 5px;
    padding: 10px 30px;
    background-color: hsl(210, 10%, 95%);
    border-radius: 5px;
    cursor: pointer;
}










#add_word_page {
    display: none;
}

.columns {
    display: flex;
}

#editor {
    display: none;
}

#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%);
}

.separator {
    border-left: 1px solid hsl(210, 0%, 90%);
}

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

.container {
    display: flex;







>
>
>
>
>
>
>
>













<
<
<
<








>






<
<
<
<







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
102
103
104
105




106
107
108
109
110
111
112
    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 {
    display: none;
}

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





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

.container {
    display: flex;
123
124
125
126
127
128
129




130
131
132
133
134
135
136
.typeline {
    padding: 5px 10px;
}
.widelabel {
    display: inline-block;
    min-width: 80px;
}





.examples_true {
    flex-grow: 1;
    margin: 2px;
    padding: 10px;
    background-color: hsl(120, 10%, 90%);
    color: hsl(120, 10%, 50%);







>
>
>
>







124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
.typeline {
    padding: 5px 10px;
}
.widelabel {
    display: inline-block;
    min-width: 80px;
}

.description {
    font-size: 12px;
}

.examples_true {
    flex-grow: 1;
    margin: 2px;
    padding: 10px;
    background-color: hsl(120, 10%, 90%);
    color: hsl(120, 10%, 50%);
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
208
209
210
211
212
213
214
215
216
217
218
219
}
input[placeholder] {
    color: hsl(0, 0%, 50%);
}


#generated_words {
    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_lexicon {
    display: inline-block;
    padding: 7px 10px;
    font-size: 20px;
    background-color: hsl(0, 30%, 30%);
    color: hsl(0, 30%, 60%);
    border-radius: 3px;
    text-transform: uppercase;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}
#add_to_lexicon:hover {
    background-color: hsl(0, 60%, 40%);
    color: hsl(0, 60%, 70%);
    box-shadow: 0 0 2px hsl(0, 60%, 50%);
}


#lexicon_page {
    
}

#no_elem_line {
    display: none;
}

.button_block {
    margin: 5px 0px;
    background-color: hsl(210, 10%, 90%);
    border-radius: 5px;
    padding: 15px;
}







|

















|



















<
<
<







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
208
209
210
211
212
213
214



215
216
217
218
219
220
221
}
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;
    background-color: hsl(0, 30%, 30%);
    color: hsl(0, 30%, 60%);
    border-radius: 3px;
    text-transform: uppercase;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}
#add_to_lexicon:hover {
    background-color: hsl(0, 60%, 40%);
    color: hsl(0, 60%, 70%);
    box-shadow: 0 0 2px hsl(0, 60%, 50%);
}


#lexicon_page {
    
}





.button_block {
    margin: 5px 0px;
    background-color: hsl(210, 10%, 90%);
    border-radius: 5px;
    padding: 15px;
}
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
    background-color: hsl(210, 50%, 50%);
    color: hsl(210, 0%, 100%);
}
#import_button {
    display: none;
}

#build_progress {
    display: none;
    width: 100%;
}

#display_progress {
    display: none;
    width: 100%;
}

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







|
<
<
<
<
<
<







234
235
236
237
238
239
240
241






242
243
244
245
246
247
248
    background-color: hsl(210, 50%, 50%);
    color: hsl(210, 0%, 100%);
}
#import_button {
    display: none;
}

#wait_progress {






    width: 100%;
}

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

Modified gc_lang/fr/webext/panel/lex_editor.html from [46fac93928] to [a3b533c54c].

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

      <h1>Éditeur lexical</h1>

      <div id="buttons" class="container">
        <div id="lexicon_button" class="main_button">Lexique</div>
        <div id="add_word_button" class="main_button">Ajout</div>
      </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="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="category separator" 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="category separator" id="select_autre" data-tag="X">Autre</div>
              </div>


              <div id="sections">

                <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>
                    <input type="radio" id="up_type_adj" name="POS" value=":A" /> <label class="widelabel" for="up_type_adj">Adjectif</label>
                    <input type="radio" id="up_type_nomadj" name="POS" value=":N:A" /> <label class="widelabel" for="up_type_nomadj">Nom &amp; adjectif</label>
                  </p>
                  <div class="container">
                    <div class="block">
                      <h3>Genre</h3>
                      <p><input type="radio" id="up_nom_genre_e" name="genre" value=":e" /><label for="up_nom_genre_e"> épicène</label></p>
                      <p><input type="radio" id="up_nom_genre_m" name="genre" value=":m" /><label for="up_nom_genre_m"> masculin</label></p>
                      <p><input type="radio" id="up_nom_genre_f" name="genre" value=":f" /><label for="up_nom_genre_f"> féminin</label></p>
                    </div>
                    <div class="block">
                      <h3>Pluriel</h3>
                      <p><input type="radio" id="up_nom_pluriel_s" name="pluriel" value="s" /><label for="up_nom_pluriel_s"> pluriel en ·s</label></p>
                      <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="lemma2" name="lemma2" maxlength="60" value="" pattern="^[a-zA-Zà-ö0-9À-Öø-ÿØ-ßĀ-ʯ._-]+$" 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>







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









<
<
<
<
<
<
<
<
<
<
<

|

<




















|







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

      <h1>Éditeur lexical</h1>

      <div id="buttons" class="container">
        <div id="lexicon_button" class="main_button">Lexique</div>
        <div id="add_word_button" class="main_button">Ajout</div>
      </div>

      <div class="big_block">
        <h3>Dictionnaire</h3>
        <div id="export_button" class="fright">
          Exporter
        </div>
        <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>
                <div id="section_nom" class="section">

                  <p class="typeline">
                    <input type="radio" id="up_type_nom" name="POS" value=":N" /> <label class="widelabel" for="up_type_nom">Nom</label>
                    <input type="radio" id="up_type_adj" name="POS" value=":A" /> <label class="widelabel" for="up_type_adj">Adjectif</label>
                    <input type="radio" id="up_type_nomadj" name="POS" value=":N:A" /> <label class="widelabel" for="up_type_nomadj">Nom &amp; adjectif</label>
                  </p>
                  <div class="container">
                    <div class="block">
                      <h3>Genre</h3>
                      <p><input type="radio" id="up_nom_genre_e" name="genre" value=":e" /><label for="up_nom_genre_e"> épicène</label></p>
                      <p><input type="radio" id="up_nom_genre_m" name="genre" value=":m" /><label for="up_nom_genre_m"> masculin</label></p>
                      <p><input type="radio" id="up_nom_genre_f" name="genre" value=":f" /><label for="up_nom_genre_f"> féminin</label></p>
                    </div>
                    <div class="block">
                      <h3>Pluriel</h3>
                      <p><input type="radio" id="up_nom_pluriel_s" name="pluriel" value="s" /><label for="up_nom_pluriel_s"> pluriel en ·s</label></p>
                      <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>

                  <h3>[optionnel] Autre forme (masculine, féminine, variante, etc.)</h3>
                  <input type="text" id="lemma2" name="lemma2" maxlength="60" value="" pattern="^[a-zA-Zà-ö0-9À-Öø-ÿØ-ßĀ-ʯ._-]+$" 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>
81
82
83
84
85
86
87

88
89
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
152
153
154
155
156
157
158
159
                        <p><input type="radio" id="up_nom2_pluriel_x" name="pluriel2" value="x" /><label for="up_nom2_pluriel_x"> pluriel en ·x</label></p>
                        <p><input type="radio" id="up_nom2_pluriel_i" name="pluriel2" value="i" /><label for="up_nom2_pluriel_i"> invariable</label></p>
                      </div>
                    </div>
                  </div>
                </div>


                <div id="section_verbe" class="section">
                  <h2>Verbe</h2>
                  <div class="block">
                    <h3><input type="checkbox" id="up_v_i" value="i" /><label for="up_v_i"> intransitif</label></h3>
                    <div class="description">Cochez cette case si ce verbe peut s’utiliser sans complément d’objet.</div>
                    <details>
                      <div class="container">
                        <div class="examples_true">Je dors.<br/>Tu pars.<br/>Elle pense.<br/>Nous écrivons.<br/>Vous manifestez.<br/>Ils viennent.</div>
                        <div class="examples_false">J’appartiens à ce groupe…</div>
                      </div>
                    </details>
                  </div>
                  <div class="block">
                    <h3><input type="checkbox" id="up_v_t" value="t" /><label for="up_v_t"> transitif direct</label></h3>
                    <div class="description">Cochez cette case si ce verbe peut s’utiliser avec un complément d’objet direct (COD).</div>
                    <details>
                      <div class="container">
                        <div class="examples_true">Je mange <i>une pomme</i>.<br/>Tu donnes <i>une bonne impression</i>.<br/>Elle écrit <i>un livre</i>.<br/>Nous fabriquons <i>une œuvre</i>.</div>
                        <div class="examples_false">Je pars.<br/>J’appartiens à…</div>
                      </div>
                    </details>
                  </div>
                  <div class="block">
                    <h3><input type="checkbox" id="up_v_n" value="n" /><label for="up_v_n"> transitif indirect</label></h3>
                    <div class="description">Cochez cette case, si ce verbe peut s’utiliser avec un complément d’objet indirect (COI). Attention à ne pas confondre avec un complément circonstanciel de temps, de lieu ou de manière.</div>
                    <details>
                      <div class="container">
                        <div class="examples_true">Je donne un cadeau <i>à sa femme</i>.<br/>Elle appartient <i>à ce groupe</i>.</div>
                        <div class="examples_false"></div>
                      </div>
                    </details>
                  </div>
                  <div class="block">
                    <h3><input type="checkbox" id="up_v_p" value="p" /><label for="up_v_p"> pronominal</label></h3>
                    <div class="description">Cochez cette case si ce verbe peut s’utiliser pronominalement.</div>
                    <details>
                      <div class="container">
                        <div class="examples_true">Je me suis trompé.<br/>Tu t’es étonné toi-même.<br/>Elle s’est souvenu de ses études.<br/>Nous nous sommes égarés.<br/>Vous vous êtes retrouvées.<br/>Ils se sont rappelé leur enfance.</div>
                        <div class="examples_false">Je me suis venu.<br/>tu t’es arrivé.<br/>elle s’est marché.<br/>nous nous sommes courus.<br/>vous vous êtes acculés.<br/>Elles se sont capitulées.</div>
                      </div>
                    </details>
                  </div>
                  <div class="block">
                    <h3><input type="checkbox" id="up_v_m" value="m" /><label for="up_v_m"> impersonnel</label></h3>
                    <div class="description">Cochez cette case si ce verbe ne peut s’utiliser à la première personne, mais uniquement à la troisième personne du singulier ou du pluriel.</div>
                    <details>
                      <div class="container">
                        <div class="examples_true">Il pleut.</div>
                        <div class="examples_false">Je pleus.</div>
                      </div>
                    </details>
                  </div>
                  <div class="block">
                    <h3><input type="checkbox" id="up_v_ae" value="e" /><label for="up_v_ae"> passé composé avec l’auxiliaire “être”</label></h3>
                    <div class="description">Cochez cette case si ce verbe s’emploie au passé composé avec l’auxilaire “être”.</div>
                    <details>
                      <div class="container">
                        <div class="examples_true">Je suis venu.<br/>Je suis parti.</div>
                        <div class="examples_false">J’ai venu.<br/>J’ai parti.</div>
                      </div>
                    </details>
                  </div>
                  <div class="block">
                    <h3><input type="checkbox" id="up_v_aa" value="a" /><label for="up_v_aa"> passé composé avec l’auxiliaire “avoir”</label></h3>
                    <div class="description">Cochez cette case si ce verbe s’emploie au passé composé avec l’auxilaire “avoir”.</div>
                    <details>
                      <div class="container">
                        <div class="examples_true">J’ai mangé.<br/>J’ai prié.</div>
                        <div class="examples_false">Je suis mangé.<br/>Je suis prié.</div>
                      </div>
                    </details>
                  </div>







>

<


|









|









|









|









|









|









|







86
87
88
89
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
152
153
154
155
156
157
158
159
160
161
162
163
164
                        <p><input type="radio" id="up_nom2_pluriel_x" name="pluriel2" value="x" /><label for="up_nom2_pluriel_x"> pluriel en ·x</label></p>
                        <p><input type="radio" id="up_nom2_pluriel_i" name="pluriel2" value="i" /><label for="up_nom2_pluriel_i"> invariable</label></p>
                      </div>
                    </div>
                  </div>
                </div>

                <h3 class="category" id="select_verbe" data-tag="V">Verbe</h3>
                <div id="section_verbe" class="section">

                  <div class="block">
                    <h3><input type="checkbox" id="up_v_i" value="i" /><label for="up_v_i"> intransitif</label></h3>
                    <div class="description">Le verbe peut s’utiliser sans complément d’objet.</div>
                    <details>
                      <div class="container">
                        <div class="examples_true">Je dors.<br/>Tu pars.<br/>Elle pense.<br/>Nous écrivons.<br/>Vous manifestez.<br/>Ils viennent.</div>
                        <div class="examples_false">J’appartiens à ce groupe…</div>
                      </div>
                    </details>
                  </div>
                  <div class="block">
                    <h3><input type="checkbox" id="up_v_t" value="t" /><label for="up_v_t"> transitif direct</label></h3>
                    <div class="description">Ce verbe peut s’utiliser avec un complément d’objet direct (COD).</div>
                    <details>
                      <div class="container">
                        <div class="examples_true">Je mange <i>une pomme</i>.<br/>Tu donnes <i>une bonne impression</i>.<br/>Elle écrit <i>un livre</i>.<br/>Nous fabriquons <i>une œuvre</i>.</div>
                        <div class="examples_false">Je pars.<br/>J’appartiens à…</div>
                      </div>
                    </details>
                  </div>
                  <div class="block">
                    <h3><input type="checkbox" id="up_v_n" value="n" /><label for="up_v_n"> transitif indirect</label></h3>
                    <div class="description">Ce verbe peut s’utiliser avec un complément d’objet indirect (COI). Attention à ne pas confondre avec un complément circonstanciel de temps, de lieu ou de manière.</div>
                    <details>
                      <div class="container">
                        <div class="examples_true">Je donne un cadeau <i>à sa femme</i>.<br/>Elle appartient <i>à ce groupe</i>.</div>
                        <div class="examples_false"></div>
                      </div>
                    </details>
                  </div>
                  <div class="block">
                    <h3><input type="checkbox" id="up_v_p" value="p" /><label for="up_v_p"> pronominal</label></h3>
                    <div class="description">Ce verbe peut s’utiliser pronominalement.</div>
                    <details>
                      <div class="container">
                        <div class="examples_true">Je me suis trompé.<br/>Tu t’es étonné toi-même.<br/>Elle s’est souvenu de ses études.<br/>Nous nous sommes égarés.<br/>Vous vous êtes retrouvées.<br/>Ils se sont rappelé leur enfance.</div>
                        <div class="examples_false">Je me suis venu.<br/>tu t’es arrivé.<br/>elle s’est marché.<br/>nous nous sommes courus.<br/>vous vous êtes acculés.<br/>Elles se sont capitulées.</div>
                      </div>
                    </details>
                  </div>
                  <div class="block">
                    <h3><input type="checkbox" id="up_v_m" value="m" /><label for="up_v_m"> impersonnel</label></h3>
                    <div class="description">Ce verbe ne peut s’utiliser à la première personne, mais uniquement à la troisième personne du singulier ou du pluriel.</div>
                    <details>
                      <div class="container">
                        <div class="examples_true">Il pleut.</div>
                        <div class="examples_false">Je pleus.</div>
                      </div>
                    </details>
                  </div>
                  <div class="block">
                    <h3><input type="checkbox" id="up_v_ae" value="e" /><label for="up_v_ae"> passé composé avec l’auxiliaire “être”</label></h3>
                    <div class="description">Ce verbe s’emploie au passé composé avec l’auxiliaire “être”.</div>
                    <details>
                      <div class="container">
                        <div class="examples_true">Je suis venu.<br/>Je suis parti.</div>
                        <div class="examples_false">J’ai venu.<br/>J’ai parti.</div>
                      </div>
                    </details>
                  </div>
                  <div class="block">
                    <h3><input type="checkbox" id="up_v_aa" value="a" /><label for="up_v_aa"> passé composé avec l’auxiliaire “avoir”</label></h3>
                    <div class="description">Ce verbe s’emploie au passé composé avec l’auxiliaire “avoir”.</div>
                    <details>
                      <div class="container">
                        <div class="examples_true">J’ai mangé.<br/>J’ai prié.</div>
                        <div class="examples_false">Je suis mangé.<br/>Je suis prié.</div>
                      </div>
                    </details>
                  </div>
185
186
187
188
189
190
191

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
218
219
220
221
222
223
224
225
226
227
228

229
230
231
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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
                        <li><b>3ᵉ groupe</b>. Autres verbes irréguliers.</li>
                        <li>Les verbes <i>être</i> et <i>avoir</i> n’appartiennent à aucun groupe. Il est recommandé de ne pas s’en servir comme modèle.</li>
                      </ul>
                    </details>
                  </div>
                </div>


                <div id="section_adverbe" class="section">
                  <h2>Adverbe</h2>
                  <p>Les adverbes sont invariables en genre et en nombre.</p>
                </div>


                <div id="section_prenom" class="section">
                  <h2>Prénom</h2>
                  <div class="container">
                    <div class="block">
                      <h3>Genre</h3>
                      <p><input type="radio" id="up_prenom_genre_e" name="genre_m1" value=":e" /><label for="up_prenom_genre_e"> épicène</label></p>
                      <p><input type="radio" id="up_prenom_genre_m" name="genre_m1" value=":m" /><label for="up_prenom_genre_m"> masculin</label></p>
                      <p><input type="radio" id="up_prenom_genre_f" name="genre_m1" value=":f" /><label for="up_prenom_genre_f"> féminin</label></p>
                    </div>
                    <div class="block">
                      <h3>Pluriel</h3>
                      <p>Les prénoms sont invariables en nombre.</p>
                    </div>
                  </div>
                </div>


                <div id="section_patronyme" class="section">
                  <h2>Patronyme</h2>
                  <div class="container">
                    <div class="block">
                      <h3>Genre</h3>
                      <p><input type="radio" id="up_patronyme_genre_e" name="genre_m2" value=":e" /><label for="up_patronyme_genre_e"> épicène</label></p>
                      <p><input type="radio" id="up_patronyme_genre_m" name="genre_m2" value=":m" /><label for="up_patronyme_genre_m"> masculin</label></p>
                      <p><input type="radio" id="up_patronyme_genre_f" name="genre_m2" value=":f" /><label for="up_patronyme_genre_f"> féminin</label></p>
                    </div>
                    <div class="block">
                      <h3>Pluriel</h3>
                      <p>Les noms de famille sont invariables en nombre.</p>
                    </div>
                  </div>
                </div>


                <div id="section_nom_propre" class="section">
                  <h2>Nom propre</h2>
                  <div class="container">
                    <div class="block">
                      <h3>Genre</h3>
                      <p><input type="radio" id="up_nom_propre_genre_e" name="genre_mp" value=":e" /><label for="up_nom_propre_genre_e"> épicène</label></p>
                      <p><input type="radio" id="up_nom_propre_genre_m" name="genre_mp" value=":m" /><label for="up_nom_propre_genre_m"> masculin</label></p>
                      <p><input type="radio" id="up_nom_propre_genre_f" name="genre_mp" value=":f" /><label for="up_nom_propre_genre_f"> féminin</label></p>
                    </div>
                    <div class="block">
                      <h3>Pluriel</h3>
                      <p>Les noms propres sont invariables en nombre.</p>
                    </div>
                  </div>
                </div>


                <div id="section_autre" class="section">
                  <h2>Autre</h2>
                  <p>Indiquez les étiquettes grammaticales que vous voulez appliquer au mot. À utiliser seulement si vous savez ce que vous faites.</p>
                  <h3>Flexion</h3>
                  <p><input type="text" id="flexion" name="flexion" maxlength="20" value="" pattern="^[a-zA-Zà-ö0-9À-Öø-ÿØ-ßĀ-ʯ._-]+$" placeholder="flexion" /></p>
                  <h3>Étiquettes</h3>
                  <p><input type="text" id="tags" name="tags" maxlength="20" value="" pattern="^:[a-zA-Zà-ö0-9À-Öø-ÿØ-ßĀ-ʯ:._-]+$" placeholder="étiquettes" /></p>
                </div>
              </div>
            </div>
          </div> <!-- #new_word_generator -->
          
          <div id="generated_words">
            <h2>Mots générés</h2>
            <h3>Flexions, étiquettes</h3>
            <pre id="results">
              
            </pre>
            
            <div id="buttonline">
              <div id="add_to_lexicon">Ajouter au dictionnaire</div>
            </div>
          </div> <!-- #generated_words -->
        </div> <!-- .columns -->
      </div> <!-- #add_word_page -->


      <div id="lexicon_page">
        
        <div class="columns">
          <div>
            <h2>Votre lexique</h2>

            <div class="button_block">
              <div id="save_button" class="fright">
                Enregistrer
              </div>
              <h3>Lexique</h3>
              <p>Nombre d’entrées ajoutées : <span id="num_added_entries">0</span>.</p>
              <p>Nombre d’entrées supprimées : <span id="num_deleted_entries">0</span>.</p>
              <p>Nombre d’entrées : <span id="num_entries">0</span>.</p>
              <p><progress id="build_progress" value="0"></p>
              <div id="export_button" class="fright">
                Exporter
              </div>
              <div id="import_button" class="fright">
                Importer
              </div>
              <h3>Dictionnaire enregistré</h3>
              <p>Dernière sauvegarde : <span id="save_date">néant</span>.</p>
              <p>Nombre d’entrées : <span id="num_entries_saved">0</span>.</p>
            </div>  
          </div>

          <div>
            <p id="no_elem_line">Aucun élément.</p>
            <p><progress id="display_progress" value="0"></p>
            <table id="table">
              
            </table>
          </div>
        </div>

      </div> <!-- #lexicon_page -->

    </div>


    <script src="../grammalecte/graphspell/helpers.js"></script>
    <script src="../grammalecte/graphspell/str_transform.js"></script>







>

<



>

<







<
<
<
<



>

<







<
<
<
<



>

<







<
<
<
<



>

<












<
|

<
|

|







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

<
<
<
|

|
<
<
<







190
191
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
218
219
220
221
222




223
224
225
226
227

228
229
230
231
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



269



270








271



272
273
274



275
276
277
278
279
280
281
                        <li><b>3ᵉ groupe</b>. Autres verbes irréguliers.</li>
                        <li>Les verbes <i>être</i> et <i>avoir</i> n’appartiennent à aucun groupe. Il est recommandé de ne pas s’en servir comme modèle.</li>
                      </ul>
                    </details>
                  </div>
                </div>

                <h3 class="category" id="select_adverbe" data-tag="W">Adverbe</h3>
                <div id="section_adverbe" class="section">

                  <p>Les adverbes sont invariables en genre et en nombre.</p>
                </div>

                <h3 class="category" id="select_prenom" data-tag="M1">Prénom</h3>
                <div id="section_prenom" class="section">

                  <div class="container">
                    <div class="block">
                      <h3>Genre</h3>
                      <p><input type="radio" id="up_prenom_genre_e" name="genre_m1" value=":e" /><label for="up_prenom_genre_e"> épicène</label></p>
                      <p><input type="radio" id="up_prenom_genre_m" name="genre_m1" value=":m" /><label for="up_prenom_genre_m"> masculin</label></p>
                      <p><input type="radio" id="up_prenom_genre_f" name="genre_m1" value=":f" /><label for="up_prenom_genre_f"> féminin</label></p>
                    </div>




                  </div>
                </div>

                <h3 class="category" id="select_patronyme" data-tag="M2">Patronyme</h3>
                <div id="section_patronyme" class="section">

                  <div class="container">
                    <div class="block">
                      <h3>Genre</h3>
                      <p><input type="radio" id="up_patronyme_genre_e" name="genre_m2" value=":e" /><label for="up_patronyme_genre_e"> épicène</label></p>
                      <p><input type="radio" id="up_patronyme_genre_m" name="genre_m2" value=":m" /><label for="up_patronyme_genre_m"> masculin</label></p>
                      <p><input type="radio" id="up_patronyme_genre_f" name="genre_m2" value=":f" /><label for="up_patronyme_genre_f"> féminin</label></p>
                    </div>




                  </div>
                </div>

                <h3 class="category" id="select_nom_propre" data-tag="MP">Nom propre</h3>
                <div id="section_nom_propre" class="section">

                  <div class="container">
                    <div class="block">
                      <h3>Genre</h3>
                      <p><input type="radio" id="up_nom_propre_genre_e" name="genre_mp" value=":e" /><label for="up_nom_propre_genre_e"> épicène</label></p>
                      <p><input type="radio" id="up_nom_propre_genre_m" name="genre_mp" value=":m" /><label for="up_nom_propre_genre_m"> masculin</label></p>
                      <p><input type="radio" id="up_nom_propre_genre_f" name="genre_mp" value=":f" /><label for="up_nom_propre_genre_f"> féminin</label></p>
                    </div>




                  </div>
                </div>

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

                  <p>Indiquez les étiquettes grammaticales que vous voulez appliquer au mot. À utiliser seulement si vous savez ce que vous faites.</p>
                  <h3>Flexion</h3>
                  <p><input type="text" id="flexion" name="flexion" maxlength="20" value="" pattern="^[a-zA-Zà-ö0-9À-Öø-ÿØ-ßĀ-ʯ._-]+$" placeholder="flexion" /></p>
                  <h3>Étiquettes</h3>
                  <p><input type="text" id="tags" name="tags" maxlength="20" value="" pattern="^:[a-zA-Zà-ö0-9À-Öø-ÿØ-ßĀ-ʯ:._-]+$" placeholder="étiquettes" /></p>
                </div>
              </div>
            </div>
          </div> <!-- #new_word_generator -->
          
          <div id="generated_words">
            <h2>Mots générés</h2>

            <table id="generated_words_table">
              

            </table>
            <div id="buttonline">
              <div id="add_to_lexicon">Ajouter au lexique</div>
            </div>
          </div> <!-- #generated_words -->
        </div> <!-- .columns -->
      </div> <!-- #add_word_page -->


      <div id="lexicon_page">



        <h2>Votre lexique</h2>

        <div class="big_block">
          <div id="save_button" class="fright">
            Enregistrer
          </div>



          <p>Nombre d’entrées : <span id="num_entries">0</span>.</p>



        </div>












        <table id="lexicon_table">
              
        </table>



      </div> <!-- #lexicon_page -->

    </div>


    <script src="../grammalecte/graphspell/helpers.js"></script>
    <script src="../grammalecte/graphspell/str_transform.js"></script>

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

1
2
3
4
5
6
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
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
98
99
100
101
102
103
104
105
106
107
108
109
110
// JavaScript

"use strict";

// Chrome don’t follow the W3C specification:
// https://browserext.github.io/browserext/
let bChrome = false;
if (typeof(browser) !== "object") {
    var browser = chrome;
    bChrome = true;
}










function createNode  (sType, oAttr, oDataset=null) {
    try {
        let xNode = document.createElement(sType);
        Object.assign(xNode, oAttr);
        if (oDataset) {
            Object.assign(xNode.dataset, oDataset);
        }
        return xNode;
    }
    catch (e) {
        showError(e);
    }
}

function showError (e) {
    console.error(e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message);
}


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", () => { oBinaryDict.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);
document.getElementById("add_to_lexicon").addEventListener("click", () => { oFlexGen.addToLexicon(); }, false);



/*
    ACTIONS
*/

const oWidgets = {

    showPage: function (sPage) {
        if (sPage == "lexicon") {
            this.hideElement("add_word_page");
            this.showElement("lexicon_page");
            document.getElementById("lexicon_button").style.backgroundColor = "hsl(210, 80%, 90%)";
            document.getElementById("add_word_button").style.backgroundColor = "hsl(210, 10%, 95%)";
        } else {
            this.hideElement("lexicon_page");
            this.showElement("add_word_page");
            document.getElementById("lexicon_button").style.backgroundColor = "hsl(210, 10%, 95%)";
            document.getElementById("add_word_button").style.backgroundColor = "hsl(210, 80%, 90%)";
            document.getElementById("lemma").focus();
        }
    },

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


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

    },














    hideAllSections: function () {












        for (let xElem of document.getElementById("sections").childNodes) {













































































            if (xElem.id) {









                xElem.style.display = "none";




            }































        }
    },

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

    clear: function () {
        try {
            document.getElementById("lemma2").value = "";
            this.hideElement("word_section2");
            // nom, adjectif, noms propres
            for (let xElem of document.getElementsByName("POS")) {
                xElem.checked = false;
            }
            for (let xElem of document.getElementsByName("POS2")) {
                xElem.checked = false;
            }












>
>
>
>
>
>
>
>
>














|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
|
|
|
|
<
|
>
|
|
|
|
|
|
>
|
>
>
>
>
>
>
>
>
>
>
>
>
|
>
|
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
|
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>






|





|







1
2
3
4
5
6
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
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
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
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
186
187
188
189
190
191
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
218
219
220
221
222
223
// JavaScript

"use strict";

// Chrome don’t follow the W3C specification:
// https://browserext.github.io/browserext/
let bChrome = false;
if (typeof(browser) !== "object") {
    var browser = chrome;
    bChrome = true;
}


/*
    Common functions
*/

function showError (e) {
    console.error(e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message);
}

function createNode  (sType, oAttr, oDataset=null) {
    try {
        let xNode = document.createElement(sType);
        Object.assign(xNode, oAttr);
        if (oDataset) {
            Object.assign(xNode.dataset, oDataset);
        }
        return xNode;
    }
    catch (e) {
        showError(e);
    }
}

function showElement (sElemId) {











































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

}

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

function showPage (sPage) {
    if (sPage == "lexicon") {
        hideElement("add_word_page");
        showElement("lexicon_page");
        document.getElementById("lexicon_button").style.backgroundColor = "hsl(210, 80%, 90%)";
        document.getElementById("add_word_button").style.backgroundColor = "hsl(210, 10%, 95%)";
    } else {
        hideElement("lexicon_page");
        showElement("add_word_page");
        document.getElementById("lexicon_button").style.backgroundColor = "hsl(210, 10%, 95%)";
        document.getElementById("add_word_button").style.backgroundColor = "hsl(210, 80%, 90%)";
        document.getElementById("lemma").focus();
    }
}


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

document.getElementById("save_button").addEventListener("click", () => { oBinaryDict.build(); }, false);



class Table {

    constructor (sNodeId, lColumn, sProgressBarId, sResultId="") {
        this.sNodeId = sNodeId;
        this.xTable = document.getElementById(sNodeId);
        this.nColumn = lColumn.length;
        this.lColumn = lColumn;
        this.xProgressBar = document.getElementById(sProgressBarId);
        this.xNumEntry = document.getElementById(sResultId);
        this.iEntryIndex = 0;
        this.lEntry = [];
        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 () {
        while (this.xTable.firstChild) {
            this.xTable.removeChild(this.xTable.firstChild);
        }
        this.iEntryIndex = 0;
        this._createHeader();
    }

    fill (lFlex) {
        this.clear();
        if (lFlex.length > 0) {
            this.xProgressBar.max = lFlex.length;
            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;
    }

    listen () {
        this.xTable.addEventListener("click", (xEvent) => { this.onTableClick(xEvent); }, false);
    }

    onTableClick (xEvent) {
        try {
            let xElem = xEvent.target;
            if (xElem.className) {
                if (xElem.className == "delete_entry") {
                    this.deleteRow(xElem.dataset.id_entry);
                }
            }
        }
        catch (e) {
            showError(e);
        }
    }

    deleteRow (iEntry) {
        this.lEntry[parseInt(iEntry)] = null;
        if (document.getElementById(this.sNodeId + "_row_" + iEntry)) {
            document.getElementById(this.sNodeId + "_row_" + iEntry).style.display = "none";
        }
        this.nEntry -= 1;
        this.showEntryNumber();
    }

    getEntries () {
        return this.lEntry.filter((e) => e !== null);
    }
}


const oGenerator = {

    cMainTag: "",

    lFlexion: [],

    listen: function () {
        document.getElementById("editor").addEventListener("click", (xEvent) => { this.onSelectionClick(xEvent); }, false);
        document.getElementById("lemma").addEventListener("keyup", () => { this.onWrite(); }, false);
        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
            for (let xElem of document.getElementsByName("POS")) {
                xElem.checked = false;
            }
            for (let xElem of document.getElementsByName("POS2")) {
                xElem.checked = false;
            }
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
186
187
188
189
190
191
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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341

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

    onWrite: function () {
        if (document.getElementById("lemma").value.trim() !== "") {
            this.showElement("editor");
            oFlexGen.update();
        } else {
            this.hideElement("editor");
        }
    },

    onWrite2: function () {
        if (document.getElementById("lemma2").value.trim() !== "") {
            this.showElement("word_section2");
            oFlexGen.update();
        } else {
            this.hideElement("word_section2");
        }
    },

    createLexiconHeader: function () {
        let xRowNode = createNode("tr");
        xRowNode.appendChild(createNode("th", { textContent: "·" }));
        xRowNode.appendChild(createNode("th", { textContent: "#" }));
        xRowNode.appendChild(createNode("th", { textContent: "Forme fléchie" }));
        xRowNode.appendChild(createNode("th", { textContent: "Lemme" }));
        xRowNode.appendChild(createNode("th", { textContent: "Étiquettes" }));
        return xRowNode;
    },

    createLexiconRow: function (n, sFlexion, sLemma, sTags) {
        let xRowNode = createNode("tr", { id: "row_" + n });
        xRowNode.appendChild(createNode("td", { textContent: "×", className: "delete_entry", title: "Effacer cette entrée" }, { id_entry: n }));
        xRowNode.appendChild(createNode("td", { textContent: n }));
        xRowNode.appendChild(createNode("td", { textContent: sFlexion }));
        xRowNode.appendChild(createNode("td", { textContent: sLemma }));
        xRowNode.appendChild(createNode("td", { textContent: sTags }));
        return xRowNode;
    },

    fillLexiconTable: function (lFlex) {
        this.clearTable("table");
        if (lFlex.length > 0) {
            this.showElement("display_progress");
            let xDisplayProgress = document.getElementById("display_progress");
            let xTable = document.getElementById("table");
            let n = 0;
            xDisplayProgress.max = lFlex.length;
            xDisplayProgress.value = 1;
            this.hideElement("no_elem_line");
            xTable.appendChild(this.createLexiconHeader());
            for (let [sFlexion, sLemma, sTags] of lFlex) {
                xTable.appendChild(this.createLexiconRow(n, sFlexion, sLemma, sTags));
                n += 1;
                xDisplayProgress.value += 1;
            }
            xDisplayProgress.value = xDisplayProgress.max;
            this.hideElement("display_progress");
        } else {
            this.showElement("no_elem_line");
        }
        this.updateData();
    },

    clearTable: function (sNodeId) {
        let xTable = document.getElementById(sNodeId);
        while (xTable.firstChild) {
            xTable.removeChild(xTable.firstChild);
        }
    },

    onTableClick: function (xEvent) {
        try {
            let xElem = xEvent.target;
            if (xElem.className) {
                if (xElem.className == "delete_entry") {
                    this.deleteEntry(xElem.dataset.id_entry);
                }
            }
        }
        catch (e) {
            showError(e);
        }
    },

    addEntriesToTable: function (iStart, lFlex) {
        let xTable = document.getElementById("table");
        if (lFlex.length > 0) {
            if (document.getElementById("no_elem_line").style.display !== "none") {
                this.hideElement("no_elem_line");
                xTable.appendChild(this.createLexiconHeader());
            }
            for (let [sFlexion, sLemma, sTags] of lFlex) {
                xTable.appendChild(this.createLexiconRow(iStart, sFlexion, sLemma, sTags));
                iStart += 1;
            }
        }
        this.updateData();
    },

    deleteEntry: function (iEntry) {
        oLexicon.deleteEntry(iEntry);
        this.hideElement("row_"+iEntry);
        this.showElement("save_button");
        this.updateData();
    },

    updateData: function () {
        document.getElementById("num_added_entries").textContent = oLexicon.nAddedEntries;
        document.getElementById("num_deleted_entries").textContent = oLexicon.nDeletedEntries;
        document.getElementById("num_entries").textContent = oLexicon.nEntries;
    },

    setDictData: function (nEntries, sDate) {
        document.getElementById("num_entries_saved").textContent = nEntries;
        document.getElementById("save_date").textContent = sDate;
    }
}



const oFlexGen = {

    cMainTag: "",

    lFlexion: [],

    clear: function () {
        this.lFlexion = [];
    },

    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 sLemma = document.getElementById("lemma").value.trim();
            if (sLemma.length > 0) {
                switch (this.cMainTag) {
                    case "N":
                        if (!this.getRadioValue("POS") || !this.getRadioValue("genre")) {
                            break;
                        }
                        let sTag = this.getRadioValue("POS") + this.getRadioValue("genre");
                        switch (this.getRadioValue("pluriel")) {
                            case "s":
                                this.addFlexion(sLemma, sLemma, sTag+":s/*");
                                this.addFlexion(sLemma+"s", sLemma, sTag+":p/*");
                                break;
                            case "x":
                                this.addFlexion(sLemma, sLemma, sTag+":s/*");
                                this.addFlexion(sLemma+"x", sLemma, sTag+":p/*");
                                break;
                            case "i":
                                this.addFlexion(sLemma, sLemma, sTag+":i/*");
                                break;
                        }
                        let sLemma2 = document.getElementById("lemma2").value.trim();
                        if (sLemma2.length > 0  &&  this.getRadioValue("POS2")  &&  this.getRadioValue("genre2")) {
                            let sTag2 = this.getRadioValue("POS2") + this.getRadioValue("genre2");
                            switch (this.getRadioValue("pluriel2")) {
                                case "s":
                                    this.addFlexion(sLemma2, sLemma, sTag2+":s/*");
                                    this.addFlexion(sLemma2+"s", sLemma, sTag2+":p/*");
                                    break;
                                case "x":
                                    this.addFlexion(sLemma2, sLemma, sTag2+":s/*");
                                    this.addFlexion(sLemma2+"x", sLemma, sTag2+":p/*");
                                    break;
                                case "i":
                                    this.addFlexion(sLemma2, sLemma, sTag2+":i/*");
                                    break;
                            }
                        }
                        break;
                    case "V": {
                        if (!sLemma.endsWith("er") && !sLemma.endsWith("ir") && !sLemma.endsWith("re")) {
                            break;







|
|

|










|
|

|





|
|

|

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




|











|
|


|
|


|







|
|


|
|


|







253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287























































































































288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335

    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();
                }
            }
        }
        catch (e) {
            showError(e);
        }
    },

    onWrite: function () {
        if (document.getElementById("lemma").value.trim() !== "") {
            showElement("editor");
            this.update();
        } else {
            hideElement("editor");
        }
    },

    onWrite2: function () {
        if (document.getElementById("lemma2").value.trim() !== "") {
            showElement("word_section2");
            this.update();
        } else {
            hideElement("word_section2");
        }























































































































    },

    update: function () {
        try {
            this.lFlexion = [];
            let sGenderTag = "";
            let sLemma = document.getElementById("lemma").value.trim();
            if (sLemma.length > 0) {
                switch (this.cMainTag) {
                    case "N":
                        if (!this.getRadioValue("POS") || !this.getRadioValue("genre")) {
                            break;
                        }
                        let sTag = this.getRadioValue("POS") + this.getRadioValue("genre");
                        switch (this.getRadioValue("pluriel")) {
                            case "s":
                                this.lFlexion.push([sLemma, sTag+":s/*"]);
                                this.lFlexion.push([sLemma+"s", sTag+":p/*"]);
                                break;
                            case "x":
                                this.lFlexion.push([sLemma, sTag+":s/*"]);
                                this.lFlexion.push([sLemma+"x", sTag+":p/*"]);
                                break;
                            case "i":
                                this.lFlexion.push([sLemma, sTag+":i/*"]);
                                break;
                        }
                        let sLemma2 = document.getElementById("lemma2").value.trim();
                        if (sLemma2.length > 0  &&  this.getRadioValue("POS2")  &&  this.getRadioValue("genre2")) {
                            let sTag2 = this.getRadioValue("POS2") + this.getRadioValue("genre2");
                            switch (this.getRadioValue("pluriel2")) {
                                case "s":
                                    this.lFlexion.push([sLemma2, sTag2+":s/*"]);
                                    this.lFlexion.push([sLemma2+"s", sTag2+":p/*"]);
                                    break;
                                case "x":
                                    this.lFlexion.push([sLemma2, sTag2+":s/*"]);
                                    this.lFlexion.push([sLemma2+"x", sTag2+":p/*"]);
                                    break;
                                case "i":
                                    this.lFlexion.push([sLemma2, sTag2+":i/*"]);
                                    break;
                            }
                        }
                        break;
                    case "V": {
                        if (!sLemma.endsWith("er") && !sLemma.endsWith("ir") && !sLemma.endsWith("re")) {
                            break;
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
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
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
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
542
543
544
545
546










547
548
549


550
551
552
553
554
555
556
557
558
559
560
561

562
563
564
565

566
567
568
569
570
571
572
573
574




575


                        let sVerbTag = c_i + c_t + c_n + c_p + c_m + c_ae + c_aa;
                        if (!sVerbTag.endsWith("__") && !sVerbTag.startsWith("____")) {
                            let sVerbPattern = document.getElementById("verb_pattern").value.trim();
                            if (sVerbPattern.length == 0) {
                                // utilisation du générateur de conjugaison
                                let bVarPpas = document.getElementById("up_partpas").checked;
                                for (let [sFlexion, sFlexTags] of conj_generator.conjugate(sLemma, sVerbTag, bVarPpas)) {
                                    this.addFlexion(sFlexion, sLemma, sFlexTags);
                                }
                            } else {
                                // copie du motif d’un autre verbe : utilisation du conjugueur
                                if (conj.isVerb(sVerbPattern)) {
                                    let oVerb = new Verb(sLemma, sVerbPattern);
                                    for (let [sTag1, dFlex] of oVerb.dConj.entries()) {
                                        if (sTag1 !== ":Q") {
                                            for (let [sTag2, sConj] of dFlex.entries()) {
                                                if (sTag2.startsWith(":") && sConj !== "") {
                                                    this.addFlexion(sConj, sLemma, ":V" + oVerb.cGroup + "_" + sVerbTag + sTag1 + sTag2);
                                                }
                                            }
                                        } else {
                                            // participes passés
                                            if (dFlex.get(":Q3") !== "") {
                                                if (dFlex.get(":Q2") !== "") {
                                                    this.addFlexion(dFlex.get(":Q1"), sLemma, ":V" + oVerb.cGroup + "_" + sVerbTag + ":Q:A:m:s/*");
                                                    this.addFlexion(dFlex.get(":Q2"), sLemma, ":V" + oVerb.cGroup + "_" + sVerbTag + ":Q:A:m:p/*");
                                                } else {
                                                    this.addFlexion(dFlex.get(":Q1"), sLemma, ":V" + oVerb.cGroup + "_" + sVerbTag + ":Q:A:m:i/*");
                                                }
                                                this.addFlexion(dFlex.get(":Q3"), sLemma, ":V" + oVerb.cGroup + "_" + sVerbTag + ":Q:A:f:s/*");
                                                this.addFlexion(dFlex.get(":Q4"), sLemma, ":V" + oVerb.cGroup + "_" + sVerbTag + ":Q:A:f:p/*");
                                            } else {
                                                this.addFlexion(dFlex.get(":Q1"), sLemma, ":V" + oVerb.cGroup + "_" + sVerbTag + ":Q:e:i/*");
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        break;
                    }
                    case "W":
                        sLemma = sLemma.toLowerCase();
                        this.addFlexion(sLemma, sLemma, ":W/*");
                        break;
                    case "M1":
                        sLemma = sLemma.slice(0,1).toUpperCase() + sLemma.slice(1);
                        sGenderTag = this.getRadioValue("genre_m1");
                        if (sGenderTag) {
                            this.addFlexion(sLemma, sLemma, ":M1"+sGenderTag+":i/*");
                        }
                        break;
                    case "M2":
                        sLemma = sLemma.slice(0,1).toUpperCase() + sLemma.slice(1);
                        sGenderTag = this.getRadioValue("genre_m2");
                        if (sGenderTag) {
                            this.addFlexion(sLemma, sLemma, ":M2"+sGenderTag+":i/*");
                        }
                        break;
                    case "MP":
                        sGenderTag = this.getRadioValue("genre_mp");
                        if (sGenderTag) {
                            this.addFlexion(sLemma, sLemma, ":MP"+sGenderTag+":i/*");
                        }
                        break;
                    case "X":
                        let sFlexion = document.getElementById("flexion").value.trim();
                        let sTags = document.getElementById("tags").value.trim();
                        if (sFlexion.length > 0 && sTags.startsWith(":")) {
                            this.addFlexion(sFlexion, sLemma, sTags);
                        }
                        break;
                }
            }
            this.show();
        }
        catch (e) {
            showError(e);
        }
    },

    getRadioValue: function (sName) {
        if (document.querySelector('input[name="' + sName + '"]:checked')) {
            return document.querySelector('input[name="' + sName + '"]:checked').value;
        }
        return null;
    },

    show: function () {

        let sText = "";
        for (let [sFlexion, sLemma, sTag] of this.lFlexion) {
            sText += sFlexion + "\t" + sTag + "\n";
        }
        document.getElementById("results").textContent = sText;

    },

    addToLexicon: function () {
        try {
            oLexicon.addFlexions(this.lFlexion);

            document.getElementById("lemma").value = "";
            document.getElementById("lemma").focus();
            oWidgets.hideElement("editor");
            oWidgets.clear();
            oWidgets.showElement("save_button");
            this.clear();
            this.cMainTag = "";
        }
        catch (e) {
            showError(e);
        }
    }
}



const oLexicon = {

    lFlexion: [],
    nEntries: 0,
    nDeletedEntries: 0,
    nAddedEntries: 0,

    set: function (lFlexion) {
        this.lFlexion = lFlexion;
        this.resetModif();
        oWidgets.fillLexiconTable(this.lFlexion);
        if (this.lFlexion.length > 0) {
            oWidgets.showElement("export_button");
        } else {
            oWidgets.hideElement("export_button");
        }
    },

    addFlexions: function (lNewFlex) {
        let iStart = this.lFlexion.length;
        for (let aFlex of lNewFlex) {
            this.lFlexion.push(aFlex);
        }
        this.nAddedEntries += lNewFlex.length;
        this.nEntries += lNewFlex.length;
        oWidgets.addEntriesToTable(iStart, lNewFlex);
    },

    deleteEntry: function (iEntry) {
        this.lFlexion[parseInt(iEntry)] = null;
        this.nDeletedEntries++;
        this.nEntries--;
    },

    resetModif: function () {
        this.nEntries = this.lFlexion.length;
        this.nAddedEntries = 0;
        this.nDeletedEntries = 0;
    },

    save: function () {
        oWidgets.hideElement("save_button");
        this.lFlexion = this.lFlexion.filter((e) => e !== null);
        oBinaryDict.build(this.lFlexion);
        this.resetModif();
        oWidgets.fillLexiconTable(this.lFlexion);
        oWidgets.updateData();
    }
}


const oBinaryDict = {
    
    oIBDAWG: null,

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

    _load: function (oResult) {
        if (!oResult.hasOwnProperty("oPersonalDictionary")) {
            oWidgets.hideElement("export_button");
            return;
        }
        let oJSON = oResult.oPersonalDictionary;
        this.oIBDAWG = new IBDAWG(oJSON);
        let lEntry = [];
        for (let s of this.oIBDAWG.select()) {
            lEntry.push(s.split("\t"));
        }        
        oLexicon.set(lEntry);
        oWidgets.setDictData(this.oIBDAWG.nEntry, this.oIBDAWG.sDate);
        oWidgets.showElement("export_button");
    },











    build: function (lEntry) {
        oWidgets.showElement("build_progress");
        let xProgressNode = document.getElementById("build_progress");


        let oDAWG = new DAWG(lEntry, "S", "fr", "Français", "Dictionnaire personnel", xProgressNode);
        let oJSON = oDAWG.createBinaryJSON(1);
        this.save(oJSON);
        this.oIBDAWG = new IBDAWG(oJSON);
        oWidgets.setDictData(this.oIBDAWG.nEntry, this.oIBDAWG.sDate);
        oWidgets.hideElement("build_progress");
        oWidgets.showElement("export_button");
        browser.runtime.sendMessage({ sCommand: "setDictionary", dParam: {sType: "personal", oDict: oJSON}, dInfo: {} });
    },

    save: function (oJSON) {
        browser.storage.local.set({ "oPersonalDictionary": oJSON });

    },

    import: function () {
        // TO DO

    },

    export: function () {
        let xBlob = new Blob([ JSON.stringify(this.oIBDAWG.getJSON()) ], {type: 'application/json'}); 
        let sURL = URL.createObjectURL(xBlob);
        browser.downloads.download({ filename: "fr.personal.json", url: sURL, saveAs: true });
    }
}





oBinaryDict.load();









|









|






|
|

|

|
|

|










|





|






|





|






|




|













|
>
|
|
|

<
>




|
>


|
|
|









<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















|








|
|
|


>
>
>
>
>
>
>
>
>
>
|
<
|
>
>
|
|
|
|
|
<
<
|
<
|
<
<
>



<
>









>
>
>
>

>
>
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
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
458
459
460




















































461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501

502
503
504
505
506
507
508
509


510

511


512
513
514
515

516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
                        let sVerbTag = c_i + c_t + c_n + c_p + c_m + c_ae + c_aa;
                        if (!sVerbTag.endsWith("__") && !sVerbTag.startsWith("____")) {
                            let sVerbPattern = document.getElementById("verb_pattern").value.trim();
                            if (sVerbPattern.length == 0) {
                                // utilisation du générateur de conjugaison
                                let bVarPpas = document.getElementById("up_partpas").checked;
                                for (let [sFlexion, sFlexTags] of conj_generator.conjugate(sLemma, sVerbTag, bVarPpas)) {
                                    this.lFlexion.push([sFlexion, sFlexTags]);
                                }
                            } else {
                                // copie du motif d’un autre verbe : utilisation du conjugueur
                                if (conj.isVerb(sVerbPattern)) {
                                    let oVerb = new Verb(sLemma, sVerbPattern);
                                    for (let [sTag1, dFlex] of oVerb.dConj.entries()) {
                                        if (sTag1 !== ":Q") {
                                            for (let [sTag2, sConj] of dFlex.entries()) {
                                                if (sTag2.startsWith(":") && sConj !== "") {
                                                    this.lFlexion.push([sConj, ":V" + oVerb.cGroup + "_" + sVerbTag + sTag1 + sTag2]);
                                                }
                                            }
                                        } else {
                                            // participes passés
                                            if (dFlex.get(":Q3") !== "") {
                                                if (dFlex.get(":Q2") !== "") {
                                                    this.lFlexion.push([dFlex.get(":Q1"), ":V" + oVerb.cGroup + "_" + sVerbTag + ":Q:A:m:s/*"]);
                                                    this.lFlexion.push([dFlex.get(":Q2"), ":V" + oVerb.cGroup + "_" + sVerbTag + ":Q:A:m:p/*"]);
                                                } else {
                                                    this.lFlexion.push([dFlex.get(":Q1"), ":V" + oVerb.cGroup + "_" + sVerbTag + ":Q:A:m:i/*"]);
                                                }
                                                this.lFlexion.push([dFlex.get(":Q3"), ":V" + oVerb.cGroup + "_" + sVerbTag + ":Q:A:f:s/*"]);
                                                this.lFlexion.push([dFlex.get(":Q4"), ":V" + oVerb.cGroup + "_" + sVerbTag + ":Q:A:f:p/*"]);
                                            } else {
                                                this.lFlexion.push([dFlex.get(":Q1"), ":V" + oVerb.cGroup + "_" + sVerbTag + ":Q:e:i/*"]);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        break;
                    }
                    case "W":
                        sLemma = sLemma.toLowerCase();
                        this.lFlexion.push([sLemma, ":W/*"]);
                        break;
                    case "M1":
                        sLemma = sLemma.slice(0,1).toUpperCase() + sLemma.slice(1);
                        sGenderTag = this.getRadioValue("genre_m1");
                        if (sGenderTag) {
                            this.lFlexion.push([sLemma, ":M1"+sGenderTag+":i/*"]);
                        }
                        break;
                    case "M2":
                        sLemma = sLemma.slice(0,1).toUpperCase() + sLemma.slice(1);
                        sGenderTag = this.getRadioValue("genre_m2");
                        if (sGenderTag) {
                            this.lFlexion.push([sLemma, ":M2"+sGenderTag+":i/*"]);
                        }
                        break;
                    case "MP":
                        sGenderTag = this.getRadioValue("genre_mp");
                        if (sGenderTag) {
                            this.lFlexion.push([sLemma, ":MP"+sGenderTag+":i/*"]);
                        }
                        break;
                    case "X":
                        let sFlexion = document.getElementById("flexion").value.trim();
                        let sTags = document.getElementById("tags").value.trim();
                        if (sFlexion.length > 0 && sTags.startsWith(":")) {
                            this.lFlexion.push([sFlexion, sTags]);
                        }
                        break;
                }
            }
            oGenWordsTable.fill(this.lFlexion);
        }
        catch (e) {
            showError(e);
        }
    },

    getRadioValue: function (sName) {
        if (document.querySelector('input[name="' + sName + '"]:checked')) {
            return document.querySelector('input[name="' + sName + '"]:checked').value;
        }
        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);
        }
    }
}






















































const oBinaryDict = {
    
    oIBDAWG: null,

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

    _load: function (oResult) {
        if (!oResult.hasOwnProperty("oPersonalDictionary")) {
            hideElement("export_button");
            return;
        }
        let oJSON = oResult.oPersonalDictionary;
        this.oIBDAWG = new IBDAWG(oJSON);
        let lEntry = [];
        for (let s of this.oIBDAWG.select()) {
            lEntry.push(s.split("\t"));
        }        
        oLexiconTable.fill(lEntry);
        this.setDictData(this.oIBDAWG.nEntry, this.oIBDAWG.sDate);
        showElement("export_button");
    },

    setDictData: function (nEntries, sDate) {
        document.getElementById("dic_num_entries").textContent = nEntries;
        document.getElementById("dic_save_date").textContent = sDate;
    },

    listen () {
        document.getElementById("export_button").addEventListener("click", () => { this.export(); }, false);
        document.getElementById("import_button").addEventListener("click", () => { this.import(); }, false);
    },

    build: function () {

        let xProgressNode = document.getElementById("wait_progress");
        let lEntry = oLexiconTable.getEntries();
        if (lEntry.length > 0) {
            let oDAWG = new DAWG(lEntry, "S", "fr", "Français", "Dictionnaire personnel", xProgressNode);
            let oJSON = oDAWG.createBinaryJSON(1);
            browser.storage.local.set({ "oPersonalDictionary": oJSON });
            this.oIBDAWG = new IBDAWG(oJSON);
            this.setDictData(this.oIBDAWG.nEntry, this.oIBDAWG.sDate);    


            browser.runtime.sendMessage({ sCommand: "setDictionary", dParam: {sType: "personal", oDict: oJSON}, dInfo: {} });

        }


        showElement("export_button");
    },

    import: function () {

        console.log("import");
    },

    export: function () {
        let xBlob = new Blob([ JSON.stringify(this.oIBDAWG.getJSON()) ], {type: 'application/json'}); 
        let sURL = URL.createObjectURL(xBlob);
        browser.downloads.download({ filename: "fr.personal.json", url: sURL, saveAs: true });
    }
}


const oLexiconTable = new Table("lexicon_table", ["Flexions", "Lemmes", "Étiquettes"], "wait_progress", "num_entries");
const oGenWordsTable = new Table("generated_words_table", ["Flexions", "Étiquettes"], "wait_progress");

oBinaryDict.load();
oBinaryDict.listen();
oGenerator.listen();