-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_dyslexie_v4.html
More file actions
2158 lines (2018 loc) · 109 KB
/
test_dyslexie_v4.html
File metadata and controls
2158 lines (2018 loc) · 109 KB
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
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
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test Lecture & Orthographe — CM1/CM2</title>
<style>
:root {
--bg: #f0f0ec;
--card: #ffffff;
--accent: #2563eb;
--accent2: #0f4c81;
--warm: #d97706;
--green: #16a34a;
--red: #dc2626;
--orange: #ea580c;
--text: #1e293b;
--text2: #475569;
--border: #cbd5e1;
--soft: #f1f5f9;
--radius: 8px;
}
* { margin:0; padding:0; box-sizing:border-box; }
body {
font-family: 'Segoe UI', 'Helvetica Neue', system-ui, sans-serif;
background: var(--bg);
color: var(--text);
line-height: 1.6;
}
.app {
max-width: 960px;
margin: 0 auto;
padding: 20px;
}
/* Header */
.app-header {
background: linear-gradient(135deg, var(--accent2) 0%, var(--accent) 100%);
color: white;
padding: 28px 32px;
border-radius: 12px;
margin-bottom: 20px;
position: relative;
overflow: hidden;
}
.app-header::after {
content: '';
position: absolute;
top: -50%; right: -20%;
width: 300px; height: 300px;
background: rgba(255,255,255,0.05);
border-radius: 50%;
}
.app-header h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.app-header p { opacity: 0.85; font-size: 14px; }
/* Progress */
.progress-track {
background: var(--border);
height: 6px;
border-radius: 3px;
margin-bottom: 16px;
overflow: hidden;
}
.progress-fill {
background: linear-gradient(90deg, var(--accent), var(--green));
height: 100%;
transition: width 0.4s ease;
border-radius: 3px;
}
/* Nav */
.nav {
display: flex;
gap: 6px;
flex-wrap: wrap;
margin-bottom: 20px;
}
.nav button {
padding: 7px 14px;
border: 1.5px solid var(--border);
background: var(--card);
color: var(--text2);
border-radius: 20px;
cursor: pointer;
font-size: 12px;
font-weight: 500;
transition: all 0.2s;
white-space: nowrap;
}
.nav button:hover { border-color: var(--accent); color: var(--accent); }
.nav button.active {
background: var(--accent);
color: white;
border-color: var(--accent);
}
.nav button.done {
background: #dcfce7;
border-color: var(--green);
color: var(--green);
}
/* Sections */
.section { display: none; }
.section.active { display: block; }
.card {
background: var(--card);
border-radius: var(--radius);
padding: 24px;
margin-bottom: 16px;
box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.card-header {
background: linear-gradient(135deg, var(--accent2), var(--accent));
color: white;
padding: 16px 20px;
border-radius: var(--radius);
margin-bottom: 16px;
}
.card-header h2 { font-size: 18px; margin-bottom: 2px; }
.card-header p { font-size: 13px; opacity: 0.85; }
.instruction {
background: #fffbeb;
border-left: 4px solid var(--warm);
padding: 12px 16px;
margin-bottom: 16px;
border-radius: 0 var(--radius) var(--radius) 0;
font-size: 14px;
}
.instruction strong { color: var(--warm); }
.examiner-note {
background: #eff6ff;
border-left: 4px solid var(--accent);
padding: 12px 16px;
margin-bottom: 16px;
border-radius: 0 var(--radius) var(--radius) 0;
font-size: 13px;
color: var(--accent2);
}
/* Timer */
.timer-bar {
display: flex;
align-items: center;
gap: 12px;
background: var(--soft);
padding: 12px 16px;
border-radius: var(--radius);
margin-bottom: 16px;
}
.timer-display {
font-size: 28px;
font-weight: 700;
font-variant-numeric: tabular-nums;
color: var(--accent2);
min-width: 90px;
}
.timer-bar button {
padding: 8px 18px;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
font-weight: 600;
transition: all 0.2s;
}
.btn-start { background: var(--green); color: white; }
.btn-start:hover { background: #15803d; }
.btn-stop { background: var(--red); color: white; }
.btn-stop:hover { background: #b91c1c; }
.btn-reset { background: var(--border); color: var(--text2); }
/* Word grids */
.level-group { margin-bottom: 20px; }
.level-group h4 {
font-size: 13px;
color: var(--text2);
text-transform: uppercase;
letter-spacing: 1px;
margin-bottom: 8px;
padding-bottom: 4px;
border-bottom: 1px solid var(--border);
}
.word-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
gap: 8px;
}
.word-card {
display: flex;
align-items: center;
justify-content: space-between;
background: var(--soft);
padding: 12px 14px;
border-radius: 6px;
border: 2px solid transparent;
transition: all 0.2s;
cursor: pointer;
}
.word-card .word { font-size: 20px; font-weight: 600; }
.word-card.error { border-color: var(--red); background: #fef2f2; }
.word-card .error-type {
font-size: 11px;
background: var(--red);
color: white;
padding: 2px 8px;
border-radius: 10px;
cursor: pointer;
}
.error-type-selector {
display: none;
flex-wrap: wrap;
gap: 4px;
margin-top: 6px;
}
.word-card.error .error-type-selector { display: flex; }
.error-type-selector button {
font-size: 11px;
padding: 3px 8px;
border: 1px solid var(--border);
background: white;
border-radius: 4px;
cursor: pointer;
}
.error-type-selector button.selected {
background: var(--accent);
color: white;
border-color: var(--accent);
}
/* Questions */
.q-block {
background: var(--soft);
padding: 16px;
border-radius: var(--radius);
margin-bottom: 12px;
}
.q-block h4 { font-size: 15px; margin-bottom: 10px; color: var(--text); }
.q-options { display: flex; flex-direction: column; gap: 6px; }
.q-options label {
display: flex;
align-items: center;
gap: 10px;
padding: 10px 14px;
background: white;
border: 2px solid var(--border);
border-radius: 6px;
cursor: pointer;
transition: all 0.15s;
font-size: 14px;
}
.q-options label:hover { border-color: var(--accent); background: #f0f7ff; }
.q-options input[type="radio"] { accent-color: var(--accent); width: 18px; height: 18px; }
.q-options input[type="radio"]:checked + span { font-weight: 600; }
/* Inputs */
input[type="text"], textarea, select {
width: 100%;
padding: 10px 12px;
border: 2px solid var(--border);
border-radius: 6px;
font-size: 15px;
font-family: inherit;
transition: border-color 0.2s;
background: white;
}
input[type="text"]:focus, textarea:focus, select:focus {
outline: none;
border-color: var(--accent);
}
textarea { min-height: 80px; resize: vertical; }
/* Audio button */
.audio-btn {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 10px 20px;
background: var(--accent);
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 15px;
margin-bottom: 10px;
transition: background 0.2s;
}
.audio-btn:hover { background: var(--accent2); }
/* Buttons */
.btn-row { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.btn {
padding: 12px 28px;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 15px;
font-weight: 600;
transition: all 0.2s;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent2); }
.btn-secondary { background: var(--soft); color: var(--text2); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
/* RAN Grid */
.ran-grid {
display: grid;
grid-template-columns: repeat(10, 1fr);
gap: 4px;
margin-bottom: 16px;
}
.ran-cell {
aspect-ratio: 1;
border-radius: 6px;
display: flex;
align-items: center;
justify-content: center;
font-size: 20px;
font-weight: 700;
color: white;
}
/* EVA */
.eva-display {
font-size: 56px;
font-weight: 700;
letter-spacing: 24px;
text-align: center;
padding: 40px;
background: var(--soft);
border-radius: var(--radius);
margin-bottom: 16px;
min-height: 140px;
display: flex;
align-items: center;
justify-content: center;
font-family: 'Courier New', monospace;
}
/* Fluence */
.fluence-text {
font-size: 18px;
line-height: 2.2;
padding: 20px;
background: white;
border: 2px solid var(--border);
border-radius: var(--radius);
margin-bottom: 16px;
}
.fluence-text span {
cursor: pointer;
padding: 2px 1px;
transition: background 0.15s;
}
.fluence-text span:hover { background: #fef3c7; }
.fluence-text span.marked { background: #bbf7d0; border-radius: 3px; }
.fluence-text span.error-word { background: #fecaca; border-radius: 3px; }
/* Anamnese */
.anam-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 12px;
}
.anam-item {
padding: 12px;
background: var(--soft);
border-radius: 6px;
}
.anam-item label {
display: block;
font-size: 13px;
font-weight: 600;
color: var(--text2);
margin-bottom: 6px;
}
@media (max-width: 600px) {
.anam-grid { grid-template-columns: 1fr; }
.ran-grid { grid-template-columns: repeat(5, 1fr); }
}
/* Checkboxes styled */
.check-row {
display: flex; align-items: center; gap: 8px;
padding: 8px 0;
}
.check-row input[type="checkbox"] {
width: 18px; height: 18px;
accent-color: var(--accent);
}
/* Results */
.result-card {
background: var(--card);
border-radius: var(--radius);
padding: 16px 20px;
margin-bottom: 12px;
border-left: 5px solid var(--border);
box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.result-card.green { border-left-color: var(--green); background: #f0fdf4; }
.result-card.orange { border-left-color: var(--orange); background: #fff7ed; }
.result-card.red { border-left-color: var(--red); background: #fef2f2; }
.result-card h3 { font-size: 15px; margin-bottom: 6px; }
.result-card .score { font-size: 22px; font-weight: 700; }
.result-card .detail { font-size: 13px; color: var(--text2); margin-top: 4px; }
.result-card .time-info { font-size: 13px; color: var(--accent2); margin-top: 4px; font-weight: 600; }
.profile-box {
background: linear-gradient(135deg, var(--accent2), var(--accent));
color: white;
padding: 24px;
border-radius: var(--radius);
margin: 20px 0;
}
.profile-box h2 { font-size: 20px; margin-bottom: 8px; }
.profile-box .risk { display: inline-block; padding: 4px 14px; border-radius: 20px; font-weight: 700; font-size: 13px; margin-top: 8px; }
.risk-high { background: rgba(239,68,68,0.3); }
.risk-very-high { background: rgba(239,68,68,0.5); }
.risk-medium { background: rgba(234,179,8,0.3); }
.risk-low { background: rgba(34,197,94,0.3); }
.reco-box {
background: var(--soft);
padding: 20px;
border-radius: var(--radius);
margin-top: 16px;
}
.reco-box h3 { font-size: 16px; color: var(--accent2); margin-bottom: 12px; }
.reco-box ul { margin-left: 18px; }
.reco-box li { margin-bottom: 8px; font-size: 14px; line-height: 1.5; }
/* Exercises v3 styling */
.exo-box {
background: var(--card);
border: 1.5px solid var(--border);
border-radius: var(--radius);
margin-top: 16px;
overflow: hidden;
}
.exo-box h3 {
font-size: 16px;
color: white;
padding: 12px 20px;
background: linear-gradient(135deg, #7c3aed, #a855f7);
margin: 0;
}
.exo-box .exo-meta {
display: flex;
gap: 12px;
flex-wrap: wrap;
padding: 12px 20px;
background: #f5f3ff;
border-bottom: 1px solid #e9e5f5;
font-size: 13px;
color: #5b21b6;
font-weight: 600;
}
.exo-box .exo-meta span { display: inline-flex; align-items: center; gap: 4px; }
.exo-list { padding: 16px 20px; }
.exo-item {
padding: 12px 0;
border-bottom: 1px solid var(--soft);
}
.exo-item:last-child { border-bottom: none; }
.exo-item strong { color: var(--accent2); font-size: 14px; }
.exo-item p { font-size: 13px; color: var(--text2); margin-top: 4px; line-height: 1.5; }
.exo-item .exo-tag {
display: inline-block;
font-size: 11px;
padding: 2px 8px;
border-radius: 10px;
font-weight: 600;
margin-top: 4px;
margin-right: 4px;
}
.exo-tag.fun { background: #fef3c7; color: #92400e; }
.exo-tag.evidence { background: #dcfce7; color: #166534; }
.exo-tag.daily { background: #dbeafe; color: #1e40af; }
.exo-tag.tool { background: #f3e8ff; color: #6b21a8; }
.rti-box {
background: linear-gradient(135deg, #fef3c7, #fde68a);
border: 2px solid #f59e0b;
padding: 16px 20px;
border-radius: var(--radius);
margin-top: 16px;
}
.rti-box h4 { color: #92400e; font-size: 14px; margin-bottom: 8px; }
.rti-box p { font-size: 13px; color: #78350f; line-height: 1.6; }
.radar-container {
text-align: center;
padding: 20px;
background: var(--card);
border-radius: var(--radius);
margin: 20px 0;
box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.radar-container h3 { margin-bottom: 16px; font-size: 16px; }
.error-analysis {
background: #fffbeb;
padding: 16px;
border-radius: var(--radius);
margin-top: 12px;
}
.error-analysis h4 { font-size: 14px; color: var(--warm); margin-bottom: 8px; }
.error-tag {
display: inline-block;
padding: 3px 10px;
border-radius: 12px;
font-size: 12px;
font-weight: 600;
margin: 2px;
}
.error-tag.phono-plausible { background: #dbeafe; color: #1e40af; }
.error-tag.phono-implausible { background: #fecaca; color: #991b1b; }
.error-tag.inversion { background: #fef3c7; color: #92400e; }
.error-tag.omission { background: #e0e7ff; color: #3730a3; }
.error-tag.addition { background: #f3e8ff; color: #6b21a8; }
.error-tag.substitution { background: #ffedd5; color: #9a3412; }
.error-tag.morpho { background: #d1fae5; color: #065f46; }
.disclaimer {
background: #fef2f2;
border: 1px solid #fca5a5;
padding: 14px 18px;
border-radius: var(--radius);
margin-top: 20px;
font-size: 13px;
color: #991b1b;
}
.threshold-note {
font-size: 11px;
color: var(--text2);
font-style: italic;
margin-top: 4px;
padding: 4px 8px;
background: #f8fafc;
border-radius: 4px;
}
</style>
</head>
<body>
<div class="app">
<div class="app-header">
<h1>🔬 Test de Lecture & Orthographe — CM1/CM2</h1>
<p>Identifier précisément où et pourquoi ça bloque en français · 10 épreuves · Maman supervise</p>
</div>
<div class="progress-track"><div class="progress-fill" id="progressBar" style="width:0%"></div></div>
<div class="nav" id="nav"></div>
<div id="sections"></div>
<div class="section" id="resultSection"></div>
</div>
<script>
// ============================================================
// DATA
// ============================================================
const TESTS = [
'Mots réguliers','Mots irréguliers','Pseudo-mots',
'Dénomination rapide','Conscience phono','Dictée',
'Fluence','Compréhension','Mémoire de travail','Empan visuel'
];
// --- 2. MOTS RÉGULIERS (gradués) ---
const regularWords = {
'Niveau 1 — Simples (CV, CVC)': ['ami','rue','bus','île','âne','col','dé','pic','vol','fée'],
'Niveau 2 — Bisyllabiques': ['table','robe','livre','lampe','porte','banane','robot','valise','tortue','ballon'],
'Niveau 3 — Trisyllabiques': ['chocolat','pantalon','cartable','mercredi','carotte','tulipe','lavabo','domino','solitude','catalogue'],
'Niveau 4 — Complexes': ['ordinateur','trampoline','rhinocéros','thermomètre','bibliothèque']
};
// --- 3. MOTS IRRÉGULIERS ---
const irregularWords = {
'Niveau 1 — Fréquents': ['femme','monsieur','sept','fils','pays','ville','écho','clef','yacht','poêle'],
'Niveau 2 — Moyens': ['oignon','automne','album','paon','faon','choeur','rhume','sculpteur','baptême','orchidée'],
'Niveau 3 — Rares': ['aquarium','orchestre','compteur','chrysanthème','hypothèse']
};
// --- 4. PSEUDO-MOTS (gradués) ---
const pseudoWords = {
'Niveau 1 — CVC / CVCV': ['bral','toup','fane','molu','rivo','daco','lupi','tobe'],
'Niveau 2 — CCVC / CVCCV': ['broton','clopir','flanque','drapule','flopir','grophe','trouche','plamure'],
'Niveau 3 — Complexes (CCC, graphèmes rares)': ['spanture','vrindale','chromile','phrétule','blansoir']
};
// --- 5. RAN ---
const ranColors = ['#dc2626','#2563eb','#16a34a','#eab308','#1e1e1e'];
const ranColorNames = ['rouge','bleu','vert','jaune','noir'];
// --- 6. CONSCIENCE PHONOLOGIQUE ---
const phonoQuestions = [
{ cat:'Segmentation', q:"Combien de syllabes dans « papillon » ?", opts:['2','3','4'], correct:1 },
{ cat:'Segmentation', q:"Combien de syllabes dans « électricité » ?", opts:['4','5','6'], correct:1 },
{ cat:'Identification', q:"Quel son entends-tu au début de « chameau » ?", opts:['/k/','/ʃ/ (ch)','/s/'], correct:1 },
{ cat:'Identification', q:"Quel son entends-tu à la fin de « parapluie » ?", opts:['/i/','/ɥi/ (ui)','/e/'], correct:1 },
{ cat:'Identification', q:"Combien de sons dans le mot « chat » ?", opts:['2','3','4'], correct:0 },
{ cat:'Rime', q:"Quel mot rime avec « maison » ?", opts:['poisson','raisin','mouton'], correct:0 },
{ cat:'Rime', q:"Quel mot rime avec « cartable » ?", opts:['capable','carton','tableau'], correct:0 },
{ cat:'Suppression', q:"Si on enlève /r/ à « train », qu'obtient-on ?", opts:['"tain"','"tin"','"tan"'], correct:0 },
{ cat:'Suppression', q:"Si on enlève /p/ à « plat », qu'obtient-on ?", opts:['"la"','"lat"','"pa"'], correct:1 },
{ cat:'Fusion', q:"Si on assemble /m/ + /a/ + /r/, quel mot obtient-on ?", opts:['mare','mars','marre'], correct:0 },
{ cat:'Fusion', q:"Si on assemble /ʃ/ + /a/ + /t/, quel mot obtient-on ?", opts:['chat','chatte','char'], correct:1 },
{ cat:'Inversion', q:"Dis « sol » à l'envers (inversement des sons), qu'obtient-on ?", opts:['"los"','"ols"','"lo"'], correct:0 },
{ cat:'Inversion', q:"Dis « car » à l'envers, qu'obtient-on ?", opts:['"rac"','"arc"','"cra"'], correct:0 },
{ cat:'Substitution', q:"Dans « car », remplace /k/ par /b/. Qu'obtient-on ?", opts:['"bar"','"par"','"tar"'], correct:0 },
{ cat:'Discrimination', q:"« pain » et « bain » : identiques ou différents ?", opts:['Identiques','Différents'], correct:1 },
{ cat:'Discrimination', q:"« chou » et « joue » : identiques ou différents ?", opts:['Identiques','Différents'], correct:1 },
];
// --- 7. DICTÉE ---
const dicteeWords = [
{ word:'chat', audio:'Le mot : CHAT' },
{ word:'fleur', audio:'Le mot : FLEUR' },
{ word:'brosse', audio:'Le mot : BROSSE' },
{ word:'école', audio:'Le mot : ÉCOLE' },
{ word:'pharmacie', audio:'Le mot : PHARMACIE' },
{ word:'grenouille', audio:'Le mot : GRENOUILLE' },
{ word:'sympathique', audio:'Le mot : SYMPATHIQUE' },
{ word:'enveloppe', audio:'Le mot : ENVELOPPE' }
];
const dicteePhrases = [
{ text:'Le chat mange sa nourriture.', audio:'Phrase : Le chat mange sa nourriture.' },
{ text:'Les enfants jouent dans le jardin.', audio:'Phrase : Les enfants jouent dans le jardin.' },
{ text:"L'orchestre répète avant le spectacle.", audio:"Phrase : L'orchestre répète avant le spectacle." }
];
// --- 8. FLUENCE ---
const fluenceText = "Le matin, Pierre se lève très tôt pour aller à l'école. Il prend son petit déjeuner avec du pain et du chocolat chaud. Ensuite, il met son manteau et son cartable sur le dos. Sa mère le conduit en voiture car l'école est assez loin. Sur le chemin, Pierre regarde les arbres, les maisons et les voitures qui passent. Quand il arrive, il retrouve ses amis dans la cour. Ils jouent ensemble pendant quelques minutes avant que la cloche sonne. En classe, la maîtresse leur demande de sortir leurs cahiers de mathématiques. Pierre aime bien les nombres mais il trouve que les problèmes sont parfois difficiles. Après les mathématiques, c'est l'heure de la lecture. Aujourd'hui, ils lisent une histoire de chevaliers et de dragons. Pierre essaie de lire à voix haute quand la maîtresse le lui demande. À midi, il mange à la cantine avec ses camarades. L'après-midi passe vite entre la géographie et le dessin.";
// --- 9. COMPRÉHENSION ---
const compTexts = [
{
title: 'Le renard rusé (narratif)',
text: "Un matin d'hiver, un renard affamé aperçoit un corbeau perché tout en haut d'un grand chêne. Le corbeau tient dans son bec un gros morceau de fromage qu'il vient de voler dans une ferme voisine. Le renard, qui n'a rien mangé depuis deux jours, réfléchit à un plan. Il s'approche de l'arbre et lance d'une voix douce : « Quel magnifique plumage vous avez, cher corbeau ! Je suis certain que votre voix est aussi belle que vos plumes. » Le corbeau, tout fier d'être complimenté, ouvre grand son bec pour pousser un cri. Le fromage tombe aussitôt. Le renard s'en empare et s'enfuit en disant : « Apprenez que tout flatteur vit aux dépens de celui qui l'écoute. »",
questions: [
{ q:"Que tient le corbeau dans son bec ?", opts:['Un ver','Du fromage','Un fruit'], correct:1, type:'explicite' },
{ q:"Depuis combien de temps le renard n'a-t-il pas mangé ?", opts:['Un jour','Deux jours','Une semaine'], correct:1, type:'explicite' },
{ q:"Comment le corbeau se sent-il quand il entend le compliment ?", opts:['Méfiant','Flatté et fier','En colère'], correct:1, type:'inférentielle' },
{ q:"Pourquoi le renard fait-il un compliment au corbeau ?", opts:["Parce qu'il aime sa voix","Pour qu'il ouvre son bec et perde le fromage","Pour devenir son ami"], correct:1, type:'inférentielle' },
{ q:"Que signifie « tout flatteur vit aux dépens de celui qui l'écoute » ?", opts:["Ceux qui font des compliments sont gentils","Ceux qui flattent profitent de ceux qui les croient","Les flatteurs sont pauvres"], correct:1, type:'vocabulaire' },
]
},
{
title: 'La migration des oiseaux (informatif)',
text: "Chaque automne, des millions d'oiseaux quittent les régions froides pour se diriger vers des pays plus chauds. Ce voyage s'appelle la migration. Les oiseaux migrateurs, comme les hirondelles et les cigognes, peuvent parcourir des milliers de kilomètres. Ils se repèrent grâce au soleil, aux étoiles et au champ magnétique de la Terre. Le voyage est dangereux : les oiseaux doivent affronter le vent, la pluie et les prédateurs. Beaucoup d'entre eux ne survivent pas. Ceux qui arrivent passent l'hiver au chaud, puis reviennent au printemps pour se reproduire. Les scientifiques étudient la migration en posant de petites bagues sur les pattes des oiseaux.",
questions: [
{ q:"Quand la migration a-t-elle lieu ?", opts:['Au printemps','En automne','En été'], correct:1, type:'explicite' },
{ q:"Comment les scientifiques étudient-ils la migration ?", opts:['Avec des caméras','Avec des bagues aux pattes','Avec des satellites'], correct:1, type:'explicite' },
{ q:"Pourquoi beaucoup d'oiseaux ne survivent-ils pas au voyage ?", opts:["Parce qu'ils sont trop vieux","À cause du vent, de la pluie et des prédateurs","Parce qu'ils se perdent"], correct:1, type:'inférentielle' },
{ q:"Que signifie « champ magnétique de la Terre » dans ce texte ?", opts:["Un aimant posé au sol","Une force invisible qui aide les oiseaux à s'orienter","Le vent qui souffle vers le sud"], correct:1, type:'vocabulaire' },
]
}
];
// --- 10. MÉMOIRE DE TRAVAIL ---
const memoryForward = [
{ seq:'3-7', label:'Empan endroit — 2 chiffres' },
{ seq:'5-1-9', label:'Empan endroit — 3 chiffres' },
{ seq:'8-2-6-3', label:'Empan endroit — 4 chiffres' },
{ seq:'4-7-1-9-2', label:'Empan endroit — 5 chiffres' },
{ seq:'3-8-5-1-7-4', label:'Empan endroit — 6 chiffres' },
];
const memoryBackward = [
{ seq:'6-2', label:'Empan envers — 2 chiffres', answer:'2-6' },
{ seq:'3-9-1', label:'Empan envers — 3 chiffres', answer:'1-9-3' },
{ seq:'7-2-5-4', label:'Empan envers — 4 chiffres', answer:'4-5-2-7' },
{ seq:'1-8-3-6-2', label:'Empan envers — 5 chiffres', answer:'2-6-3-8-1' },
];
const memoryWords = [
{ seq:'chat-table-livre', label:'Mots — 3 éléments' },
{ seq:'soleil-fleur-arbre-eau', label:'Mots — 4 éléments' },
{ seq:'rouge-lune-porte-main-clef', label:'Mots — 5 éléments' },
];
// --- 11. EMPAN VISUO-ATTENTIONNEL ---
const evaSequences = [
{ letters:'R H T', duration:300, label:'3 lettres — 300ms' },
{ letters:'M B L D', duration:300, label:'4 lettres — 300ms' },
{ letters:'R T M B L', duration:200, label:'5 lettres — 200ms' },
{ letters:'F D S P N K', duration:200, label:'6 lettres — 200ms' },
{ letters:'H R T B M L D', duration:200, label:'7 lettres — 200ms' },
];
// ============================================================
// STATE
// ============================================================
const state = {
currentTest: 0,
regularErrors: {},
irregularErrors: {},
pseudoErrors: {},
timers: { regular:0, irregular:0, pseudo:0, ran:0, fluence:0 },
timerIntervals: {},
timerRunning: {},
ranErrors: 0,
phono: [],
dicteeWords: [],
dicteePhrases: [],
fluenceLastWord: -1,
fluenceErrors: [],
comprehension: [],
memForward: [],
memBackward: [],
memWords: [],
eva: [],
done: new Set()
};
// ============================================================
// INIT
// ============================================================
function init() {
buildNav();
buildSections();
goTo(0);
}
function buildNav() {
const nav = document.getElementById('nav');
TESTS.forEach((t,i) => {
const b = document.createElement('button');
b.textContent = `${i+1}. ${t}`;
b.onclick = () => goTo(i);
nav.appendChild(b);
});
}
function goTo(idx) {
state.done.add(state.currentTest);
state.currentTest = idx;
document.querySelectorAll('.section').forEach(s => s.classList.remove('active'));
const sec = document.getElementById('sec'+idx);
if(sec) sec.classList.add('active');
document.querySelectorAll('.nav button').forEach((b,i) => {
b.classList.remove('active');
if(state.done.has(i) && i !== idx) b.classList.add('done');
else b.classList.remove('done');
});
document.querySelectorAll('.nav button')[idx].classList.add('active');
document.getElementById('progressBar').style.width = ((idx+1)/TESTS.length*100)+'%';
window.scrollTo({top:0, behavior:'smooth'});
}
function goResults() {
state.done.add(state.currentTest);
document.querySelectorAll('.section').forEach(s => s.classList.remove('active'));
document.getElementById('resultSection').classList.add('active');
document.querySelectorAll('.nav button').forEach(b => { b.classList.remove('active'); b.classList.add('done'); });
document.getElementById('progressBar').style.width = '100%';
buildResults();
window.scrollTo({top:0, behavior:'smooth'});
}
// ============================================================
// BUILD ALL SECTIONS
// ============================================================
function buildSections() {
const root = document.getElementById('sections');
root.innerHTML = '';
TESTS.forEach((t,i) => {
const div = document.createElement('div');
div.className = 'section';
div.id = 'sec'+i;
root.appendChild(div);
});
// Indices décalés car l'anamnèse (0) a été supprimée
buildReadingTest('regular', 0, 'Lecture de mots réguliers', 'Mots qui se lisent comme ils s\'écrivent', regularWords);
buildReadingTest('irregular', 1, 'Lecture de mots irréguliers', 'Mots qu\'il faut connaître — lecture globale', irregularWords);
buildReadingTest('pseudo', 2, 'Lecture de pseudo-mots', 'Mots inventés — décodage pur', pseudoWords);
buildRAN();
buildPhono();
buildDictee();
buildFluence();
buildComprehension();
buildMemory();
buildEVA();
}
// ============================================================
// READING TESTS (0, 1, 2)
// ============================================================
const ERROR_TYPES = [
{ code:'vis', label:'Visuelle', desc:'b/d, p/q, m/n' },
{ code:'phon', label:'Phonémique', desc:'t/d, f/v, ch/j' },
{ code:'inv', label:'Inversion', desc:'lettres inversées' },
{ code:'omis', label:'Omission', desc:'lettre/syllabe sautée' },
{ code:'ajout', label:'Ajout', desc:'lettre/syllabe ajoutée' },
{ code:'lex', label:'Lexicalisation', desc:'lit un autre mot' },
{ code:'other', label:'Autre', desc:'' },
];
function buildReadingTest(key, testIdx, title, subtitle, wordData) {
const sec = document.getElementById('sec'+testIdx);
const timerKey = key;
let h = `
<div class="card-header"><h2>${title}</h2><p>${subtitle}</p></div>
<div class="instruction"><strong>Consigne enfant :</strong> Lis chaque mot à voix haute, le plus correctement possible.</div>
<div class="examiner-note">👩 <strong>Maman :</strong> Lancez le chronomètre quand l'enfant commence. Cliquez sur un mot pour le marquer comme erreur, puis précisez le type d'erreur. Arrêtez le chrono quand il a fini.</div>
<div class="timer-bar">
<div class="timer-display" id="timer_${timerKey}">00:00.0</div>
<button class="btn-start" id="tbtn_${timerKey}" onclick="toggleTimer('${timerKey}')">▶ Démarrer</button>
<button class="btn-reset" onclick="resetTimer('${timerKey}')">↺ Reset</button>
</div>`;
Object.entries(wordData).forEach(([level, words]) => {
h += `<div class="level-group"><h4>${level}</h4><div class="word-grid">`;
words.forEach((w, wi) => {
const globalIdx = getGlobalWordIndex(wordData, level, wi);
h += `<div class="word-card" id="wc_${key}_${globalIdx}" onclick="toggleWordError('${key}',${globalIdx},this)">
<span class="word">${w}</span>
<div class="error-type-selector" id="et_${key}_${globalIdx}">
${ERROR_TYPES.map(et => `<button onclick="event.stopPropagation();setErrorType('${key}',${globalIdx},'${et.code}',this)" title="${et.desc}">${et.label}</button>`).join('')}
</div>
</div>`;
});
h += '</div></div>';
});
const prev = testIdx > 0 ? testIdx - 1 : 0;
const next = testIdx < TESTS.length - 1 ? testIdx + 1 : testIdx;
h += `<div class="btn-row">
${testIdx > 0 ? `<button class="btn btn-secondary" onclick="goTo(${prev})">← Retour</button>` : ''}
<button class="btn btn-primary" onclick="goTo(${next})">Suivant →</button>
</div>`;
sec.innerHTML = h;
}
function getGlobalWordIndex(wordData, targetLevel, localIdx) {
let global = 0;
for(const [level, words] of Object.entries(wordData)) {
if(level === targetLevel) return global + localIdx;
global += words.length;
}
return global + localIdx;
}
function getAllWords(wordData) {
return Object.values(wordData).flat();
}
function toggleWordError(key, idx, el) {
const stateKey = key + 'Errors';
if(state[stateKey][idx]) {
delete state[stateKey][idx];
el.classList.remove('error');
} else {
state[stateKey][idx] = { error:true, types:[] };
el.classList.add('error');
}
}
function setErrorType(key, idx, code, btn) {
const stateKey = key + 'Errors';
if(!state[stateKey][idx]) return;
const types = state[stateKey][idx].types;
const i = types.indexOf(code);
if(i >= 0) { types.splice(i,1); btn.classList.remove('selected'); }
else { types.push(code); btn.classList.add('selected'); }
}
// ============================================================
// TIMER
// ============================================================
function toggleTimer(key) {
const btn = document.getElementById('tbtn_'+key);
if(state.timerRunning[key]) {
clearInterval(state.timerIntervals[key]);
state.timerRunning[key] = false;
btn.textContent = '▶ Reprendre';
btn.className = 'btn-start';
} else {
const start = Date.now() - (state.timers[key]||0);
state.timerIntervals[key] = setInterval(() => {
state.timers[key] = Date.now() - start;
document.getElementById('timer_'+key).textContent = formatTime(state.timers[key]);
}, 100);
state.timerRunning[key] = true;
btn.textContent = '⏸ Pause';
btn.className = 'btn-stop';
}
}
function resetTimer(key) {
clearInterval(state.timerIntervals[key]);
state.timers[key] = 0;
state.timerRunning[key] = false;
document.getElementById('timer_'+key).textContent = '00:00.0';
const btn = document.getElementById('tbtn_'+key);
btn.textContent = '▶ Démarrer';
btn.className = 'btn-start';
}
function formatTime(ms) {
const s = Math.floor(ms/1000);
const d = Math.floor((ms%1000)/100);
const m = Math.floor(s/60);
return `${String(m).padStart(2,'0')}:${String(s%60).padStart(2,'0')}.${d}`;
}
// ============================================================
// 3. RAN
// ============================================================
function buildRAN() {
const sec = document.getElementById('sec3'); // index 3
let grid = [];
for(let i=0; i<50; i++) grid.push(Math.floor(Math.random()*5));
state._ranGrid = grid;
let h = `
<div class="card-header"><h2>🎨 Dénomination Rapide (RAN)</h2><p>Vitesse de dénomination automatisée — prédicteur de dyslexie</p></div>
<div class="instruction"><strong>Consigne enfant :</strong> Nomme chaque couleur le plus vite possible, ligne par ligne, de gauche à droite, sans te tromper.</div>
<div class="examiner-note">👩 <strong>Maman :</strong> Lancez le chrono quand l'enfant commence. Notez le nombre d'erreurs. Arrêtez quand il a fini les 50 cases.</div>
<div class="timer-bar">
<div class="timer-display" id="timer_ran">00:00.0</div>
<button class="btn-start" id="tbtn_ran" onclick="toggleTimer('ran')">▶ Démarrer</button>
<button class="btn-reset" onclick="resetTimer('ran')">↺ Reset</button>
</div>
<div class="ran-grid">`;
grid.forEach(ci => {
h += `<div class="ran-cell" style="background:${ranColors[ci]}">${ci===4?'':'●'}</div>`;
});
h += `</div>
<div class="card" style="margin-top:12px">
<label style="font-weight:600;font-size:14px;">Nombre d'erreurs de dénomination :</label>
<input type="text" id="ranErrors" placeholder="0" style="max-width:100px;margin-top:8px" onchange="state.ranErrors=parseInt(this.value)||0">
</div>
<div class="btn-row">
<button class="btn btn-secondary" onclick="goTo(2)">← Retour</button>
<button class="btn btn-primary" onclick="goTo(4)">Suivant →</button>
</div>`;
sec.innerHTML = h;
}
// ============================================================
// 4. CONSCIENCE PHONOLOGIQUE
// ============================================================
function buildPhono() {
const sec = document.getElementById('sec4'); // index 4
let h = `
<div class="card-header"><h2>🔊 Conscience phonologique</h2><p>Capacité à manipuler les sons du langage</p></div>
<div class="instruction"><strong>Consigne :</strong> Réponds aux questions sur les sons des mots.</div>
<div class="examiner-note">👩 <strong>Maman :</strong> Lisez chaque question à voix haute si l'enfant a du mal à les lire. L'important est de tester les sons, pas la lecture.</div>`;
let currentCat = '';
phonoQuestions.forEach((q,i) => {
if(q.cat !== currentCat) {
currentCat = q.cat;
h += `<h4 style="margin:16px 0 8px;color:var(--accent2);font-size:13px;text-transform:uppercase;letter-spacing:1px">${currentCat}</h4>`;
}
h += `<div class="q-block"><h4>${i+1}. ${q.q}</h4><div class="q-options">`;
q.opts.forEach((o,j) => {
h += `<label><input type="radio" name="phono${i}" value="${j}" onchange="state.phono[${i}]=${j}"><span>${o}</span></label>`;
});
h += '</div></div>';
});
h += `<div class="btn-row">
<button class="btn btn-secondary" onclick="goTo(3)">← Retour</button>
<button class="btn btn-primary" onclick="goTo(5)">Suivant →</button>
</div>`;
sec.innerHTML = h;
}
// ============================================================
// 5. DICTÉE
// ============================================================
function buildDictee() {
const sec = document.getElementById('sec5'); // index 5
let h = `
<div class="card-header"><h2>✏️ Dictée de mots et phrases</h2><p>Orthographe — analyse qualitative des erreurs</p></div>
<div class="instruction"><strong>Consigne enfant :</strong> Écoute bien et écris ce que tu entends.</div>
<div class="examiner-note">👩 <strong>Maman :</strong> Cliquez sur le bouton pour faire entendre le mot/phrase. L'enfant écrit dans le champ. Le système analysera automatiquement les types d'erreurs.</div>
<h3 style="margin:16px 0 8px">Partie A : Mots isolés</h3>`;
dicteeWords.forEach((item,i) => {
h += `<div class="q-block">
<button class="audio-btn" onclick="speak('${item.audio}')">🔊 Écouter le mot ${i+1}</button>
<input type="text" placeholder="Écris le mot ici" id="dw${i}" onchange="state.dicteeWords[${i}]=this.value">
</div>`;
});
h += '<h3 style="margin:24px 0 8px">Partie B : Phrases</h3>';
dicteePhrases.forEach((item,i) => {
h += `<div class="q-block">
<button class="audio-btn" onclick="speak(\`${item.audio}\`)">🔊 Écouter la phrase ${i+1}</button>
<textarea placeholder="Écris la phrase ici" id="dp${i}" onchange="state.dicteePhrases[${i}]=this.value"></textarea>
</div>`;
});
h += `<div class="btn-row">
<button class="btn btn-secondary" onclick="goTo(4)">← Retour</button>
<button class="btn btn-primary" onclick="goTo(6)">Suivant →</button>
</div>`;
sec.innerHTML = h;
}
function speak(text) {
if('speechSynthesis' in window) {
speechSynthesis.cancel();
const u = new SpeechSynthesisUtterance(text);
u.lang = 'fr-FR';
u.rate = 0.85;
speechSynthesis.speak(u);