-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweb_script.js
2385 lines (2061 loc) · 90.9 KB
/
web_script.js
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
const Nb_Cycle = 3;
const Countdown = 1000;
let SelectedPost
let refresh = false;
let Formation = ""
let IE_1 = ""
let IE_2 = ""
let IE_3 = ""
let IE_GO = ""
let IE_GOCS = ""
let IE_GOGALAXY = ""
let IE_ARES = ""
let IE_ORION = ""
let IE_BETAVR = ""
let IE_1_COACH = ""
let IE_2_COACH = ""
let IE_3_COACH = ""
let IE_GO_COACH = ""
let IE_GOCS_COACH = ""
let IE_GOGALAXY_COACH = ""
let IE_ARES_COACH = ""
let IE_ORION_COACH = ""
let IE_ALL = ""
let IE_ALL_COACH = ""
let yourTeam = [];
let offset = 0;
let counter = 0;
let Status = false;
let name1_status = false;
let name2_status = false;
let name3_status = false;
let name4_status = false;
let name5_status = false;
let name6_status = false;
let name7_status = false;
let name8_status = false;
let name9_status = false;
let name10_status = false;
let name11_status = false;
let name12_status = false;
let name13_status = false;
let name14_status = false;
let name15_status = false;
let name16_status = false;
let selected_previous_option = "optionFOR";
let DF = { Players: [] };
let MF = { Players: [] };
let FW = { Players: [] };
let GK = { Players: [] };
let shuffledArray
let CurrentList = { 'DF': DF.Players, 'MF': MF.Players, 'FW': FW.Players, 'GK': GK.Players }
console.log("CurrentList - Befor Init")
console.log(CurrentList)
let FolderPath = "./web_database.json";
let Joueurs = [];
let img_down_row = document.getElementById("img_down_row");
const Team_directory = {
"RM": "Raimon",
"OC": "Occulte",
"WD": "Wild",
"CT": "Cybertech",
"OK": "Otaku",
"RA": "Royal Academie",
"SK": "Shuriken",
"TA": "Terria",
"KW": "Kirkwood",
"ZS": "Zeus",
"OI": "Onze d'Inazuma",
"SS": "Street Sally's",
"KF": "Inazuma Kids FC",
"UB": "Umbrella",
"ST": "Services Secrets",
"AP": "Alpin",
"CD": "Cloître Divin",
"3C": "Super Triple C",
"FS": "Fauxshore",
"MT": "Mary Times",
"TG": "Tempête des Gémeaux",
"EP": "Epsilon",
"NE": "Nouvel Epsilon",
"NR": "Nouvelle Royal Academie",
"PM": "Prominence",
"DD": "Diamond Dust",
"GS": "Genesis",
"EN": "Empereurs Noirs",
"RdG": "Robots de Garde",
"FT": "Forest Team",
"JI": "Jeunes Inazuma",
"IJ": "Inazuma Japon",
"NJ": "Neo Japon",
"BW": "Big Waves",
"LdD": "Lions du Désert",
"DF": "Dragons de Feu",
"KQ": "Knights of Queen",
"TD": "Team D",
"LE": "Les Empereurs",
"LL": "Les Licornes",
"OP": "Orphée",
"RF": "Les Rois du Football",
"TZ": "Team Zoolan",
"LG": "Little Gigantes",
"RG": "Rose Griffons",
"TR": "Les Toreros Rouges",
"BB": "Brocken Bogue",
"CC": "The Cape Crusaders",
"TO": "Team Ogre",
"MC": "Sky Team",
"DT": "Dark Team",
"AN": "Anges Noirs",
"AO": "l'Âge d'Or",
"KFGO": "Inazuma KFC",
"UMT": "Ultramégatétra",
"RMGO": "Raimon GO",
"RM R": "Raimon Reserve",
"CN": "Chevaliers Noirs",
"SR": "Surdoués",
"VL": "Voie Lactée",
"FTP": "Foi Toute-Puissante",
"RAGO": "Royal Academy GO",
"BP": "Baie des Pirates",
"ML": "Mers Lunaires",
"APGO": "Alpin GO",
"KWGO": "Kirkwood GO",
"CM": "Collège des Mirages",
"CU": "Collège Universel",
"MO": "Mont Olympe",
"AdD": "Alliance du Dragon",
"LME": "Lumière Éternelle",
"OA": "Ombre Ancestral",
"E0": "Équipe Zéro",
"GdS": "Griffe du Sud",
"CdN": "Croc du Nord",
"RD": "Rage du Démon",
"SHW": "Les Sherwinds",
"PO": "Protocol Omega",
"PO2": "Protocol Omega 2.0",
"PO3": "Protocol Omega 3.0",
"ZD": "Zanark Domination",
"EX": "Excellence",
"ZAN": "Zan",
"GIH": "Gihl",
"GAH": "Gahl",
"RGN": "Ragna",
"CS": "Chrono Storm",
"BCB": "Bande du Cerf Blanc",
"RS": "Robots de Surveillance",
"SA": "Statues d'Argile",
"IJE": "Inazuma Japon Évolution",
"RdD": "Roses du Désespoir",
"ES": "Enfants Sauvages",
"TN": "Traqueurs Nocturnes",
"RMGOCS": "Raimon GO CS",
"CTR": "Chevaliers de la Table Ronde",
"ED3": "El Dorado Team 03",
"IN": "Inazuma National",
"RJ": "Rébellion Japon",
"DFGO": "Dragons de Feu (GO)",
"BWGO": "Big Waves (GO)",
"SBA": "Sabres Arides",
"TT": "Tigres de Thaïlande",
"LO": "Loups d'Ouzbékistan",
"OT": "Onze Terrestre",
"OS": "Onze de Silica",
"ON": "Onze de Naiadi",
"OM": "Onze de Magmavia",
"OF": "Onze de Fertilia",
"FM": "Falam Medius",
"AI": "Armada Ixar",
"BIBG": "Big Bang",
"SPNA": "Supernova",
"TS": "Terrible Shadow",
"IKRM": "Inakuni Raimon",
"BT": "Bastion",
"AS": "Anima Sana",
"PS": "École Polaris",
"AA": "École Alia",
"LD": "Lambda",
"SN": "Sélène",
"RB": "Red Bison",
"SHST": "Shining Satans",
"ET": "Eternal Dancers",
"PHoA": "Phoenix Army of Arab",
"SAoA": "Soccer Acrobatic of Arab",
"IG": "Invincible Giant",
"SU": "Star Unicorn",
"NI": "Navy Invaders",
"PFS": "Perfect Spark",
"OdS": "Olé de Samba",
"GQ": "Guardians of Queen",
"SO": "Shadow of Orion",
"IAS": "Inazuma All Stars",
"JD": "Japan Dreams",
"AM": "Alia Masters"
};
function preloadImages(categoryData) {
// Parcourir chaque élément dans la catégorie
for (var key in categoryData) {
if (categoryData.hasOwnProperty(key)) {
var imagePath = categoryData[key].Path;
// Créer un objet Image pour précharger l'image
var img_preload = new Image();
img.src = imagePath;
}
}
}
async function init() {
if (combo2.value == "optionCoach" || combo2.value == "optionFOR" || combo.value == "optionIEBETAVR") {
img_down_row.style.display = "none";
}
var buttonStart = document.getElementById("start-button");
var buttonSelected1 = document.getElementById("buttonSelected1");
var buttonSelected2 = document.getElementById("buttonSelected2");
var buttonSelected3 = document.getElementById("buttonSelected3");
var buttonSelected4 = document.getElementById("buttonSelected4");
var buttonSelected5 = document.getElementById("buttonSelected5");
buttonStart.disabled = true;
buttonSelected1.disabled = true;
buttonSelected2.disabled = true;
buttonSelected3.disabled = true;
buttonSelected4.disabled = true;
buttonSelected5.disabled = true;
buttonStart.classList.add("disabled-button");
buttonSelected1.classList.add("disabled-button");
buttonSelected2.classList.add("disabled-button");
buttonSelected3.classList.add("disabled-button");
buttonSelected4.classList.add("disabled-button");
buttonSelected5.classList.add("disabled-button");
console.log("")
console.log("....Init Start....")
const response = await fetch(FolderPath);
const data = await response.json();
Formation = data.Formation;
IE_1 = data.IE_1;
IE_2 = data.IE_2;
IE_3 = data.IE_3;
IE_GO = data.IE_GO;
IE_GOCS = data.IE_GOCS;
IE_GOGALAXY = data.IE_GOGALAXY;
IE_ARES = data.IE_ARES;
IE_ORION = data.IE_ORION;
IE_BETAVR = data.IE_betaVR;
IE_1_COACH = data.IE_1_COACH;
IE_2_COACH = data.IE_2_COACH;
IE_3_COACH = data.IE_3_COACH;
IE_GO_COACH = data.IE_GO_COACH;
IE_GOCS_COACH = data.IE_GOCS_COACH;
IE_GOGALAXY_COACH = data.IE_GOGALAXY_COACH;
IE_ARES_COACH = data.IE_ARES_COACH;
IE_ORION_COACH = data.IE_ORION_COACH;
IE_ALL = data.IE_ALL;
IE_ALL_COACH = data.IE_ALL_COACH;
if (refresh = false) {
console.log("refresh")
console.log(refresh)
Object.values(IE_1).forEach(joueur => { Joueurs.push(joueur.Path); });
Object.values(IE_1).forEach(joueur => {
if (joueur.Poste === "GK") {
GK.Players.push(joueur);
}
else if (joueur.Poste === "DF") {
DF.Players.push(joueur);
}
else if (joueur.Poste === "MF") {
MF.Players.push(joueur);
}
else if (joueur.Poste === "FW") {
FW.Players.push(joueur);
}
});
}
CurrentList["Formation"] = Formation;
CurrentList["Coach"] = IE_1_COACH;
//GK["Players"] = [];
//console.log("GK")
//console.log(GK.Players)
console.log("CurrentList - After Init")
//CurrentList["GK"] = GK.Players
console.log(CurrentList)
console.log("....Init End....")
console.log("")
}
var combo = document.getElementById("combo-box1");
combo.addEventListener("change", function () {
let CurrentSaison
var selectedOptionC1 = combo.value;
switch (selectedOptionC1) {
case "optionIE1":
CurrentSaison = IE_1;
break;
case "optionIE2":
CurrentSaison = IE_2;
break;
case "optionIE3":
CurrentSaison = IE_3;
break;
case "optionIEGO":
CurrentSaison = IE_GO;
break;
case "optionIEGOCS":
CurrentSaison = IE_GOCS;
break;
case "optionIEGOGALAXY":
CurrentSaison = IE_GOGALAXY;
break;
case "optionIEARES":
CurrentSaison = IE_ARES;
break;
case "optionIEORION":
CurrentSaison = IE_ORION;
break;
case "optionIEALL":
CurrentSaison = IE_ALL;
break;
case "optionIEBETAVR":
CurrentSaison = IE_BETAVR;
break;
//default:
// Gérer d'autres options si nécessaire
// break;
}
on_comboBox_type_changed(combo.value)
GK["Players"] = [];
MF["Players"] = [];
FW["Players"] = [];
DF["Players"] = [];
console.log("after")
CurrentList["GK"] = GK.Players;
CurrentList["DF"] = DF.Players;
CurrentList["MF"] = MF.Players;
CurrentList["FW"] = FW.Players;
console.log(CurrentList);
Object.values(CurrentSaison).forEach(joueur => {
if (joueur.Poste === "GK") {
GK.Players.push(joueur);
}
else if (joueur.Poste === "DF") {
DF.Players.push(joueur);
}
else if (joueur.Poste === "MF") {
MF.Players.push(joueur);
}
else if (joueur.Poste === "FW") {
FW.Players.push(joueur);
}
});
console.log(CurrentList);
});
var combo2 = document.getElementById("combo-box2");
combo2.addEventListener("change", function () {
var selectedOption = combo.value;
on_comboBox_type_changed(selectedOption)
});
function on_comboBox_type_changed(selectOpt) {
if (combo.value == "default" || combo2.value == "default") {
var buttonStart = document.getElementById("start-button");
var buttonSelected1 = document.getElementById("buttonSelected1");
var buttonSelected2 = document.getElementById("buttonSelected2");
var buttonSelected3 = document.getElementById("buttonSelected3");
var buttonSelected4 = document.getElementById("buttonSelected4");
var buttonSelected5 = document.getElementById("buttonSelected5");
buttonStart.disabled = true;
buttonSelected1.disabled = true;
buttonSelected2.disabled = true;
buttonSelected3.disabled = true;
buttonSelected4.disabled = true;
buttonSelected5.disabled = true;
buttonStart.classList.add("disabled-button");
buttonSelected1.classList.add("disabled-button");
buttonSelected2.classList.add("disabled-button");
buttonSelected3.classList.add("disabled-button");
buttonSelected4.classList.add("disabled-button");
buttonSelected5.classList.add("disabled-button");
} else {
var buttonStart = document.getElementById("start-button");
var buttonSelected1 = document.getElementById("buttonSelected1");
var buttonSelected2 = document.getElementById("buttonSelected2");
var buttonSelected3 = document.getElementById("buttonSelected3");
var buttonSelected4 = document.getElementById("buttonSelected4");
var buttonSelected5 = document.getElementById("buttonSelected5");
buttonStart.disabled = false;
buttonSelected1.disabled = false;
buttonSelected2.disabled = false;
buttonSelected3.disabled = false;
buttonSelected4.disabled = false;
buttonSelected5.disabled = false;
buttonStart.classList.remove("disabled-button");
buttonSelected1.classList.remove("disabled-button");
buttonSelected2.classList.remove("disabled-button");
buttonSelected3.classList.remove("disabled-button");
buttonSelected4.classList.remove("disabled-button");
buttonSelected5.classList.remove("disabled-button");
Status = false
var selectedOption = combo2.value;
let Saison = combo.value;
console.log("")
console.log(selectOpt)
console.log("")
if (selected_previous_option === "optionFOR" || selected_previous_option === "optionCoach" || selected_previous_option == "optionIEBETAVR") {
img_down_row.style.display = "flex";
}
if (combo.value == "optionIEBETAVR") {
img_down_row.style.display = "none";
Status = true
}
if (selectedOption == "optionFOR") {
img_down_row.style.display = "none";
Status = true
}
switch (selectedOption) {
case "optionCoach":
img_down_row.style.display = "none";
Status = true
switch (selectOpt) {
case "optionIE1":
CurrentList["Coach"] = IE_1_COACH;
break;
case "optionIE2":
CurrentList["Coach"] = IE_2_COACH;
break;
case "optionIE3":
CurrentList["Coach"] = IE_3_COACH;
break;
case "optionIEGO":
CurrentList["Coach"] = IE_GO_COACH;
break;
case "optionIEGOCS":
CurrentList["Coach"] = IE_GOCS_COACH;
break;
case "optionIEGOGALAXY":
CurrentList["Coach"] = IE_GOGALAXY_COACH;
break;
case "optionIEARES":
CurrentList["Coach"] = IE_ARES_COACH;
break;
case "optionIEORION":
CurrentList["Coach"] = IE_ORION_COACH;
break;
case "optionIEALL":
CurrentList["Coach"] = IE_ALL_COACH;
break;
case "optionIEBETAVR":
CurrentList["Coach"] = IE_BETAVR;
break;
}
break;
case "optionGK":
SelectedPost = GK
Status = true
break;
case "optionDF":
SelectedPost = DF
Status = true
break;
case "optionMF":
SelectedPost = MF
Status = true
break;
case "optionFW":
SelectedPost = FW
Status = true
break;
}
selected_previous_option = selectedOption
if (combo.value == "optionIEBETAVR") {
selected_previous_option = "optionIEBETAVR"
}
console.log(CurrentList);
}
}
function shuffleObject(obj) {
// Convert object to array
var arr = Object.values(obj);
// Perform shuffle operation
for (let i = arr.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[arr[i], arr[j]] = [arr[j], arr[i]];
}
// Convert array back to object
var shuffledObj = {};
for (var i = 0; i < arr.length; i++) {
shuffledObj[i] = arr[i];
}
return shuffledObj;
}
var startButton = document.getElementById("start-button");
startButton.addEventListener("click", function () {
var refresh_button = document.getElementById("refresh-button");
refresh_button.disabled = true;
startButton.disabled = true;
buttonSelected1.disabled = true;
buttonSelected2.disabled = true;
buttonSelected3.disabled = true;
buttonSelected4.disabled = true;
buttonSelected5.disabled = true;
refresh_button.classList.add("disabled-button");
startButton.classList.add("disabled-button");
buttonSelected1.classList.add("disabled-button");
buttonSelected2.classList.add("disabled-button");
buttonSelected3.classList.add("disabled-button");
buttonSelected4.classList.add("disabled-button");
buttonSelected5.classList.add("disabled-button");
buttonSelected1.style.display = 'none';
buttonSelected2.style.display = 'none';
buttonSelected3.style.display = 'none';
buttonSelected4.style.display = 'none';
buttonSelected5.style.display = 'none';
combo.disabled = true;
combo2.disabled = true;
offset = 0
console.log("....Start Button Pressed....")
console.log(CurrentList)
switch (combo2.value) {
case "optionFOR":
console.log("Before Shuffle")
console.log(CurrentList.Formation)
shuffledArray = shuffleObject(CurrentList.Formation)
console.log("After Shuffle")
console.log(shuffledArray)
break;
case "optionCoach":
console.log("Before Shuffle")
console.log(CurrentList.Coach)
shuffledArray = shuffleObject(CurrentList.Coach)
console.log("After Shuffle")
console.log(shuffledArray)
break;
case "optionGK":
console.log("Before Shuffle")
console.log(CurrentList.GK)
shuffledArray = shuffleObject(CurrentList.GK)
console.log("After Shuffle")
console.log(shuffledArray)
break;
case "optionDF":
console.log("Before Shuffle")
console.log(CurrentList.DF)
shuffledArray = shuffleObject(CurrentList.DF)
console.log("After Shuffle")
console.log(shuffledArray)
break;
case "optionMF":
console.log("Before Shuffle")
console.log(CurrentList.MF)
shuffledArray = shuffleObject(CurrentList.MF)
console.log("After Shuffle")
console.log(shuffledArray)
break;
case "optionFW":
console.log("Before Shuffle")
console.log(CurrentList.FW)
shuffledArray = shuffleObject(CurrentList.FW)
console.log("After Shuffle")
console.log(shuffledArray)
break;
}
let Nb_item = Object.keys(shuffledArray).length
console.log("Taille de l'objet :", Nb_item);
//let TotalItems = Nb_Cycle * Nb_item
let TotalItems = 175
if (combo2.value == "optionFOR" || combo2.value == "optionCoach" || combo.value == "optionIEBETAVR") {
TotalItems = 175
} else {
TotalItems = 250
}
console.log("TotalItems :", TotalItems);
const image1 = document.getElementById("IMG_Charcter_1");
const image2 = document.getElementById("IMG_Charcter_2");
const image3 = document.getElementById("IMG_Charcter_3");
const image4 = document.getElementById("IMG_Charcter_4");
const image5 = document.getElementById("IMG_Charcter_5");
const TeamText1 = document.getElementById("Team_Text_1");
const TeamText2 = document.getElementById("Team_Text_2");
const TeamText3 = document.getElementById("Team_Text_3");
const TeamText4 = document.getElementById("Team_Text_4");
const TeamText5 = document.getElementById("Team_Text_5");
const Name_Text_1 = document.getElementById("Name_Text_1");
const Name_Text_2 = document.getElementById("Name_Text_2");
const Name_Text_3 = document.getElementById("Name_Text_3");
const Name_Text_4 = document.getElementById("Name_Text_4");
const Name_Text_5 = document.getElementById("Name_Text_5");
// Création d'un objet principal
let team_template = {
bloc1: {
"image": image1,
"TeamText": TeamText1,
"Name_Text": Name_Text_1
},
bloc2: {
"image": image2,
"TeamText": TeamText2,
"Name_Text": Name_Text_2
},
bloc3: {
"image": image3,
"TeamText": TeamText3,
"Name_Text": Name_Text_3
},
bloc4: {
"image": image4,
"TeamText": TeamText4,
"Name_Text": Name_Text_4
},
bloc5: {
"image": image5,
"TeamText": TeamText5,
"Name_Text": Name_Text_5
}
};
if (Nb_item > 0){
afficherImagesAvecIntervalle(shuffledArray, 0, TotalItems, Nb_item, team_template, Team_directory)
} else {
team_template.bloc1.image.src = "Resource/character-placeholder.png";
team_template.bloc1.TeamText.innerText = "";
team_template.bloc1.Name_Text.innerText = "";
}
refresh_button.disabled = false;
buttonSelected1.disabled = false;
buttonSelected2.disabled = false;
buttonSelected3.disabled = false;
buttonSelected4.disabled = false;
buttonSelected5.disabled = false;
refresh_button.classList.remove("disabled-button");
buttonSelected1.classList.remove("disabled-button");
buttonSelected2.classList.remove("disabled-button");
buttonSelected3.classList.remove("disabled-button");
buttonSelected4.classList.remove("disabled-button");
buttonSelected5.classList.remove("disabled-button");
buttonSelected1.style.display = 'block';
buttonSelected2.style.display = 'block';
buttonSelected3.style.display = 'block';
buttonSelected4.style.display = 'block';
buttonSelected5.style.display = 'block';
});
function afficherImagesAvecIntervalle(shuffledArray, index, TotalItems, Nb_item, team_template, Team_directory) {
startButton.disabled = true;
buttonSelected1.disabled = true;
buttonSelected2.disabled = true;
buttonSelected3.disabled = true;
buttonSelected4.disabled = true;
buttonSelected5.disabled = true;
startButton.classList.add("disabled-button");
buttonSelected1.classList.add("disabled-button");
buttonSelected2.classList.add("disabled-button");
buttonSelected3.classList.add("disabled-button");
buttonSelected4.classList.add("disabled-button");
buttonSelected5.classList.add("disabled-button");
buttonSelected1.style.display = 'none';
buttonSelected2.style.display = 'none';
buttonSelected3.style.display = 'none';
buttonSelected4.style.display = 'none';
buttonSelected5.style.display = 'none';
if (index < TotalItems) {
// Affiche l'image actuelle
var image_path = shuffledArray[index % Nb_item].Path;
var Nom = shuffledArray[index % Nb_item].Nom;
var Genre = shuffledArray[index % Nb_item].Genre;
var Team_name = Team_directory[shuffledArray[index % Nb_item].Team];
if (combo2.value == "optionFOR" || combo2.value == "optionCoach" || combo.value == "optionIEBETAVR") {
nbr_image_display = 3
if (Nb_item == 2){
nbr_image_display = 2
}
if (Nb_item == 1){
nbr_image_display = 1
}
} else {
nbr_image_display = 5
if (Nb_item == 4){
nbr_image_display = 4
}
if (Nb_item == 3){
nbr_image_display = 3
}
if (Nb_item == 2){
nbr_image_display = 2
}
if (Nb_item == 1){
nbr_image_display = 1
}
}
if (index % nbr_image_display == 0) {
team_template.bloc1.image.src = image_path;
if (combo2.value == "optionFOR") {
team_template.bloc1.TeamText.innerText = shuffledArray[index % Nb_item].Placement;
} else {
team_template.bloc1.TeamText.innerText = Team_name;
}
if (combo2.value == "optionFOR" || combo2.value == "optionCoach") {
team_template.bloc1.Name_Text.innerText = Nom;
} else {
var name_genre = Nom + ' - ' + Genre;
team_template.bloc1.Name_Text.innerText = name_genre;
}
}
else if (index % nbr_image_display == 1) {
team_template.bloc2.image.src = image_path;
if (combo2.value == "optionFOR") {
team_template.bloc2.TeamText.innerText = shuffledArray[index % Nb_item].Placement;
} else {
team_template.bloc2.TeamText.innerText = Team_name;
}
if (combo2.value == "optionFOR" || combo2.value == "optionCoach") {
team_template.bloc2.Name_Text.innerText = Nom;
} else {
var name_genre = Nom + ' - ' + Genre;
team_template.bloc2.Name_Text.innerText = name_genre;
}
}
else if (index % nbr_image_display == 2) {
team_template.bloc3.image.src = image_path;
if (combo2.value == "optionFOR") {
team_template.bloc3.TeamText.innerText = shuffledArray[index % Nb_item].Placement;
} else {
team_template.bloc3.TeamText.innerText = Team_name;
}
if (combo2.value == "optionFOR" || combo2.value == "optionCoach") {
team_template.bloc3.Name_Text.innerText = Nom;
} else {
var name_genre = Nom + ' - ' + Genre;
team_template.bloc3.Name_Text.innerText = name_genre;
}
}
else if (index % nbr_image_display == 3) {
team_template.bloc4.image.src = image_path;
if (combo2.value == "optionFOR") {
team_template.bloc4.TeamText.innerText = shuffledArray[index % Nb_item].Placement;
} else {
team_template.bloc4.TeamText.innerText = Team_name;
}
if (combo2.value == "optionFOR" || combo2.value == "optionCoach") {
team_template.bloc4.Name_Text.innerText = Nom;
} else {
var name_genre = Nom + ' - ' + Genre;
team_template.bloc4.Name_Text.innerText = name_genre;
}
}
else {
team_template.bloc5.image.src = image_path;
if (combo2.value == "optionFOR") {
team_template.bloc5.TeamText.innerText = shuffledArray[index % Nb_item].Placement;
} else {
team_template.bloc5.TeamText.innerText = Team_name;
}
if (combo2.value == "optionFOR" || combo2.value == "optionCoach") {
team_template.bloc5.Name_Text.innerText = Nom;
} else {
var name_genre = Nom + ' - ' + Genre;
team_template.bloc5.Name_Text.innerText = name_genre;
}
};
if (Nb_item < 5){
team_template.bloc5.image.src = "Resource/character-placeholder.png";
team_template.bloc5.TeamText.innerText = "";
team_template.bloc5.Name_Text.innerText = "";
}
if (Nb_item < 4){
team_template.bloc4.image.src = "Resource/character-placeholder.png";
team_template.bloc4.TeamText.innerText = "";
team_template.bloc4.Name_Text.innerText = "";
}
if (Nb_item < 3){
team_template.bloc3.image.src = "Resource/character-placeholder.png";
team_template.bloc3.TeamText.innerText = "";
team_template.bloc3.Name_Text.innerText = "";
}
if (Nb_item < 2){
team_template.bloc2.image.src = "Resource/character-placeholder.png";
team_template.bloc2.TeamText.innerText = "";
team_template.bloc2.Name_Text.innerText = "";
}
let delay_ms = 3500 / TotalItems
// Attente de 100 ms avant de passer à l'image suivante
setTimeout(function () {
afficherImagesAvecIntervalle(shuffledArray, index + 1, TotalItems, Nb_item, team_template, Team_directory);
}, delay_ms);
} else {
shuffledArray[Object.keys(shuffledArray).length - nbr_image_display + 1]
if (nbr_image_display == 1) {
team_template.bloc1.image.src = shuffledArray[Object.keys(shuffledArray).length - nbr_image_display].Path;
if (combo2.value == "optionFOR" || combo2.value == "optionCoach") {
team_template.bloc1.Name_Text.innerText = shuffledArray[Object.keys(shuffledArray).length - nbr_image_display].Nom;
} else {
var name_genre = shuffledArray[Object.keys(shuffledArray).length - nbr_image_display].Nom + ' - ' + shuffledArray[Object.keys(shuffledArray).length-1].Genre;
team_template.bloc1.Name_Text.innerText = name_genre;
}
if (combo2.value == "optionFOR") {
team_template.bloc1.TeamText.innerText = shuffledArray[Object.keys(shuffledArray).length - nbr_image_display].Placement;
} else {
team_template.bloc1.TeamText.innerText = Team_directory[shuffledArray[Object.keys(shuffledArray).length - nbr_image_display].Team];
}
team_template.bloc2.image.src = "Resource/character-placeholder.png";
team_template.bloc3.image.src = "Resource/character-placeholder.png";
team_template.bloc4.image.src = "Resource/character-placeholder.png";
team_template.bloc5.image.src = "Resource/character-placeholder.png";
team_template.bloc2.TeamText.innerText = "";
team_template.bloc3.TeamText.innerText = "";
team_template.bloc4.TeamText.innerText = "";
team_template.bloc5.TeamText.innerText = "";
team_template.bloc2.Name_Text.innerText = "";
team_template.bloc3.Name_Text.innerText = "";
team_template.bloc4.Name_Text.innerText = "";
team_template.bloc5.Name_Text.innerText = "";
} else if (nbr_image_display == 2) {
team_template.bloc1.image.src = shuffledArray[Object.keys(shuffledArray).length - nbr_image_display].Path;
if (combo2.value == "optionFOR" || combo2.value == "optionCoach") {
team_template.bloc1.Name_Text.innerText = shuffledArray[Object.keys(shuffledArray).length - nbr_image_display].Nom;
} else {
var name_genre = shuffledArray[Object.keys(shuffledArray).length - nbr_image_display].Nom + ' - ' + shuffledArray[Object.keys(shuffledArray).length-2].Genre;
team_template.bloc1.Name_Text.innerText = name_genre;
}
if (combo2.value == "optionFOR") {
team_template.bloc1.TeamText.innerText = shuffledArray[Object.keys(shuffledArray).length - nbr_image_display].Placement;
} else {
team_template.bloc1.TeamText.innerText = Team_directory[shuffledArray[Object.keys(shuffledArray).length - nbr_image_display].Team];
}
team_template.bloc2.image.src = shuffledArray[Object.keys(shuffledArray).length - nbr_image_display + 1].Path;
if (combo2.value == "optionFOR" || combo2.value == "optionCoach") {
team_template.bloc2.Name_Text.innerText = shuffledArray[Object.keys(shuffledArray).length - nbr_image_display + 1].Nom;
} else {
var name_genre = shuffledArray[Object.keys(shuffledArray).length - nbr_image_display + 1].Nom + ' - ' + shuffledArray[Object.keys(shuffledArray).length-1].Genre;
team_template.bloc2.Name_Text.innerText = name_genre;
}
if (combo2.value == "optionFOR") {
team_template.bloc2.TeamText.innerText = shuffledArray[Object.keys(shuffledArray).length - nbr_image_display + 1].Placement;
} else {
team_template.bloc2.TeamText.innerText = Team_directory[shuffledArray[Object.keys(shuffledArray).length - nbr_image_display + 1].Team];
}
team_template.bloc3.image.src = "Resource/character-placeholder.png";
team_template.bloc4.image.src = "Resource/character-placeholder.png";
team_template.bloc5.image.src = "Resource/character-placeholder.png";
team_template.bloc3.TeamText.innerText = "";
team_template.bloc4.TeamText.innerText = "";
team_template.bloc5.TeamText.innerText = "";
team_template.bloc3.Name_Text.innerText = "";
team_template.bloc4.Name_Text.innerText = "";
team_template.bloc5.Name_Text.innerText = "";
} else if(nbr_image_display == 3) {
team_template.bloc1.image.src = shuffledArray[Object.keys(shuffledArray).length - nbr_image_display].Path;
if (combo2.value == "optionFOR" || combo2.value == "optionCoach") {
team_template.bloc1.Name_Text.innerText = shuffledArray[Object.keys(shuffledArray).length - nbr_image_display].Nom;
} else {
var name_genre = shuffledArray[Object.keys(shuffledArray).length - nbr_image_display].Nom + ' - ' + shuffledArray[Object.keys(shuffledArray).length - 3].Genre;
team_template.bloc1.Name_Text.innerText = name_genre;
}
if (combo2.value == "optionFOR") {
team_template.bloc1.TeamText.innerText = shuffledArray[Object.keys(shuffledArray).length - nbr_image_display].Placement;
} else {
team_template.bloc1.TeamText.innerText = Team_directory[shuffledArray[Object.keys(shuffledArray).length - nbr_image_display].Team];
}
team_template.bloc2.image.src = shuffledArray[Object.keys(shuffledArray).length - nbr_image_display + 1].Path;
if (combo2.value == "optionFOR" || combo2.value == "optionCoach") {
team_template.bloc2.Name_Text.innerText = shuffledArray[Object.keys(shuffledArray).length - nbr_image_display + 1].Nom;
} else {
var name_genre = shuffledArray[Object.keys(shuffledArray).length - nbr_image_display + 1].Nom + ' - ' + shuffledArray[Object.keys(shuffledArray).length - 2].Genre;
team_template.bloc2.Name_Text.innerText = name_genre;
}
if (combo2.value == "optionFOR") {
team_template.bloc2.TeamText.innerText = shuffledArray[Object.keys(shuffledArray).length - nbr_image_display + 1].Placement;
} else {
team_template.bloc2.TeamText.innerText = Team_directory[shuffledArray[Object.keys(shuffledArray).length - nbr_image_display + 1].Team];
}
team_template.bloc3.image.src = shuffledArray[Object.keys(shuffledArray).length - nbr_image_display + 2].Path;
if (combo2.value == "optionFOR" || combo2.value == "optionCoach") {
team_template.bloc3.Name_Text.innerText = shuffledArray[Object.keys(shuffledArray).length - nbr_image_display + 2].Nom;
} else {
var name_genre = shuffledArray[Object.keys(shuffledArray).length - nbr_image_display + 2].Nom + ' - '+ shuffledArray[Object.keys(shuffledArray).length-1].Genre;
team_template.bloc3.Name_Text.innerText = name_genre;
}
if (combo2.value == "optionFOR") {
team_template.bloc3.TeamText.innerText = shuffledArray[Object.keys(shuffledArray).length - nbr_image_display + 2].Placement;
} else {
team_template.bloc3.TeamText.innerText = Team_directory[shuffledArray[Object.keys(shuffledArray).length - nbr_image_display + 2].Team];
}
team_template.bloc4.image.src = "Resource/character-placeholder.png";
team_template.bloc5.image.src = "Resource/character-placeholder.png";
team_template.bloc4.TeamText.innerText = "";
team_template.bloc5.TeamText.innerText = "";
team_template.bloc4.Name_Text.innerText = "";
team_template.bloc5.Name_Text.innerText = "";
} else if(nbr_image_display == 4) {
team_template.bloc1.image.src = shuffledArray[Object.keys(shuffledArray).length - nbr_image_display].Path;
team_template.bloc1.TeamText.innerText = Team_directory[shuffledArray[Object.keys(shuffledArray).length - nbr_image_display].Team];
var name_genre = shuffledArray[Object.keys(shuffledArray).length - nbr_image_display].Nom + ' - ' + shuffledArray[Object.keys(shuffledArray).length - 4].Genre;
team_template.bloc1.Name_Text.innerText = name_genre;
team_template.bloc2.image.src = shuffledArray[Object.keys(shuffledArray).length - nbr_image_display + 1].Path;