Grammalecte  Check-in [21a09f0c1a]

Overview
Comment:[fx] grammar checking ui
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fx | webext2
Files: files | file ages | folders
SHA3-256: 21a09f0c1a612e1362cbc8ae28367c329bf15dcc4dbf62e177b82900c9cb3b8c
User & Date: olr on 2017-08-16 08:41:08
Other Links: branch diff | manifest | tags
Context
2017-08-16
09:49
[fx] grammar checking ui check-in: bd4b42b289 user: olr tags: fx, webext2
08:41
[fx] grammar checking ui check-in: 21a09f0c1a user: olr tags: fx, webext2
2017-08-15
19:51
[fx][bug] no empty suggestions. check-in: 3e239888b8 user: olr tags: fx, webext2
Changes

Modified gc_lang/fr/webext/content_scripts/content_modifier.js from [4dca30bd26] to [f8304ae53e].

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
    console.log("Lexicographe");
    if (oLxgPanel !== null) {
        oLxgPanelContent.clear();
        oLxgPanel.show();
    } else {
        // create the panel
        oLxgPanel = new GrammalectePanel("grammalecte_lxg_panel", "Lexicographe", 500, 700);
        oLxgPanel.setContentNode(oLxgPanelContent.getNode());
        oLxgPanel.insertIntoPage();
    }
}

function createGCPanel () {
    console.log("Correction grammaticale");
    if (oGCPanel !== null) {
        oGCPanelContent.clear();
        oGCPanel.show();
    } else {
        // create the panel
        oGCPanel = new GrammalectePanel("grammalecte_gc_panel", "Correcteur", 500, 700);
        oGCPanel.setContentNode(oGCPanelContent.getNode());
        oGCPanel.insertIntoPage();
    }
}


/*
    Simple message







|












|







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
    console.log("Lexicographe");
    if (oLxgPanel !== null) {
        oLxgPanelContent.clear();
        oLxgPanel.show();
    } else {
        // create the panel
        oLxgPanel = new GrammalectePanel("grammalecte_lxg_panel", "Lexicographe", 500, 700);
        oLxgPanel.setContentNode(oLxgPanelContent.init());
        oLxgPanel.insertIntoPage();
    }
}

function createGCPanel () {
    console.log("Correction grammaticale");
    if (oGCPanel !== null) {
        oGCPanelContent.clear();
        oGCPanel.show();
    } else {
        // create the panel
        oGCPanel = new GrammalectePanel("grammalecte_gc_panel", "Correcteur", 500, 700);
        oGCPanel.setContentNode(oGCPanelContent.init());
        oGCPanel.insertIntoPage();
    }
}


/*
    Simple message

Modified gc_lang/fr/webext/content_scripts/content_panels.css from [9cb08148c3] to [5e96b80380].

99
100
101
102
103
104
105





































    background-color: hsl(0, 100%, 60%);
}

.grammalecte_panel_content {
    height: calc(100% - 55px); /* panel height - title_bar */
    overflow: auto;
}












































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
    background-color: hsl(0, 100%, 60%);
}

.grammalecte_panel_content {
    height: calc(100% - 55px); /* panel height - title_bar */
    overflow: auto;
}


/*
    CSS Spinner
    Double bounce
    http://tobiasahlin.com/spinkit/
*/
.grammalecte_spinner {
    width: 30px;
    height: 30px;
    position: absolute;
    top: 2px;
    right: 120px;
}
.grammalecte_spinner .bounce1,
.grammalecte_spinner .bounce2 {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: hsl(180, 50%, 75%);
    opacity: 0.6;
    position: absolute;
    top: 0;
    left: 0;
    animation: grammalecte-sk-bounce 2.0s infinite ease-in-out;
}
.bounce2 {
    animation-delay: -1.0s;
}

@keyframes grammalecte-sk-bounce {
    0%, 100% { 
        transform: scale(0.0);
    } 50% { 
        transform: scale(1.0);
    }
}

Modified gc_lang/fr/webext/content_scripts/gc_content.css from [04cea8aed7] to [809b952985].

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
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
    border-radius: 2px;
    text-decoration: none; /* to remove for wavy underlines */
}
.grammalecte_paragraph u.error:hover {
    cursor: pointer;
}




















/* 






















































    TOOLTIPS
*/





.tooltip {
    position: absolute;
    display: none;
    width: 300px;
    border-radius: 5px;
    box-shadow: 0 0 6px hsla(0, 0%, 0%, 0.3);
    font-family: Tahoma, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif;
    font-size: 12px;
    line-height: 18px;
    cursor: default;
    text-decoration: none;
}
#gc_tooltip {
    border: 3px solid hsl(210, 50%, 30%);
    color: hsla(210, 10%, 20%, 1);

}
#sc_tooltip {
    border: 3px solid hsl(0, 50%, 30%);
    color: hsla(0, 10%, 20%, 1);
}
#gc_tooltip_arrow, #sc_tooltip_arrow {
    position: absolute;
    display: none;


}
#gc_tooltip #gc_rule_id {
    display: none;
    margin: 0 0 5px 0;
    border: 1px solid hsl(210, 50%, 60%);
    background-color: hsl(210, 50%, 40%);
    padding: 2px 5px;
    border-radius: 2px;
    color: hsla(210, 0%, 96%, 1);
    font-size: 11px;
    font-style: normal;
    text-align: center;
}
#gc_message_block {
    padding: 5px 10px 10px 10px;
    background-color: hsl(210, 50%, 30%);
    color: hsl(210, 50%, 96%);
}
#sc_message_block {
    padding: 5px 10px 10px 10px;
    background-color: hsl(0, 50%, 30%);
    color: hsl(0, 50%, 96%);
}
#gc_message, #sc_message {
    font-size: 15px;
    margin-bottom: 5px;
}
a#gc_ignore, a#sc_ignore {
    padding: 0 2px;
    background-color: hsla(30, 30%, 40%, 1);
    color: hsla(30, 0%, 96%, 1);
    border-radius: 2px;
    cursor: pointer;
    text-decoration: none;
}
a#gc_ignore:hover, a#sc_ignore:hover {
    background-color: hsla(30, 30%, 50%, 1);
    color: hsla(0, 0%, 100%, 1);
    text-shadow: 0 0 3px hsl(30, 30%, 60%);
}
a#gc_url {
    padding: 0 2px;
    background-color: hsla(210, 50%, 50%, 1);
    color: hsla(210, 0%, 96%, 1);
    border-radius: 2px;
    cursor: pointer;
    text-decoration: none;
}
a#gc_url:hover {
    background-color: hsla(210, 50%, 60%, 1);
    color: hsla(0, 0%, 100%, 1);
    text-shadow: 0 0 3px hsl(210, 30%, 60%);
}
#gc_sugg_title {
    padding: 0 10px;
    background-color: hsl(210, 10%, 90%);
    color: hsl(210, 50%, 30%);
    font-size: 10px;
    font-weight: bold;
}
#sc_sugg_title {
    padding: 0 10px;
    background-color: hsl(0, 10%, 90%);
    color: hsl(0, 50%, 30%);
    font-size: 9px;
    font-weight: bold;
}
#gc_sugg_block {
    padding: 10px;
    background-color: hsl(210, 10%, 96%);
    border-radius: 0 0 2px 2px;
    line-height: 20px;
}
#sc_sugg_block {
    padding: 10px;
    background-color: hsl(0, 10%, 96%);
    border-radius: 0 0 2px 2px;
    line-height: 20px;
}
#gc_sugg_block a.sugg {
    padding: 1px 6px;
    background-color: hsla(180, 60%, 40%, 1);
    color: hsla(180, 0%, 96%, 1);
    border-radius: 2px;
    cursor: pointer;
    text-decoration: none;
}
#gc_sugg_block a.sugg:hover {
    background-color: hsla(180, 70%, 45%, 1);
    color: hsla(0, 0%, 100%, 1);
}
#sc_sugg_block a.sugg {
    padding: 1px 6px;
    background-color: hsla(30, 90%, 45%, 1);
    color: hsla(30, 0%, 96%, 1);
    border-radius: 2px;
    cursor: pointer;
    text-decoration: none;
}
#sc_sugg_block a.sugg:hover {
    background-color: hsla(30, 100%, 50%, 1);
    color: hsla(0, 0%, 100%, 1);
}

/*
    Action buttons
*/

.actions {
    margin: 0 0 5px 10px;
}

.actions .button {
    background-color: hsl(0, 0%, 50%);
    text-align: center;
    float: right;
    margin-left: 2px;
    padding: 1px 4px 3px 4px;
    /*width: 18px;
    height: 18px;*/
    cursor: pointer;
    font-size: 14px;
    color: hsl(0, 0%, 96%);
    border-radius: 2px;
}
.actions .button:hover {
    background-color: hsl(0, 0%, 40%);
    color: hsl(0, 0%, 100%);
}

.actions .green {
    background-color: hsl(120, 30%, 50%);
    color: hsl(0, 0%, 96%);
}
.actions .green:hover {
    background-color: hsl(120, 50%, 40%);
    color: hsl(0, 0%, 100%);
}
.actions .red {
    background-color: hsl(0, 30%, 50%);
    color: hsl(0, 0%, 96%);
}
.actions .red:hover {
    background-color: hsl(0, 50%, 40%);
    color: hsl(0, 0%, 100%);
}
.actions .orange {
    background-color: hsl(30, 50%, 50%);
    color: hsl(30, 0%, 96%);
}
.actions .orange:hover {
    background-color: hsl(30, 70%, 40%);
    color: hsl(30, 0%, 100%);
}
.actions .bold {
    font-weight: bold;
}


/*
    ERRORS
*/

.error {
    /* default color */
    background-color: hsl(240, 10%, 50%);
    color: hsl(240, 0%, 96%);
}
.error:hover {
    background-color: hsl(240, 10%, 40%);
    color: hsl(240, 0%, 100%);
}

/* elems */
.WORD {
    background-color: hsl(0, 50%, 50%);
    color: hsl(0, 0%, 96%);
    /*text-decoration: underline wavy hsl(0, 50%, 50%);*/
}
.WORD:hover {
    background-color: hsl(0, 60%, 40%);
    color: hsl(0, 0%, 100%);
}

/* elems */











.typo, .esp, .nbsp, .eif, .maj, .virg, .tu, .num, .unit, .nf, .liga, .mapos, .chim {

    background-color: hsl(30, 70%, 50%);
    color: hsl(30, 10%, 96%);
    /*text-decoration: underline wavy hsl(30, 70%, 50%);*/
}
.typo:hover, .esp:hover, .nbsp:hover, .eif:hover, .maj:hover, .virg:hover, .tu:hover, .num:hover, .unit:hover, .nf:hover, .liga:hover, .mapos:hover, .chim:hover {













    background-color: hsl(30, 80%, 45%);
    color: hsl(30, 10%, 96%);
}

/* elems */
.apos {
    background-color: hsl(40, 90%, 50%);
    color: hsl(40, 10%, 96%);
    /*text-decoration: underline wavy hsl(40, 70%, 45%);*/
}
.apos:hover {
    background-color: hsl(40, 100%, 45%);
    color: hsl(40, 10%, 96%);
}

/* elems */

.gn, .sgpl {
    background-color: hsl(210, 50%, 50%);
    color: hsl(210, 10%, 96%);
    /*text-decoration: underline wavy hsl(210, 50%, 50%);*/
}

.gn:hover, .sgpl:hover {
    background-color: hsl(210, 60%, 40%);
    color: hsl(210, 10%, 96%);
}

/* elems */





.conj, .infi, .imp, .inte, .ppas, .vmode  {
    background-color: hsl(300, 30%, 40%);
    color: hsl(300, 10%, 96%);
    /*text-decoration: underline wavy hsl(300, 40%, 40%);*/
}
.conj:hover, .infi:hover, .imp:hover, .inte:hover, .ppas:hover, .vmode:hover {






    background-color: hsl(300, 40%, 30%);
    color: hsl(300, 10%, 96%);
}

/* elems */

.conf, .ocr {
    background-color: hsl(270, 40%, 30%);
    color: hsl(270, 10%, 96%);
    /*text-decoration: underline wavy hsl(270, 40%, 30%);*/
}


.conf:hover, .ocr:hover {
    background-color: hsl(270, 50%, 20%);
    color: hsl(270, 10%, 96%);
}

/* elems */







.bs, .pleo, .neg, .redon1, .redon2, .mc, .date, .notype {
    background-color: hsl(180, 50%, 40%);
    color: hsl(180, 10%, 96%);
    /*text-decoration: underline wavy hsl(180, 50%, 40%);*/
}
.bs:hover, .pleo:hover, .neg:hover, .redon1:hover, .redon2:hover, .mc:hover, .date:hover, .notype:hover {








    background-color: hsl(180, 60%, 30%);
    color: hsl(180, 10%, 96%);
}








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

>
>
>
>
>
|










<
<


>

<
<
<
|
|
<
|
>
>

|

|









<
<
<
<
<
|
<
<
<
<
<



|







|




|







|




|






<
<
<
<
<
<
<
|





<
<
<
<
<
<
|







|



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





|



|












|




|



|



|



|



|



|



|








|




|





|




|





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




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





|




|





>
|




>
|





>
>
>
>
>
|




|
>
>
>
>
>
>





>
|




>
>
|





>
>
>
>
>
>
>
|




|
>
>
>
>
>
>
>
>



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
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
342
343
344
345
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
    border-radius: 2px;
    text-decoration: none; /* to remove for wavy underlines */
}
.grammalecte_paragraph u.error:hover {
    cursor: pointer;
}


.grammalecte_paragraph_actions {
    margin: 0 0 5px 10px;
}
.grammalecte_paragraph_actions .close_button {
    background-color: hsl(0, 0%, 50%);
    text-align: center;
    float: right;
    margin-left: 2px;
    padding: 1px 4px 3px 4px;
    cursor: pointer;
    font-size: 14px;
    color: hsl(0, 0%, 96%);
    border-radius: 2px;
    background-color: hsl(0, 30%, 50%);
    color: hsl(0, 0%, 96%);
}


/*
    Action buttons
*/

.grammalecte_actions {
    margin: 0 0 5px 10px;
}

.grammalecte_actions .button {
    background-color: hsl(0, 0%, 50%);
    text-align: center;
    float: right;
    margin-left: 2px;
    padding: 1px 4px 3px 4px;
    cursor: pointer;
    font-size: 14px;
    color: hsl(0, 0%, 96%);
    border-radius: 2px;
}
.grammalecte_actions .button:hover {
    background-color: hsl(0, 0%, 40%);
    color: hsl(0, 0%, 100%);
}

.grammalecte_actions .green {
    background-color: hsl(120, 30%, 50%);
    color: hsl(0, 0%, 96%);
}
.grammalecte_actions .green:hover {
    background-color: hsl(120, 50%, 40%);
    color: hsl(0, 0%, 100%);
}
.grammalecte_actions .red {
    background-color: hsl(0, 30%, 50%);
    color: hsl(0, 0%, 96%);
}
.grammalecte_actions .red:hover {
    background-color: hsl(0, 50%, 40%);
    color: hsl(0, 0%, 100%);
}
.grammalecte_actions .orange {
    background-color: hsl(30, 50%, 50%);
    color: hsl(30, 0%, 96%);
}
.grammalecte_actions .orange:hover {
    background-color: hsl(30, 70%, 40%);
    color: hsl(30, 0%, 100%);
}
.grammalecte_actions .bold {
    font-weight: bold;
}



/* 
    TOOLTIP
*/
#grammalecte_tooltip_arrow {
    position: absolute;
    display: none;
}

#grammalecte_tooltip {
    position: absolute;
    display: none;
    width: 300px;
    border-radius: 5px;
    box-shadow: 0 0 6px hsla(0, 0%, 0%, 0.3);
    font-family: Tahoma, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif;
    font-size: 12px;
    line-height: 18px;
    cursor: default;
    text-decoration: none;


    border: 3px solid hsl(210, 50%, 30%);
    color: hsla(210, 10%, 20%, 1);
    z-index: 1000;
}




#grammalecte_tooltip_message_block {

    padding: 5px 10px 10px 10px;
    background-color: hsl(210, 50%, 30%);
    color: hsl(210, 50%, 96%);
}
#grammalecte_tooltip_rule_id {
    display: none;
    margin-bottom: 5px;
    border: 1px solid hsl(210, 50%, 60%);
    background-color: hsl(210, 50%, 40%);
    padding: 2px 5px;
    border-radius: 2px;
    color: hsla(210, 0%, 96%, 1);
    font-size: 11px;
    font-style: normal;
    text-align: center;
}





#grammalecte_tooltip_message {





    font-size: 15px;
    margin-bottom: 5px;
}
a#grammalecte_tooltip_ignore {
    padding: 0 2px;
    background-color: hsla(30, 30%, 40%, 1);
    color: hsla(30, 0%, 96%, 1);
    border-radius: 2px;
    cursor: pointer;
    text-decoration: none;
}
a#grammalecte_tooltip_ignore:hover {
    background-color: hsla(30, 30%, 50%, 1);
    color: hsla(0, 0%, 100%, 1);
    text-shadow: 0 0 3px hsl(30, 30%, 60%);
}
a#grammalecte_tooltip_url {
    padding: 0 2px;
    background-color: hsla(210, 50%, 50%, 1);
    color: hsla(210, 0%, 96%, 1);
    border-radius: 2px;
    cursor: pointer;
    text-decoration: none;
}
a#grammalecte_tooltip_url:hover {
    background-color: hsla(210, 50%, 60%, 1);
    color: hsla(0, 0%, 100%, 1);
    text-shadow: 0 0 3px hsl(210, 30%, 60%);
}
#grammalecte_tooltip_sugg_title {
    padding: 0 10px;
    background-color: hsl(210, 10%, 90%);
    color: hsl(210, 50%, 30%);
    font-size: 10px;
    font-weight: bold;
}







#grammalecte_tooltip_sugg_block {
    padding: 10px;
    background-color: hsl(210, 10%, 96%);
    border-radius: 0 0 2px 2px;
    line-height: 20px;
}






#grammalecte_tooltip_sugg_block a.sugg {
    padding: 1px 6px;
    background-color: hsla(180, 60%, 40%, 1);
    color: hsla(180, 0%, 96%, 1);
    border-radius: 2px;
    cursor: pointer;
    text-decoration: none;
}
#grammalecte_tooltip_sugg_block a.sugg:hover {
    background-color: hsla(180, 70%, 45%, 1);
    color: hsla(0, 0%, 100%, 1);
}













/*
    Action buttons
*/

.grammalecte_paragraph_actions {
    margin: 0 0 5px 10px;
}

.grammalecte_paragraph_actions .button {
    background-color: hsl(0, 0%, 50%);
    text-align: center;
    float: right;
    margin-left: 2px;
    padding: 1px 4px 3px 4px;
    /*width: 18px;
    height: 18px;*/
    cursor: pointer;
    font-size: 14px;
    color: hsl(0, 0%, 96%);
    border-radius: 2px;
}
.grammalecte_paragraph_actions .button:hover {
    background-color: hsl(0, 0%, 40%);
    color: hsl(0, 0%, 100%);
}

.grammalecte_paragraph_actions .green {
    background-color: hsl(120, 30%, 50%);
    color: hsl(0, 0%, 96%);
}
.grammalecte_paragraph_actions .green:hover {
    background-color: hsl(120, 50%, 40%);
    color: hsl(0, 0%, 100%);
}
.grammalecte_paragraph_actions .red {
    background-color: hsl(0, 30%, 50%);
    color: hsl(0, 0%, 96%);
}
.grammalecte_paragraph_actions .red:hover {
    background-color: hsl(0, 50%, 40%);
    color: hsl(0, 0%, 100%);
}
.grammalecte_paragraph_actions .orange {
    background-color: hsl(30, 50%, 50%);
    color: hsl(30, 0%, 96%);
}
.grammalecte_paragraph_actions .orange:hover {
    background-color: hsl(30, 70%, 40%);
    color: hsl(30, 0%, 100%);
}
.grammalecte_paragraph_actions .bold {
    font-weight: bold;
}


/*
    ERRORS
*/

.grammalecte_paragraph .error {
    /* default color */
    background-color: hsl(240, 10%, 50%);
    color: hsl(240, 0%, 96%);
}
.grammalecte_paragraph .error:hover {
    background-color: hsl(240, 10%, 40%);
    color: hsl(240, 0%, 100%);
}

/* elems */
.grammalecte_paragraph .WORD {
    background-color: hsl(0, 50%, 50%);
    color: hsl(0, 0%, 96%);
    /*text-decoration: underline wavy hsl(0, 50%, 50%);*/
}
.grammalecte_paragraph .WORD:hover {
    background-color: hsl(0, 60%, 40%);
    color: hsl(0, 0%, 100%);
}

/* elems */
.grammalecte_paragraph .typo, 
.grammalecte_paragraph .esp, 
.grammalecte_paragraph .nbsp, 
.grammalecte_paragraph .eif, 
.grammalecte_paragraph .maj, 
.grammalecte_paragraph .virg, 
.grammalecte_paragraph .tu, 
.grammalecte_paragraph .num, 
.grammalecte_paragraph .unit, 
.grammalecte_paragraph .nf, 
.grammalecte_paragraph .liga, 
.grammalecte_paragraph .mapos, 
.grammalecte_paragraph .chim {
    background-color: hsl(30, 70%, 50%);
    color: hsl(30, 10%, 96%);
    /*text-decoration: underline wavy hsl(30, 70%, 50%);*/
}

.grammalecte_paragraph .typo:hover, 
.grammalecte_paragraph .esp:hover, 
.grammalecte_paragraph .nbsp:hover, 
.grammalecte_paragraph .eif:hover, 
.grammalecte_paragraph .maj:hover, 
.grammalecte_paragraph .virg:hover, 
.grammalecte_paragraph .tu:hover, 
.grammalecte_paragraph .num:hover, 
.grammalecte_paragraph .unit:hover, 
.grammalecte_paragraph .nf:hover, 
.grammalecte_paragraph .liga:hover, 
.grammalecte_paragraph .mapos:hover, 
.grammalecte_paragraph .chim:hover {
    background-color: hsl(30, 80%, 45%);
    color: hsl(30, 10%, 96%);
}

/* elems */
.grammalecte_paragraph .apos {
    background-color: hsl(40, 90%, 50%);
    color: hsl(40, 10%, 96%);
    /*text-decoration: underline wavy hsl(40, 70%, 45%);*/
}
.grammalecte_paragraph .apos:hover {
    background-color: hsl(40, 100%, 45%);
    color: hsl(40, 10%, 96%);
}

/* elems */
.grammalecte_paragraph .gn,
.grammalecte_paragraph .sgpl {
    background-color: hsl(210, 50%, 50%);
    color: hsl(210, 10%, 96%);
    /*text-decoration: underline wavy hsl(210, 50%, 50%);*/
}
.grammalecte_paragraph .gn:hover,
.grammalecte_paragraph .sgpl:hover {
    background-color: hsl(210, 60%, 40%);
    color: hsl(210, 10%, 96%);
}

/* elems */
.grammalecte_paragraph .conj, 
.grammalecte_paragraph .infi, 
.grammalecte_paragraph .imp, 
.grammalecte_paragraph .inte, 
.grammalecte_paragraph .ppas, 
.grammalecte_paragraph .vmode  {
    background-color: hsl(300, 30%, 40%);
    color: hsl(300, 10%, 96%);
    /*text-decoration: underline wavy hsl(300, 40%, 40%);*/
}

.grammalecte_paragraph .conj:hover, 
.grammalecte_paragraph .infi:hover, 
.grammalecte_paragraph .imp:hover, 
.grammalecte_paragraph .inte:hover, 
.grammalecte_paragraph .ppas:hover, 
.grammalecte_paragraph .vmode:hover {
    background-color: hsl(300, 40%, 30%);
    color: hsl(300, 10%, 96%);
}

/* elems */
.grammalecte_paragraph .conf, 
.grammalecte_paragraph .ocr {
    background-color: hsl(270, 40%, 30%);
    color: hsl(270, 10%, 96%);
    /*text-decoration: underline wavy hsl(270, 40%, 30%);*/
}

.grammalecte_paragraph .conf:hover, 
.grammalecte_paragraph .ocr:hover {
    background-color: hsl(270, 50%, 20%);
    color: hsl(270, 10%, 96%);
}

/* elems */
.grammalecte_paragraph .bs, 
.grammalecte_paragraph .pleo, 
.grammalecte_paragraph .neg, 
.grammalecte_paragraph .redon1, 
.grammalecte_paragraph .redon2, 
.grammalecte_paragraph .mc, 
.grammalecte_paragraph .date, 
.grammalecte_paragraph .notype {
    background-color: hsl(180, 50%, 40%);
    color: hsl(180, 10%, 96%);
    /*text-decoration: underline wavy hsl(180, 50%, 40%);*/
}

.grammalecte_paragraph .bs:hover, 
.grammalecte_paragraph .pleo:hover, 
.grammalecte_paragraph .neg:hover, 
.grammalecte_paragraph .redon1:hover, 
.grammalecte_paragraph .redon2:hover, 
.grammalecte_paragraph .mc:hover, 
.grammalecte_paragraph .date:hover, 
.grammalecte_paragraph .notype:hover {
    background-color: hsl(180, 60%, 30%);
    color: hsl(180, 10%, 96%);
}

Modified gc_lang/fr/webext/content_scripts/gc_content.js from [a808a028fc] to [09f007d27d].

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

"use strict";

































const oGCPanelContent = {


    _xContentNode: createNode("div", {id: "grammalecte_gc_panel_content"}),



    aIgnoredErrors: new Map(),

    getNode: function () {







        return this._xContentNode;
    },

    clear: function () {
        while (this._xContentNode.firstChild) {
            this._xContentNode.removeChild(this._xContentNode.firstChild);
        }

    },

    addParagraphResult: function (oResult) {
        try {
            if (oResult) {
                let xNodeDiv = createNode("div", {className: "grammalecte_paragraph_block"});
                // actions
                let xActionsBar = createNode("div", {className: "grammalecte_paragraph_actions"});
                let xCloseButton = createNode("div", {id: "end" + oResult.sParaNum, className: "grammalecte_paragraph_close_button", textContent: "×"});
                let xAnalyseButton = createNode("div", {id: "check" + oResult.sParaNum, className: "grammalecte_paragraph_analyse_button", textContent: "Réanalyser"});
                xActionsBar.appendChild(xAnalyseButton);
                xActionsBar.appendChild(xCloseButton);
                // paragraph
                let xParagraph = createNode("p", {id: "paragr"+oResult.sParaNum, lang: "fr", spellcheck: "false", contenteditable: "true"});
                xParagraph.className = (oResult.aGrammErr.length || oResult.aSpellErr.length) ? "grammalecte_paragraph softred" : "grammalecte_paragraph";
                this._tagParagraph(xParagraph, oResult.sParagraph, oResult.sParaNum, oResult.aGrammErr, oResult.aSpellErr);
                // creation
                xNodeDiv.appendChild(xActionsBar);
                xNodeDiv.appendChild(xParagraph);
                this._xContentNode.appendChild(xNodeDiv);
            }
        }
        catch (e) {
            showError(e);
        }
    },





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


>
|
>
>

|

|
>
>
>
>
>
>
>
|



|
|

>







|
|
|









|







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

"use strict";

function onGrammalecteGCPanelClick (xEvent) {
    try {
        let xElem = xEvent.target;
        if (xElem.id) {
            if (xElem.id.startsWith("sugg")) {
                oGCPanelContent.applySuggestion(xElem.id);
            } else if (xElem.id.endsWith("_ignore")) {
                oGCPanelContent.ignoreError(xElem.id);
            } else if (xElem.id.startsWith("check")) {
                //oGCPanelContent.sendBackAndCheck(xElem.id);
            } else if (xElem.id.startsWith("end")) {
                //document.getElementById(xElem.id).parentNode.parentNode.style.display = "none";
            } else if (xElem.tagName === "U" && xElem.id.startsWith("err")
                       && xElem.className !== "corrected" && xElem.className !== "ignored") {
                oGrammalecteTooltip.show(xElem.id);
            } else if (xElem.id === "gc_url") {
                oGCPanelContent.openURL(xElem.getAttribute("href"));
            } else {
                oGrammalecteTooltip.hide();
            }
        } else if (xElem.tagName === "A") {
            oGCPanelContent.openURL(xElem.getAttribute("href"));
        } else {
            oGrammalecteTooltip.hide();
        }
    }
    catch (e) {
        showError(e);
    }
}


const oGCPanelContent = {

    bInitDone: false,

    xContentNode: null,
    xParagraphList: null,

    aIgnoredErrors: new Set(),

    init: function () {
        this.xContentNode = createNode("div", {id: "grammalecte_gc_panel_content"});
        this.xParagraphList = createNode("div", {id: "grammalecte_paragraph_list"});
        this.xContentNode.appendChild(this.xParagraphList);
        this.xContentNode.addEventListener("click", onGrammalecteGCPanelClick, false);
        oGrammalecteTooltip.init();
        this.xContentNode.appendChild(oGrammalecteTooltip.xTooltip);
        this.bInitDone = true;
        return this.xContentNode;
    },

    clear: function () {
        while (this.xParagraphList.firstChild) {
            this.xParagraphList.removeChild(this.xParagraphList.firstChild);
        }
        this.aIgnoredErrors.clear();
    },

    addParagraphResult: function (oResult) {
        try {
            if (oResult) {
                let xNodeDiv = createNode("div", {className: "grammalecte_paragraph_block"});
                // actions
                let xActionsBar = createNode("div", {className: "grammalecte_actions"});
                let xCloseButton = createNode("div", {id: "end" + oResult.sParaNum, className: "button red blod", textContent: "×"});
                let xAnalyseButton = createNode("div", {id: "check" + oResult.sParaNum, className: "button green", textContent: "Réanalyser"});
                xActionsBar.appendChild(xAnalyseButton);
                xActionsBar.appendChild(xCloseButton);
                // paragraph
                let xParagraph = createNode("p", {id: "paragr"+oResult.sParaNum, lang: "fr", spellcheck: "false", contenteditable: "true"});
                xParagraph.className = (oResult.aGrammErr.length || oResult.aSpellErr.length) ? "grammalecte_paragraph softred" : "grammalecte_paragraph";
                this._tagParagraph(xParagraph, oResult.sParagraph, oResult.sParaNum, oResult.aGrammErr, oResult.aSpellErr);
                // creation
                xNodeDiv.appendChild(xActionsBar);
                xNodeDiv.appendChild(xParagraph);
                this.xParagraphList.appendChild(xNodeDiv);
            }
        }
        catch (e) {
            showError(e);
        }
    },

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
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
        return xNodeErr;
    },

    applySuggestion: function (sSuggId) { // sugg
        try {
            let sErrorId = document.getElementById(sSuggId).dataset.error_id;
            let sIdParagr = sErrorId.slice(0, sErrorId.indexOf("_"));
            startWaitIcon("paragr"+sIdParagr);
            let xNodeErr = document.getElementById("err" + sErrorId);
            xNodeErr.textContent = document.getElementById(sSuggId).textContent;
            xNodeErr.className = "corrected";
            xNodeErr.removeAttribute("style");
            self.port.emit("correction", sIdParagr, getPurgedTextOfParagraph("paragr"+sIdParagr));
            this.hideAllTooltips();
            stopWaitIcon("paragr"+sIdParagr);
        }
        catch (e) {
            showError(e);
        }
    },

    ignoreError: function (sIgnoreButtonId) {  // ignore
        try {
            //console.log("ignore button: " + sIgnoreButtonId + " // error id: " + document.getElementById(sIgnoreButtonId).dataset.error_id);
            let xNodeErr = document.getElementById("err"+document.getElementById(sIgnoreButtonId).dataset.error_id);
            this.aIgnoredErrors.add(xNodeErr.dataset.ignored_key);
            xNodeErr.className = "ignored";
            xNodeErr.removeAttribute("style");
            this.hideAllTooltips();
        }
        catch (e) {
            showError(e);
        }
    },

    showTooltip: function (sNodeErrorId) {  // err










        try {
















            this.hideAllTooltips();










            let xNodeErr = document.getElementById(sNodeErrorId);



            let sTooltipId = (xNodeErr.dataset.error_type === "grammar") ? "gc_tooltip" : "sc_tooltip";
            let xNodeTooltip = document.getElementById(sTooltipId);



























            let xNodeTooltipArrow = document.getElementById(sTooltipId+"_arrow"); 
            let nLimit = nPanelWidth - 330; // paragraph width - tooltip width
            xNodeTooltipArrow.style.top = (xNodeErr.offsetTop + 16) + "px"
            xNodeTooltipArrow.style.left = (xNodeErr.offsetLeft + Math.floor((xNodeErr.offsetWidth / 2))-4) + "px" // 4 is half the width of the arrow.
            xNodeTooltip.style.top = (xNodeErr.offsetTop + 20) + "px";
            xNodeTooltip.style.left = (xNodeErr.offsetLeft > nLimit) ? nLimit + "px" : xNodeErr.offsetLeft + "px";
            if (xNodeErr.dataset.error_type === "grammar") {
                // grammar error
                if (xNodeErr.dataset.gc_message.includes(" ##")) {
                    let n = xNodeErr.dataset.gc_message.indexOf(" ##");
                    document.getElementById("gc_message").textContent = xNodeErr.dataset.gc_message.slice(0, n);
                    document.getElementById("gc_rule_id").textContent = "Règle : " + xNodeErr.dataset.gc_message.slice(n+2);
                    document.getElementById("gc_rule_id").style.display = "block";
                } else {
                    document.getElementById("gc_message").textContent = xNodeErr.dataset.gc_message;

                }
                if (xNodeErr.dataset.gc_url != "") {
                    document.getElementById("gc_url").style.display = "inline";
                    document.getElementById("gc_url").setAttribute("href", xNodeErr.dataset.gc_url);
                } else {
                    document.getElementById("gc_url").style.display = "none";
                }
                document.getElementById("gc_ignore").dataset.error_id = xNodeErr.dataset.error_id;
                let iSugg = 0;
                let xGCSugg = document.getElementById("gc_sugg_block");
                xGCSugg.textContent = "";
                if (xNodeErr.dataset.suggestions.length > 0) {
                    for (let sSugg of xNodeErr.dataset.suggestions.split("|")) {
                        xGCSugg.appendChild(this._createSuggestion(xNodeErr.dataset.error_id, iSugg, sSugg));
                        xGCSugg.appendChild(document.createTextNode(" "));
                        iSugg += 1;
                    }
                } else {
                    xGCSugg.textContent = "Aucune.";
                }
            }
            xNodeTooltipArrow.style.display = "block";
            xNodeTooltip.style.display = "block";
            if (xNodeErr.dataset.error_type === "spelling") {
                // spelling mistake

                document.getElementById("sc_ignore").dataset.error_id = xNodeErr.dataset.error_id;



                //console.log("getSuggFor: " + xNodeErr.textContent.trim() + " // error_id: " + xNodeErr.dataset.error_id);
                self.port.emit("getSuggestionsForTo", xNodeErr.textContent.trim(), xNodeErr.dataset.error_id);

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










    _createSuggestion: function (sErrId, iSugg, sSugg) {
        let xNodeSugg = document.createElement("a");
        xNodeSugg.id = "sugg" + sErrId + "-" + iSugg.toString();
        xNodeSugg.className = "sugg";
        xNodeSugg.dataset.error_id = sErrId;
        xNodeSugg.textContent = sSugg;
        return xNodeSugg;
    },

    setSpellSuggestionsFor: function (sWord, sSuggestions, sErrId) {
        // spell checking suggestions
        try {
            // console.log("setSuggestionsFor: " + sWord + " > " + sSuggestions + " // " + sErrId);
            let xSuggBlock = document.getElementById("sc_sugg_block");
            xSuggBlock.textContent = "";
            if (sSuggestions === "") {
                xSuggBlock.appendChild(document.createTextNode("Aucune."));
            } else if (sSuggestions.startsWith("#")) {
                xSuggBlock.appendChild(document.createTextNode(sSuggestions));
            } else {
                let lSugg = sSuggestions.split("|");
                let iSugg = 0;
                for (let sSugg of lSugg) {
                    xSuggBlock.appendChild(this._createSuggestion(sErrId, iSugg, sSugg));
                    xSuggBlock.appendChild(document.createTextNode(" "));
                    iSugg += 1;
                }
            }
        }
        catch (e) {
            showError(e);
        }
    },

    hideAllTooltips: function () {
        document.getElementById("gc_tooltip").style.display = "none";
        document.getElementById("gc_rule_id").style.display = "none";
        document.getElementById("sc_tooltip").style.display = "none";
        document.getElementById("gc_tooltip_arrow").style.display = "none";
        document.getElementById("sc_tooltip_arrow").style.display = "none";
    },

    addSummary: function () {
        // todo
    },

    addMessage: function (sMessage) {
        let xNode = createNode("div", {className: "grammalecte_gc_panel_message", textContent: sMessage});
        this._xContentNode.appendChild(xNode);
    }
}

    

    

    





function sendBackAndCheck (sCheckButtonId) {  // check
    startWaitIcon();
    let sIdParagr = sCheckButtonId.slice(5);
    self.port.emit("modifyAndCheck", sIdParagr, getPurgedTextOfParagraph("paragr"+sIdParagr));
    stopWaitIcon();
}





function getPurgedTextOfParagraph (sNodeParagrId) {
    let sText = document.getElementById(sNodeParagrId).textContent;
    sText = sText.replace(/&nbsp;/g, " ").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
    return sText;
}

function copyToClipboard () {
    startWaitIcon();
    try {
        let xClipboardButton = document.getElementById("clipboard_msg");
        xClipboardButton.textContent = "copie en cours…";
        let sText = "";
        for (let xNode of document.getElementById("errorlist").getElementsByClassName("paragraph")) {
            sText += xNode.textContent + "\n";
        }
        self.port.emit('copyToClipboard', sText);
        xClipboardButton.textContent = "-> presse-papiers";
        window.setTimeout(function() { xClipboardButton.textContent = "∑"; } , 3000);
    }
    catch (e) {
        console.log(e.lineNumber + ": " +e.message);
    }
    stopWaitIcon();
}

function startWaitIcon (sIdParagr=null) {
    if (sIdParagr) {
        document.getElementById(sIdParagr).disabled = true;
        document.getElementById(sIdParagr).style.opacity = .3;
    }
    document.getElementById("waiticon").hidden = false;
}

function stopWaitIcon (sIdParagr=null) {
    if (sIdParagr) {
        document.getElementById(sIdParagr).disabled = false;
        document.getElementById(sIdParagr).style.opacity = 1;
    }
    document.getElementById("waiticon").hidden = true;
}







<




|
|
<













|






|
>
>
>
>
>
>
>
>
>
>

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




|
|
|

|
>


|
|

|

|

|











|
|


>
|
>
>
>

|
>






>
>
>
>
>
>
>
>
>














|


















<
|
<
<
<
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
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
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359

360







361







































































        return xNodeErr;
    },

    applySuggestion: function (sSuggId) { // sugg
        try {
            let sErrorId = document.getElementById(sSuggId).dataset.error_id;
            let sIdParagr = sErrorId.slice(0, sErrorId.indexOf("_"));

            let xNodeErr = document.getElementById("err" + sErrorId);
            xNodeErr.textContent = document.getElementById(sSuggId).textContent;
            xNodeErr.className = "corrected";
            xNodeErr.removeAttribute("style");
            //self.port.emit("correction", sIdParagr, getPurgedTextOfParagraph("paragr"+sIdParagr));
            oGrammalecteTooltip.hide();

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

    ignoreError: function (sIgnoreButtonId) {  // ignore
        try {
            //console.log("ignore button: " + sIgnoreButtonId + " // error id: " + document.getElementById(sIgnoreButtonId).dataset.error_id);
            let xNodeErr = document.getElementById("err"+document.getElementById(sIgnoreButtonId).dataset.error_id);
            this.aIgnoredErrors.add(xNodeErr.dataset.ignored_key);
            xNodeErr.className = "ignored";
            xNodeErr.removeAttribute("style");
            oGrammalecteTooltip.hide();
        }
        catch (e) {
            showError(e);
        }
    },

    addSummary: function () {
        // todo
    },

    addMessage: function (sMessage) {
        let xNode = createNode("div", {className: "grammalecte_gc_panel_message", textContent: sMessage});
        this.xParagraphList.appendChild(xNode);
    },

    copyToClipboard: function () {
        startWaitIcon();
        try {
            let xClipboardButton = document.getElementById("clipboard_msg");
            xClipboardButton.textContent = "copie en cours…";
            let sText = "";
            for (let xNode of document.getElementById("errorlist").getElementsByClassName("paragraph")) {
                sText += xNode.textContent + "\n";
            }
            self.port.emit('copyToClipboard', sText);
            xClipboardButton.textContent = "-> presse-papiers";
            window.setTimeout(function() { xClipboardButton.textContent = "∑"; } , 3000);
        }
        catch (e) {
            console.log(e.lineNumber + ": " +e.message);
        }
        stopWaitIcon();
    }
}



function sendBackAndCheck (sCheckButtonId) {  // check
    startWaitIcon();
    let sIdParagr = sCheckButtonId.slice(5);
    self.port.emit("modifyAndCheck", sIdParagr, getPurgedTextOfParagraph("paragr"+sIdParagr));
    stopWaitIcon();
}

function getPurgedTextOfParagraph (sNodeParagrId) {
    let sText = document.getElementById(sNodeParagrId).textContent;
    sText = sText.replace(/&nbsp;/g, " ").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
    return sText;
}


const oGrammalecteTooltip = {

    xTooltip: null,

    xTooltipArrow: createNode("img", {
        id: "grammalecte_tooltip_arrow",
        src: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAECAYAAACzzX7wAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAOwQAADsEBuJFr7QAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xNkRpr/UAAAAlSURBVBhXY/j//z8cq/kW/wdhZDEMSXRFWCVhGKwAmwQCF/8HAGUkScGH4cM8AAAAAElFTkSuQmCC",
        alt: "^"
    }),

    xTooltipSuggBlock: null,

    init: function () {
        this.xTooltip = createNode("div", {id: "grammalecte_tooltip"});
        let xMessageBlock = createNode("div", {id: "grammalecte_tooltip_message_block"});
        xMessageBlock.appendChild(createNode("p", {id: "grammalecte_tooltip_rule_id"}));
        xMessageBlock.appendChild(createNode("p", {id: "grammalecte_tooltip_message", textContent: "Erreur."}));
        xMessageBlock.appendChild(createNode("a", {id: "grammalecte_tooltip_ignore", href: "#", onclick: "return false;", textContent: "Ignorer"}));
        xMessageBlock.appendChild(createNode("a", {id: "grammalecte_tooltip_url", href: "#", onclick: "return false;", textContent: "Voulez-vous en savoir plus ?…"}));
        this.xTooltip.appendChild(xMessageBlock);
        this.xTooltip.appendChild(createNode("div", {id: "grammalecte_tooltip_sugg_title", textContent: "SUGGESTIONS :"}));
        this.xTooltipSuggBlock = createNode("div", {id: "grammalecte_tooltip_sugg_block"});
        this.xTooltip.appendChild(this.xTooltipSuggBlock);
    },

    show: function (sNodeErrorId) {  // err
        try {
            let xNodeErr = document.getElementById(sNodeErrorId);
            let nLimit = 500 - 330; // paragraph width - tooltip width
            this.xTooltipArrow.style.top = (xNodeErr.offsetTop + 16) + "px"
            this.xTooltipArrow.style.left = (xNodeErr.offsetLeft + Math.floor((xNodeErr.offsetWidth / 2))-4) + "px" // 4 is half the width of the arrow.
            this.xTooltip.style.top = (xNodeErr.offsetTop + 20) + "px";
            this.xTooltip.style.left = (xNodeErr.offsetLeft > nLimit) ? nLimit + "px" : xNodeErr.offsetLeft + "px";
            if (xNodeErr.dataset.error_type === "grammar") {
                // grammar error
                if (xNodeErr.dataset.gc_message.includes(" ##")) {
                    let n = xNodeErr.dataset.gc_message.indexOf(" ##");
                    document.getElementById("grammalecte_tooltip_message").textContent = xNodeErr.dataset.gc_message.slice(0, n);
                    document.getElementById("grammalecte_tooltip_rule_id").textContent = "Règle : " + xNodeErr.dataset.gc_message.slice(n+2);
                    document.getElementById("grammalecte_tooltip_rule_id").style.display = "block";
                } else {
                    document.getElementById("grammalecte_tooltip_message").textContent = xNodeErr.dataset.gc_message;
                    document.getElementById("grammalecte_tooltip_rule_id").style.display = "none";
                }
                if (xNodeErr.dataset.gc_url != "") {
                    document.getElementById("grammalecte_tooltip_url").style.display = "inline";
                    document.getElementById("grammalecte_tooltip_url").setAttribute("href", xNodeErr.dataset.gc_url);
                } else {
                    document.getElementById("grammalecte_tooltip_url").style.display = "none";
                }
                document.getElementById("grammalecte_tooltip_ignore").dataset.error_id = xNodeErr.dataset.error_id;
                let iSugg = 0;
                let xGCSugg = document.getElementById("grammalecte_tooltip_sugg_block");
                xGCSugg.textContent = "";
                if (xNodeErr.dataset.suggestions.length > 0) {
                    for (let sSugg of xNodeErr.dataset.suggestions.split("|")) {
                        xGCSugg.appendChild(this._createSuggestion(xNodeErr.dataset.error_id, iSugg, sSugg));
                        xGCSugg.appendChild(document.createTextNode(" "));
                        iSugg += 1;
                    }
                } else {
                    xGCSugg.textContent = "Aucune.";
                }
            }
            this.xTooltipArrow.style.display = "block";
            this.xTooltip.style.display = "block";
            if (xNodeErr.dataset.error_type === "spelling") {
                // spelling mistake
                document.getElementById("grammalecte_tooltip_message").textContent = "Mot inconnu du dictionnaire.";
                document.getElementById("grammalecte_tooltip_ignore").dataset.error_id = xNodeErr.dataset.error_id;
                while (this.xTooltipSuggBlock.firstChild) {
                    this.xTooltipSuggBlock.removeChild(this.xTooltipSuggBlock.firstChild);
                }
                //console.log("getSuggFor: " + xNodeErr.textContent.trim() + " // error_id: " + xNodeErr.dataset.error_id);
                //self.port.emit("getSuggestionsForTo", xNodeErr.textContent.trim(), xNodeErr.dataset.error_id);
                this.setSpellSuggestionsFor(xNodeErr.textContent.trim(), "", xNodeErr.dataset.error_id);
            }
        }
        catch (e) {
            showError(e);
        }
    },

    setTooltipColor: function (bBlue) {
        // todo
    },

    hide () {
        this.xTooltipArrow.style.display = "none";
        this.xTooltip.style.display = "none";
    },

    _createSuggestion: function (sErrId, iSugg, sSugg) {
        let xNodeSugg = document.createElement("a");
        xNodeSugg.id = "sugg" + sErrId + "-" + iSugg.toString();
        xNodeSugg.className = "sugg";
        xNodeSugg.dataset.error_id = sErrId;
        xNodeSugg.textContent = sSugg;
        return xNodeSugg;
    },

    setSpellSuggestionsFor: function (sWord, sSuggestions, sErrId) {
        // spell checking suggestions
        try {
            // console.log("setSuggestionsFor: " + sWord + " > " + sSuggestions + " // " + sErrId);
            let xSuggBlock = document.getElementById("grammalecte_tooltip_sugg_block");
            xSuggBlock.textContent = "";
            if (sSuggestions === "") {
                xSuggBlock.appendChild(document.createTextNode("Aucune."));
            } else if (sSuggestions.startsWith("#")) {
                xSuggBlock.appendChild(document.createTextNode(sSuggestions));
            } else {
                let lSugg = sSuggestions.split("|");
                let iSugg = 0;
                for (let sSugg of lSugg) {
                    xSuggBlock.appendChild(this._createSuggestion(sErrId, iSugg, sSugg));
                    xSuggBlock.appendChild(document.createTextNode(" "));
                    iSugg += 1;
                }
            }
        }
        catch (e) {
            showError(e);
        }

    }







}







































































Modified gc_lang/fr/webext/content_scripts/lxg_content.js from [7b2e0430b4] to [f476134195].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// JavaScript

"use strict";

const oLxgPanelContent = {

    _xContentNode: createNode("div", {id: "grammalecte_lxg_panel_content"}),

    _nCount: 0,

    getNode: function () {
        return this._xContentNode;
    },

    clear: function () {
        this._nCount = 0;
        while (this._xContentNode.firstChild) {
            this._xContentNode.removeChild(this._xContentNode.firstChild);










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// JavaScript

"use strict";

const oLxgPanelContent = {

    _xContentNode: createNode("div", {id: "grammalecte_lxg_panel_content"}),

    _nCount: 0,

    init: function () {
        return this._xContentNode;
    },

    clear: function () {
        this._nCount = 0;
        while (this._xContentNode.firstChild) {
            this._xContentNode.removeChild(this._xContentNode.firstChild);

Modified gc_lang/fr/webext/content_scripts/panel_creator.js from [82647550b0] to [9dd9e3dd31].

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
        this.center();
    }

    _createPanel (sTitle) {
        try {
            let xPanel = createNode("div", {id: this.sId, className: "grammalecte_panel"});
            let xBar = createNode("div", {className: "grammalecte_panel_bar"});

            xBar.appendChild(this._createButtons());
            let xTitle = createNode("div", {className: "grammalecte_panel_title"});
            xTitle.appendChild(createLogo());
            xTitle.appendChild(createNode("div", {className: "grammalecte_panel_label", textContent: "Grammalecte · " + sTitle}));
            xBar.appendChild(xTitle);
            xPanel.appendChild(xBar);
            //xPanel.appendChild(createNode("div", {className: "grammalecte_empty_space_under_title_bar"}));
            xPanel.appendChild(this.xContentNode);
            return xPanel;
        }
        catch (e) {
            showError(e);
        }
    }








    _createButtons () {
        let xButtonLine = createNode("div", {className: "grammalecte_panel_commands"});


        if (this.bMovable) {
            xButtonLine.appendChild(this._createMoveButton("stickToTop", "¯", "Coller en haut"));
            xButtonLine.appendChild(this._createMoveButton("stickToLeft", "«", "Coller à gauche"));
            xButtonLine.appendChild(this._createMoveButton("center", "•", "Centrer"));
            xButtonLine.appendChild(this._createMoveButton("stickToRight", "»", "Coller à droite"));
            xButtonLine.appendChild(this._createMoveButton("stickToBottom", "_", "Coller en bas"));
        }







>



|










>
>
>
>
>
>
>



>
>







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
        this.center();
    }

    _createPanel (sTitle) {
        try {
            let xPanel = createNode("div", {id: this.sId, className: "grammalecte_panel"});
            let xBar = createNode("div", {className: "grammalecte_panel_bar"});
            xBar.appendChild(this._createWaitIcon());
            xBar.appendChild(this._createButtons());
            let xTitle = createNode("div", {className: "grammalecte_panel_title"});
            xTitle.appendChild(createLogo());
            xTitle.appendChild(createNode("div", {className: "grammalecte_panel_label", textContent: sTitle}));
            xBar.appendChild(xTitle);
            xPanel.appendChild(xBar);
            //xPanel.appendChild(createNode("div", {className: "grammalecte_empty_space_under_title_bar"}));
            xPanel.appendChild(this.xContentNode);
            return xPanel;
        }
        catch (e) {
            showError(e);
        }
    }

    _createWaitIcon () {
        let xWaitIcon = createNode("div", {id: "grammalecte_wait_icon", className: "grammalecte_spinner"});
        xWaitIcon.appendChild(createNode("div", {id: "bounce1"}));
        xWaitIcon.appendChild(createNode("div", {id: "bounce2"}));
        return xWaitIcon;
    }

    _createButtons () {
        let xButtonLine = createNode("div", {className: "grammalecte_panel_commands"});
        

        if (this.bMovable) {
            xButtonLine.appendChild(this._createMoveButton("stickToTop", "¯", "Coller en haut"));
            xButtonLine.appendChild(this._createMoveButton("stickToLeft", "«", "Coller à gauche"));
            xButtonLine.appendChild(this._createMoveButton("center", "•", "Centrer"));
            xButtonLine.appendChild(this._createMoveButton("stickToRight", "»", "Coller à droite"));
            xButtonLine.appendChild(this._createMoveButton("stickToBottom", "_", "Coller en bas"));
        }
108
109
110
111
112
113
114








115
116
117
118
119
120
121
        // todo
    }

    logInnerHTML () {
        // for debugging
        console.log(this.xPanelNode.innerHTML);
    }








}


/*
    Common functions
*/
function createNode (sType, oAttr, oDataset=null) {







>
>
>
>
>
>
>
>







118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
        // todo
    }

    logInnerHTML () {
        // for debugging
        console.log(this.xPanelNode.innerHTML);
    }
    
    startWaitIcon () {
        document.getElementById("grammalecte_waiticon").hidden = false;
    }

    stopWaitIcon () {
        document.getElementById("grammalecte_waiticon").hidden = true;
    }
}


/*
    Common functions
*/
function createNode (sType, oAttr, oDataset=null) {

Modified gc_lang/fr/xpi/data/gc_panel.js from [2be91c50eb] to [0cc46307c4].

197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
    }
}

function _tagParagraph (sParagraph, xParagraph, iParagraph, aSpellErr, aGrammErr) {
    try {
        if (aGrammErr.length === 0  &&  aSpellErr.length === 0) {
            xParagraph.textContent = sParagraph;
            return
        }
        aGrammErr.push(...aSpellErr);
        aGrammErr.sort(function (a, b) {
            if (a["nStart"] < b["nStart"])
                return -1;
            if (a["nStart"] > b["nStart"])
                return 1;







|







197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
    }
}

function _tagParagraph (sParagraph, xParagraph, iParagraph, aSpellErr, aGrammErr) {
    try {
        if (aGrammErr.length === 0  &&  aSpellErr.length === 0) {
            xParagraph.textContent = sParagraph;
            return;
        }
        aGrammErr.push(...aSpellErr);
        aGrammErr.sort(function (a, b) {
            if (a["nStart"] < b["nStart"])
                return -1;
            if (a["nStart"] > b["nStart"])
                return 1;