-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
553 lines (473 loc) · 20.4 KB
/
index.html
File metadata and controls
553 lines (473 loc) · 20.4 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
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Кто ты из Смешариков?</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
padding: 20px;
}
.container {
max-width: 600px;
width: 100%;
}
.quiz-card {
background: white;
border-radius: 25px;
padding: 40px;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
h1 {
text-align: center;
color: #667eea;
font-size: 2.2em;
margin-bottom: 10px;
}
.subtitle {
text-align: center;
color: #666;
margin-bottom: 30px;
font-size: 1.1em;
}
.question-container {
margin-bottom: 30px;
display: none;
}
.question-container.active {
display: block;
animation: fadeIn 0.5s ease;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.question-number {
color: #667eea;
font-weight: bold;
font-size: 0.9em;
margin-bottom: 10px;
}
.question-text {
font-size: 1.3em;
color: #333;
margin-bottom: 20px;
font-weight: 600;
}
.options {
display: flex;
flex-direction: column;
gap: 12px;
}
.option {
background: #f8f9fa;
padding: 15px 20px;
border-radius: 12px;
cursor: pointer;
transition: all 0.3s ease;
border: 2px solid transparent;
display: flex;
align-items: center;
gap: 12px;
}
.option:hover {
background: #e9ecef;
transform: translateX(5px);
}
.option.selected {
background: #667eea;
color: white;
border-color: #667eea;
}
.option-emoji {
font-size: 1.5em;
}
.option-text {
flex: 1;
}
.buttons {
display: flex;
gap: 15px;
margin-top: 30px;
}
.btn {
flex: 1;
padding: 15px 30px;
border: none;
border-radius: 12px;
font-size: 1em;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
}
.btn-next {
background: #667eea;
color: white;
}
.btn-next:hover:not(:disabled) {
background: #5568d3;
transform: translateY(-2px);
}
.btn-next:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.btn-back {
background: #e9ecef;
color: #333;
}
.btn-back:hover {
background: #dee2e6;
}
.progress-bar {
width: 100%;
height: 8px;
background: #e9ecef;
border-radius: 10px;
margin-bottom: 30px;
overflow: hidden;
}
.progress-fill {
height: 100%;
background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
width: 0%;
transition: width 0.3s ease;
}
.result-container {
display: none;
text-align: center;
}
.result-container.active {
display: block;
animation: fadeIn 0.5s ease;
}
.result-emoji {
font-size: 5em;
margin-bottom: 20px;
}
.result-character {
font-size: 2em;
color: #667eea;
font-weight: bold;
margin-bottom: 15px;
}
.result-description {
color: #666;
line-height: 1.8;
margin-bottom: 20px;
font-size: 1.1em;
}
.result-traits {
background: #f8f9fa;
padding: 20px;
border-radius: 12px;
margin-bottom: 25px;
}
.result-traits h3 {
color: #667eea;
margin-bottom: 15px;
}
.trait {
display: inline-block;
background: white;
padding: 8px 15px;
border-radius: 20px;
margin: 5px;
color: #667eea;
font-weight: 600;
}
.btn-restart {
background: #667eea;
color: white;
padding: 15px 40px;
border: none;
border-radius: 12px;
font-size: 1em;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
}
.btn-restart:hover {
background: #5568d3;
transform: scale(1.05);
}
@media (max-width: 768px) {
.quiz-card {
padding: 25px;
}
h1 {
font-size: 1.8em;
}
.question-text {
font-size: 1.1em;
}
}
</style>
</head>
<body>
<div class="container">
<div class="quiz-card">
<h1>🎨 Кто ты из Смешариков?</h1>
<p class="subtitle">Ответь на 3 вопроса и узнай!</p>
<div class="progress-bar">
<div class="progress-fill" id="progress"></div>
</div>
<!-- Вопрос 1 -->
<div class="question-container active" data-question="1">
<div class="question-number">Вопрос 1 из 3</div>
<div class="question-text">Как ты проводишь выходные?</div>
<div class="options">
<div class="option" data-answer="krosh">
<span class="option-emoji">🐰</span>
<span class="option-text">Активно! Прыгаю, бегаю, ищу приключения</span>
</div>
<div class="option" data-answer="ezhik">
<span class="option-emoji">🦔</span>
<span class="option-text">Читаю книги и размышляю о жизни</span>
</div>
<div class="option" data-answer="losyash">
<span class="option-emoji">🦌</span>
<span class="option-text">Изучаю что-то новое или провожу эксперименты</span>
</div>
<div class="option" data-answer="nyusha">
<span class="option-emoji">🐷</span>
<span class="option-text">Занимаюсь творчеством и ухаживаю за собой</span>
</div>
</div>
</div>
<!-- Вопрос 2 -->
<div class="question-container" data-question="2">
<div class="question-number">Вопрос 2 из 3</div>
<div class="question-text">Что для тебя важнее всего в команде?</div>
<div class="options">
<div class="option" data-answer="krosh">
<span class="option-emoji">⚡</span>
<span class="option-text">Энергия и позитивный настрой</span>
</div>
<div class="option" data-answer="ezhik">
<span class="option-emoji">🤝</span>
<span class="option-text">Взаимопонимание и поддержка</span>
</div>
<div class="option" data-answer="losyash">
<span class="option-emoji">🧠</span>
<span class="option-text">Обмен знаниями и интеллектуальный рост</span>
</div>
<div class="option" data-answer="nyusha">
<span class="option-emoji">✨</span>
<span class="option-text">Креативность и красота процесса</span>
</div>
</div>
</div>
<!-- Вопрос 3 -->
<div class="question-container" data-question="3">
<div class="question-number">Вопрос 3 из 3</div>
<div class="question-text">Как ты решаешь проблемы?</div>
<div class="options">
<div class="option" data-answer="krosh">
<span class="option-emoji">🚀</span>
<span class="option-text">Действую быстро и решительно!</span>
</div>
<div class="option" data-answer="ezhik">
<span class="option-emoji">💭</span>
<span class="option-text">Обдумываю все варианты и советуюсь с друзьями</span>
</div>
<div class="option" data-answer="losyash">
<span class="option-emoji">🔬</span>
<span class="option-text">Анализирую и применяю научный подход</span>
</div>
<div class="option" data-answer="nyusha">
<span class="option-emoji">🎨</span>
<span class="option-text">Ищу нестандартное креативное решение</span>
</div>
</div>
</div>
<!-- Результат -->
<div class="result-container">
<div class="result-emoji" id="result-emoji"></div>
<div class="result-character" id="result-character"></div>
<div class="result-description" id="result-description"></div>
<div class="result-traits">
<h3>Твои качества:</h3>
<div id="result-traits"></div>
</div>
<button class="btn-restart" onclick="restartQuiz()">Пройти ещё раз</button>
</div>
<!-- Кнопки навигации -->
<div class="buttons" id="navigation">
<button class="btn btn-back" id="btn-back" onclick="prevQuestion()" style="display: none;">
Назад
</button>
<button class="btn btn-next" id="btn-next" onclick="nextQuestion()" disabled>
Далее
</button>
</div>
</div>
</div>
<script>
let currentQuestion = 1;
const totalQuestions = 3;
const answers = {};
const characters = {
krosh: {
emoji: '🐰',
name: 'Крош',
description: 'Ты такой же энергичный и оптимистичный, как Крош! Всегда в движении, любишь приключения и заряжаешь окружающих своей позитивной энергией. Ты не боишься пробовать новое и умеешь радоваться каждому дню!',
traits: ['Активный', 'Оптимист', 'Дружелюбный', 'Импульсивный', 'Весёлый']
},
ezhik: {
emoji: '🦔',
name: 'Ёжик',
description: 'Ты вдумчивый и чуткий, как Ёжик! Ценишь глубокие отношения, любишь размышлять и всегда готов прийти на помощь друзьям. Твоя внимательность и забота делают мир вокруг лучше.',
traits: ['Вдумчивый', 'Надёжный', 'Эмпатичный', 'Осторожный', 'Верный друг']
},
losyash: {
emoji: '🦌',
name: 'Лосяш',
description: 'Ты умный и любознательный, как Лосяш! Обожаешь учиться новому, разбираться в сложных вещах и делиться знаниями с другими. Твой аналитический ум помогает решать самые трудные задачи!',
traits: ['Умный', 'Любознательный', 'Аналитик', 'Изобретатель', 'Эрудит']
},
nyusha: {
emoji: '🐷',
name: 'Нюша',
description: 'Ты креативная и харизматичная, как Нюша! Ценишь красоту во всём, любишь творчество и умеешь вдохновлять других. Твоя уникальность и стиль делают тебя особенным!',
traits: ['Креативная', 'Артистичная', 'Стильная', 'Романтичная', 'Мечтательная']
}
};
// Обработка выбора опции
document.querySelectorAll('.option').forEach(option => {
option.addEventListener('click', function () {
const container = this.closest('.question-container');
const question = container.dataset.question;
// Снимаем выделение со всех опций в текущем вопросе
container.querySelectorAll('.option').forEach(opt => {
opt.classList.remove('selected');
});
// Выделяем выбранную опцию
this.classList.add('selected');
// Сохраняем ответ
answers[question] = this.dataset.answer;
// Активируем кнопку "Далее"
document.getElementById('btn-next').disabled = false;
});
});
function updateProgress() {
const progress = ((currentQuestion - 1) / totalQuestions) * 100;
document.getElementById('progress').style.width = progress + '%';
}
function nextQuestion() {
if (!answers[currentQuestion]) return;
if (currentQuestion < totalQuestions) {
// Переход к следующему вопросу
document.querySelector(`[data-question="${currentQuestion}"]`).classList.remove('active');
currentQuestion++;
document.querySelector(`[data-question="${currentQuestion}"]`).classList.add('active');
// Проверяем, есть ли уже ответ на новый вопрос
const hasAnswer = answers[currentQuestion];
document.getElementById('btn-next').disabled = !hasAnswer;
// Показываем кнопку "Назад"
document.getElementById('btn-back').style.display = 'block';
// Меняем текст кнопки на последнем вопросе
if (currentQuestion === totalQuestions) {
document.getElementById('btn-next').textContent = 'Узнать результат';
}
updateProgress();
} else {
// Показываем результат
showResult();
}
}
function prevQuestion() {
if (currentQuestion > 1) {
document.querySelector(`[data-question="${currentQuestion}"]`).classList.remove('active');
currentQuestion--;
document.querySelector(`[data-question="${currentQuestion}"]`).classList.add('active');
// Проверяем, есть ли ответ на текущий вопрос
const hasAnswer = answers[currentQuestion];
document.getElementById('btn-next').disabled = !hasAnswer;
document.getElementById('btn-next').textContent = 'Далее';
if (currentQuestion === 1) {
document.getElementById('btn-back').style.display = 'none';
}
updateProgress();
}
}
function showResult() {
// Подсчитываем результаты
const counts = {};
Object.values(answers).forEach(answer => {
counts[answer] = (counts[answer] || 0) + 1;
});
// Находим персонажа с наибольшим количеством ответов
let maxCount = 0;
let resultCharacter = 'krosh';
Object.entries(counts).forEach(([character, count]) => {
if (count > maxCount) {
maxCount = count;
resultCharacter = character;
}
});
// Если равное количество ответов, выбираем первого по порядку
if (maxCount === 1) {
const order = ['krosh', 'ezhik', 'losyash', 'nyusha'];
for (let char of order) {
if (counts[char]) {
resultCharacter = char;
break;
}
}
}
const result = characters[resultCharacter];
// Отображаем результат
document.getElementById('result-emoji').textContent = result.emoji;
document.getElementById('result-character').textContent = result.name;
document.getElementById('result-description').textContent = result.description;
const traitsHtml = result.traits.map(trait => `<span class="trait">${trait}</span>`).join('');
document.getElementById('result-traits').innerHTML = traitsHtml;
// Скрываем вопросы и показываем результат
document.querySelector(`[data-question="${currentQuestion}"]`).classList.remove('active');
document.getElementById('navigation').style.display = 'none';
document.querySelector('.result-container').classList.add('active');
// Обновляем прогресс до 100%
document.getElementById('progress').style.width = '100%';
}
function restartQuiz() {
// Сбрасываем все данные
currentQuestion = 1;
Object.keys(answers).forEach(key => delete answers[key]);
// Сбрасываем выбор опций
document.querySelectorAll('.option').forEach(opt => {
opt.classList.remove('selected');
});
// Скрываем результат и показываем первый вопрос
document.querySelector('.result-container').classList.remove('active');
document.querySelector(`[data-question="1"]`).classList.add('active');
// Сбрасываем кнопки
document.getElementById('navigation').style.display = 'flex';
document.getElementById('btn-back').style.display = 'none';
document.getElementById('btn-next').textContent = 'Далее';
document.getElementById('btn-next').disabled = true;
// Сбрасываем прогресс
updateProgress();
}
// Инициализация
updateProgress();
</script>
</body>
</html>