-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
980 lines (853 loc) · 36.1 KB
/
index.html
File metadata and controls
980 lines (853 loc) · 36.1 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
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Google Docs Quiz</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&family=Google+Sans:wght@400;500&display=swap">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Roboto', 'Segoe UI', Arial, sans-serif;
background-color: #f8f9fa;
color: #202124;
line-height: 1.5;
min-height: 100vh;
display: flex;
flex-direction: column;
}
/* Header в стиле Google */
.header {
background-color: #fff;
border-bottom: 1px solid #dadce0;
padding: 8px 24px;
display: flex;
align-items: center;
justify-content: space-between;
box-shadow: 0 1px 2px 0 rgba(60,64,67,.1);
position: sticky;
top: 0;
z-index: 100;
}
.logo-container {
display: flex;
align-items: center;
gap: 12px;
}
.google-logo {
display: flex;
align-items: center;
gap: 8px;
font-size: 22px;
font-weight: 500;
color: #5f6368;
}
.google-logo .blue { color: #4285f4; }
.google-logo .red { color: #ea4335; }
.google-logo .yellow { color: #fbbc04; }
.google-logo .green { color: #34a853; }
.docs-icon {
color: #4285f4;
font-size: 24px;
}
.doc-title {
font-family: 'Google Sans', sans-serif;
font-size: 18px;
font-weight: 500;
color: #202124;
padding-left: 12px;
border-left: 1px solid #dadce0;
}
.header-actions {
display: flex;
align-items: center;
gap: 16px;
}
.header-btn {
background: none;
border: none;
color: #5f6368;
padding: 8px 12px;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
display: flex;
align-items: center;
gap: 6px;
transition: background-color 0.2s;
}
.header-btn:hover {
background-color: #f1f3f4;
}
.user-avatar {
width: 32px;
height: 32px;
border-radius: 50%;
background-color: #4285f4;
color: white;
display: flex;
align-items: center;
justify-content: center;
font-weight: 500;
}
/* Контейнер документа */
.doc-container {
flex: 1;
display: flex;
justify-content: center;
padding: 24px;
max-width: 900px;
margin: 0 auto;
width: 100%;
}
.doc-content {
background-color: white;
border-radius: 8px;
box-shadow: 0 1px 3px 0 rgba(60,64,67,.3), 0 4px 8px 3px rgba(60,64,67,.15);
width: 100%;
min-height: 500px;
padding: 48px 60px;
position: relative;
transition: all 0.3s ease;
}
/* Стили для экранов викторины */
.quiz-screen {
display: none;
}
.quiz-screen.active {
display: block;
animation: fadeIn 0.3s ease;
}
/* Стартовый экран */
.start-screen {
text-align: center;
padding: 40px 20px;
}
.start-icon {
font-size: 72px;
color: #4285f4;
margin-bottom: 24px;
opacity: 0.9;
}
.start-title {
font-family: 'Google Sans', sans-serif;
font-size: 32px;
font-weight: 500;
color: #202124;
margin-bottom: 16px;
}
.start-description {
color: #5f6368;
font-size: 16px;
max-width: 600px;
margin: 0 auto 40px;
line-height: 1.6;
}
.start-btn {
background-color: #1a73e8;
color: white;
border: none;
border-radius: 4px;
padding: 12px 24px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 8px;
transition: background-color 0.2s, box-shadow 0.2s;
box-shadow: 0 1px 3px 0 rgba(66,133,244,.3);
}
.start-btn:hover {
background-color: #0d62d9;
box-shadow: 0 2px 6px 0 rgba(66,133,244,.4);
}
/* Экран вопроса */
.question-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 32px;
padding-bottom: 16px;
border-bottom: 1px solid #e8eaed;
}
.quiz-title {
font-family: 'Google Sans', sans-serif;
font-size: 24px;
font-weight: 500;
color: #202124;
}
.question-counter {
color: #5f6368;
font-size: 14px;
background-color: #f1f3f4;
padding: 6px 12px;
border-radius: 16px;
}
.question-text {
font-size: 20px;
line-height: 1.6;
margin-bottom: 32px;
color: #202124;
padding-left: 8px;
}
.options-grid {
display: grid;
grid-template-columns: 1fr;
gap: 12px;
margin-bottom: 40px;
}
.option {
border: 1px solid #dadce0;
border-radius: 4px;
padding: 16px 20px;
cursor: pointer;
transition: all 0.2s ease;
display: flex;
align-items: center;
gap: 12px;
}
.option:hover {
background-color: #f8f9fa;
border-color: #c6c9ce;
}
.option.selected {
background-color: #e8f0fe;
border-color: #4285f4;
}
.option.correct {
background-color: #e6f4ea;
border-color: #34a853;
}
.option.incorrect {
background-color: #fce8e6;
border-color: #ea4335;
}
.option-letter {
width: 28px;
height: 28px;
border-radius: 50%;
background-color: #f1f3f4;
display: flex;
align-items: center;
justify-content: center;
font-weight: 500;
color: #5f6368;
flex-shrink: 0;
}
.option.selected .option-letter {
background-color: #4285f4;
color: white;
}
.option.correct .option-letter {
background-color: #34a853;
color: white;
}
.option.incorrect .option-letter {
background-color: #ea4335;
color: white;
}
.option-text {
font-size: 16px;
line-height: 1.5;
}
/* Панель навигации */
.nav-panel {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 40px;
padding-top: 20px;
border-top: 1px solid #e8eaed;
}
.progress-container {
flex: 1;
margin-right: 24px;
}
.progress-label {
font-size: 14px;
color: #5f6368;
margin-bottom: 4px;
}
.progress-bar {
height: 6px;
background-color: #f1f3f4;
border-radius: 3px;
overflow: hidden;
}
.progress-fill {
height: 100%;
background-color: #4285f4;
width: 0%;
border-radius: 3px;
transition: width 0.3s ease;
}
.nav-btn {
background-color: #f1f3f4;
color: #5f6368;
border: 1px solid #dadce0;
border-radius: 4px;
padding: 10px 24px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
display: flex;
align-items: center;
gap: 8px;
transition: all 0.2s;
}
.nav-btn:hover:not(:disabled) {
background-color: #e8eaed;
}
.nav-btn:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.nav-btn.primary {
background-color: #1a73e8;
color: white;
border-color: #1a73e8;
}
.nav-btn.primary:hover:not(:disabled) {
background-color: #0d62d9;
border-color: #0d62d9;
}
/* Экран результатов */
.result-screen {
text-align: center;
padding: 40px 20px;
}
.result-icon {
font-size: 64px;
color: #34a853;
margin-bottom: 24px;
}
.result-title {
font-family: 'Google Sans', sans-serif;
font-size: 28px;
font-weight: 500;
color: #202124;
margin-bottom: 16px;
}
.result-score {
font-size: 48px;
font-weight: 500;
color: #4285f4;
margin: 24px 0;
}
.result-message {
color: #5f6368;
font-size: 16px;
max-width: 600px;
margin: 0 auto 40px;
line-height: 1.6;
}
.result-details {
background-color: #f8f9fa;
border-radius: 8px;
padding: 24px;
margin: 32px 0;
text-align: left;
max-width: 600px;
margin-left: auto;
margin-right: auto;
}
.result-details h3 {
font-family: 'Google Sans', sans-serif;
font-size: 18px;
margin-bottom: 16px;
color: #202124;
}
.detail-item {
display: flex;
justify-content: space-between;
padding: 12px 0;
border-bottom: 1px solid #e8eaed;
}
.detail-item:last-child {
border-bottom: none;
}
.detail-label {
color: #5f6368;
}
.detail-value {
font-weight: 500;
color: #202124;
}
/* Футер в стиле Google */
.footer {
background-color: #fff;
border-top: 1px solid #dadce0;
padding: 16px 24px;
display: flex;
justify-content: space-between;
align-items: center;
color: #5f6368;
font-size: 12px;
margin-top: auto;
}
.footer-links {
display: flex;
gap: 24px;
}
.footer-link {
color: #5f6368;
text-decoration: none;
transition: color 0.2s;
}
.footer-link:hover {
color: #1a73e8;
text-decoration: underline;
}
/* Анимации */
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.05); }
100% { transform: scale(1); }
}
/* Адаптивность */
@media (max-width: 768px) {
.doc-content {
padding: 32px 24px;
}
.header {
padding: 8px 16px;
}
.doc-title {
font-size: 16px;
}
.start-title, .quiz-title, .result-title {
font-size: 24px;
}
.question-text {
font-size: 18px;
}
}
@media (max-width: 480px) {
.doc-content {
padding: 24px 16px;
}
.header-actions .btn-text {
display: none;
}
.nav-panel {
flex-direction: column;
gap: 16px;
align-items: stretch;
}
.progress-container {
margin-right: 0;
margin-bottom: 8px;
}
.nav-btn {
justify-content: center;
}
.footer {
flex-direction: column;
gap: 12px;
text-align: center;
}
.footer-links {
justify-content: center;
flex-wrap: wrap;
gap: 16px;
}
}
</style>
</head>
<body>
<!-- Шапка в стиле Google -->
<header class="header">
<div class="logo-container">
<div class="google-logo">
<span class="blue">G</span>
<span class="red">o</span>
<span class="yellow">o</span>
<span class="blue">g</span>
<span class="green">l</span>
<span class="red">e</span>
</div>
<div class="docs-icon">
<i class="far fa-file-alt"></i>
</div>
<div class="doc-title">Викторина: Искусственный интеллект</div>
</div>
<div class="header-actions">
<button class="header-btn">
<i class="far fa-star"></i>
<span class="btn-text">Добавить в избранное</span>
</button>
<button class="header-btn">
<i class="fas fa-share-alt"></i>
<span class="btn-text">Поделиться</span>
</button>
<div class="user-avatar">ИИ</div>
</div>
</header>
<!-- Основной контент -->
<main class="doc-container">
<div class="doc-content">
<!-- Стартовый экран -->
<div class="quiz-screen start-screen active" id="start-screen">
<div class="start-icon">
<i class="fas fa-brain"></i>
</div>
<h1 class="start-title">Викторина по искусственному интеллекту</h1>
<p class="start-description">
Проверьте свои знания о современных технологиях искусственного интеллекта,
машинного обучения и нейронных сетей. Викторина состоит из 8 вопросов с
вариантами ответов. После завершения вы получите детализированный отчет.
</p>
<button class="start-btn" id="start-btn">
<i class="fas fa-play"></i>
Начать викторину
</button>
</div>
<!-- Экран вопроса -->
<div class="quiz-screen question-screen" id="question-screen">
<div class="question-header">
<h2 class="quiz-title">Вопрос викторины</h2>
<div class="question-counter">
Вопрос <span id="current-question-num">1</span> из <span id="total-questions">8</span>
</div>
</div>
<div class="question-text" id="question-text">
Загрузка вопроса...
</div>
<div class="options-grid" id="options-container">
<!-- Варианты ответов будут вставлены сюда -->
</div>
<div class="nav-panel">
<div class="progress-container">
<div class="progress-label">Прогресс</div>
<div class="progress-bar">
<div class="progress-fill" id="progress-fill"></div>
</div>
</div>
<button class="nav-btn" id="prev-btn" disabled>
<i class="fas fa-arrow-left"></i>
Назад
</button>
<button class="nav-btn primary" id="next-btn" disabled>
Далее
<i class="fas fa-arrow-right"></i>
</button>
</div>
</div>
<!-- Экран результатов -->
<div class="quiz-screen result-screen" id="result-screen">
<div class="result-icon">
<i class="fas fa-chart-line"></i>
</div>
<h2 class="result-title">Результаты викторины</h2>
<div class="result-score" id="result-score">0/8</div>
<p class="result-message" id="result-message">
Загрузка результатов...
</p>
<div class="result-details">
<h3>Детализация ответов</h3>
<div id="result-details">
<!-- Детали результатов будут вставлены сюда -->
</div>
</div>
<button class="start-btn" id="restart-btn">
<i class="fas fa-redo"></i>
Пройти викторину снова
</button>
</div>
</div>
</main>
<!-- Футер в стиле Google -->
<footer class="footer">
<div class="footer-links">
<a href="#" class="footer-link">Условия использования</a>
<a href="#" class="footer-link">Конфиденциальность</a>
<a href="#" class="footer-link">Политика сайта</a>
<a href="#" class="footer-link">Справка</a>
</div>
<div class="footer-copyright">
Викторина создана с помощью Google Docs стиля
</div>
</footer>
<script>
// Вопросы для викторины
const quizQuestions = [
{
question: "Какая компания разработала модель GPT-4?",
options: [
"Google DeepMind",
"OpenAI",
"Microsoft Research",
"Meta AI"
],
correct: 1,
explanation: "GPT-4 был разработан компанией OpenAI и выпущен в марте 2023 года."
},
{
question: "Что такое 'нейронная сеть' в контексте машинного обучения?",
options: [
"Социальная сеть для ученых-исследователей",
"Модель, вдохновленная структурой человеческого мозга",
"Сеть соединенных между собой компьютеров",
"База данных для хранения информации о нейронах"
],
correct: 1,
explanation: "Нейронные сети — это вычислительные системы, вдохновленные биологическими нейронными сетями, которые составляют животный мозг."
},
{
question: "Какой тип машинного обучения использует размеченные данные?",
options: [
"Обучение с подкреплением",
"Обучение без учителя",
"Обучение с учителем",
"Глубокое обучение"
],
correct: 2,
explanation: "Обучение с учителем использует размеченные данные для обучения модели, где каждый пример имеет входные данные и соответствующий правильный выход."
},
{
question: "Что такое 'компьютерное зрение' в области ИИ?",
options: [
"Технология для улучшения качества изображений",
"Использование компьютеров для анализа и понимания визуальной информации",
"Создание виртуальной реальности",
"Технология распознавания текста на изображениях"
],
correct: 1,
explanation: "Компьютерное зрение — это область искусственного интеллекта, которая позволяет компьютерам интерпретировать и понимать визуальный мир."
},
{
question: "Что означает акроним 'LLM' в контексте ИИ?",
options: [
"Large Language Model (Большая языковая модель)",
"Long Learning Machine",
"Linguistic Logic Module",
"Layered Learning Model"
],
correct: 0,
explanation: "LLM расшифровывается как Large Language Model (Большая языковая модель) — тип нейросетей, способных генерировать и понимать человеческий язык."
},
{
question: "Какая технология лежит в основе самоуправляемых автомобилей?",
options: [
"Блокчейн",
"Дополненная реальность",
"Глубокое обучение и компьютерное зрение",
"Квантовые вычисления"
],
correct: 2,
explanation: "Самоуправляемые автомобили используют комбинацию глубокого обучения, компьютерного зрения и сенсоров для навигации и принятия решений."
},
{
question: "Что такое 'этичный ИИ'?",
options: [
"ИИ, который никогда не ошибается",
"Разработка и использование ИИ с учетом моральных принципов и ценностей",
"ИИ, который работает только в разрешенных странах",
"ИИ с открытым исходным кодом"
],
correct: 1,
explanation: "Этичный ИИ — это подход к разработке искусственного интеллекта, который учитывает моральные принципы, права человека и социальные ценности."
},
{
question: "Какая из этих моделей является генеративной?",
options: [
"Модель для классификации изображений",
"GPT (Generative Pre-trained Transformer)",
"Модель для обнаружения аномалий",
"Рекомендательная система"
],
correct: 1,
explanation: "GPT (Generative Pre-trained Transformer) — это генеративная модель, способная создавать новый текст, код и другой контент."
}
];
// Переменные состояния
let currentQuestionIndex = 0;
let score = 0;
let userAnswers = [];
let quizStarted = false;
// Элементы DOM
const startScreen = document.getElementById('start-screen');
const questionScreen = document.getElementById('question-screen');
const resultScreen = document.getElementById('result-screen');
const startBtn = document.getElementById('start-btn');
const prevBtn = document.getElementById('prev-btn');
const nextBtn = document.getElementById('next-btn');
const restartBtn = document.getElementById('restart-btn');
const questionText = document.getElementById('question-text');
const optionsContainer = document.getElementById('options-container');
const currentQuestionNum = document.getElementById('current-question-num');
const totalQuestions = document.getElementById('total-questions');
const progressFill = document.getElementById('progress-fill');
const resultScore = document.getElementById('result-score');
const resultMessage = document.getElementById('result-message');
const resultDetails = document.getElementById('result-details');
// Инициализация
totalQuestions.textContent = quizQuestions.length;
updateProgressBar();
// Обработчики событий
startBtn.addEventListener('click', startQuiz);
prevBtn.addEventListener('click', showPreviousQuestion);
nextBtn.addEventListener('click', showNextQuestion);
restartBtn.addEventListener('click', restartQuiz);
// Функция начала викторины
function startQuiz() {
quizStarted = true;
currentQuestionIndex = 0;
score = 0;
userAnswers = [];
// Переключение экранов
startScreen.classList.remove('active');
questionScreen.classList.add('active');
// Показать первый вопрос
showQuestion(currentQuestionIndex);
}
// Функция отображения вопроса
function showQuestion(index) {
const question = quizQuestions[index];
// Обновление счетчика
currentQuestionNum.textContent = index + 1;
// Обновление текста вопроса
questionText.textContent = question.question;
// Очистка контейнера опций
optionsContainer.innerHTML = '';
// Создание вариантов ответов
question.options.forEach((option, optionIndex) => {
const optionElement = document.createElement('div');
optionElement.className = 'option';
// Проверяем, был ли уже выбран этот вариант
if (userAnswers[index] === optionIndex) {
optionElement.classList.add('selected');
}
optionElement.innerHTML = `
<div class="option-letter">${String.fromCharCode(65 + optionIndex)}</div>
<div class="option-text">${option}</div>
`;
// Обработчик выбора
optionElement.addEventListener('click', () => selectOption(optionIndex));
optionsContainer.appendChild(optionElement);
});
// Обновление состояния кнопок
updateNavigationButtons();
// Обновление прогресс-бара
updateProgressBar();
}
// Функция выбора варианта ответа
function selectOption(optionIndex) {
// Удаляем класс selected у всех опций
const options = document.querySelectorAll('.option');
options.forEach(option => option.classList.remove('selected'));
// Добавляем класс selected к выбранной опции
options[optionIndex].classList.add('selected');
// Сохраняем ответ пользователя
userAnswers[currentQuestionIndex] = optionIndex;
// Включаем кнопку "Далее", если она была отключена
if (nextBtn.disabled) {
nextBtn.disabled = false;
}
}
// Функция перехода к предыдущему вопросу
function showPreviousQuestion() {
if (currentQuestionIndex > 0) {
currentQuestionIndex--;
showQuestion(currentQuestionIndex);
}
}
// Функция перехода к следующему вопросу
function showNextQuestion() {
// Проверяем, есть ли ответ на текущий вопрос
if (userAnswers[currentQuestionIndex] === undefined) {
return; // Не позволяем перейти дальше без ответа
}
// Если это последний вопрос, показываем результаты
if (currentQuestionIndex === quizQuestions.length - 1) {
calculateResults();
questionScreen.classList.remove('active');
resultScreen.classList.add('active');
} else {
currentQuestionIndex++;
showQuestion(currentQuestionIndex);
}
}
// Функция обновления состояния кнопок навигации
function updateNavigationButtons() {
// Кнопка "Назад"
prevBtn.disabled = currentQuestionIndex === 0;
// Кнопка "Далее"
const hasAnswer = userAnswers[currentQuestionIndex] !== undefined;
const isLastQuestion = currentQuestionIndex === quizQuestions.length - 1;
nextBtn.disabled = !hasAnswer;
nextBtn.innerHTML = isLastQuestion ?
'Завершить <i class="fas fa-check"></i>' :
'Далее <i class="fas fa-arrow-right"></i>';
}
// Функция обновления прогресс-бара
function updateProgressBar() {
const progress = ((currentQuestionIndex + 1) / quizQuestions.length) * 100;
progressFill.style.width = `${progress}%`;
}
// Функция расчета результатов
function calculateResults() {
score = 0;
// Проверяем каждый ответ
for (let i = 0; i < quizQuestions.length; i++) {
if (userAnswers[i] === quizQuestions[i].correct) {
score++;
}
}
// Обновляем счет
resultScore.textContent = `${score}/${quizQuestions.length}`;
// Устанавливаем сообщение в зависимости от результата
const percentage = (score / quizQuestions.length) * 100;
let message = '';
if (percentage >= 90) {
message = 'Превосходно! Вы эксперт в области искусственного интеллекта!';
} else if (percentage >= 70) {
message = 'Отличный результат! У вас глубокие знания в области ИИ.';
} else if (percentage >= 50) {
message = 'Хороший результат! Вы хорошо разбираетесь в основах ИИ.';
} else {
message = 'Попробуйте еще раз! Рекомендуем изучить больше материалов по искусственному интеллекту.';
}
resultMessage.textContent = message;
// Создаем детализацию ответов
resultDetails.innerHTML = '';
quizQuestions.forEach((question, index) => {
const detailItem = document.createElement('div');
detailItem.className = 'detail-item';
const userAnswer = userAnswers[index];
const isCorrect = userAnswer === question.correct;
detailItem.innerHTML = `
<div class="detail-label">Вопрос ${index + 1}: ${isCorrect ? '✅' : '❌'}</div>
<div class="detail-value">${isCorrect ? 'Верно' : 'Неверно'}</div>
`;
resultDetails.appendChild(detailItem);
});
}
// Функция перезапуска викторины
function restartQuiz() {
resultScreen.classList.remove('active');
startScreen.classList.add('active');
// Анимация для кнопки "Начать викторину"
startBtn.style.animation = 'pulse 1s';
setTimeout(() => {
startBtn.style.animation = '';
}, 1000);
}
// Инициализация при загрузке страницы
document.addEventListener('DOMContentLoaded', () => {
// Устанавливаем общее количество вопросов
totalQuestions.textContent = quizQuestions.length;
});
</script>
</body>
</html>