-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
62 lines (54 loc) · 2.41 KB
/
script.js
File metadata and controls
62 lines (54 loc) · 2.41 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
const stories = [
"Юсифов пытался подкупить Гасана жвачкой Love is.",
"Юсиф 2 пропустил гол, потому что завязывал шнурки на перчатках.",
"Намиг случайно уехал на автобусе другой команды.",
"Али Талибов пришел на матч в ластах для плавания."
];
// Переключение вкладок
function showSection(id) {
document.querySelectorAll('.content-section').forEach(s => s.classList.remove('active'));
document.getElementById(id).classList.add('active');
}
// Работа генератора историй
document.getElementById('next-story').addEventListener('click', () => {
const story = stories[Math.floor(Math.random() * stories.length)];
document.getElementById('story-container').innerHTML = `<p class="blink">${story}</p>`;
incrementScore(100);
});
// Работа чата
function sendMessage() {
const input = document.getElementById('user-input');
const box = document.getElementById('chat-box');
if (input.value.trim() !== "") {
// Твое сообщение
box.innerHTML += `<div class="msg"><span style="color:white">Юсиф (Ты):</span> ${input.value}</div>`;
// Авто-ответ бота через 1 сек
setTimeout(() => {
const replies = ["Что?", "Опять проиграли?", "Гасан идет!", "Где мои пельмени?"];
const reply = replies[Math.floor(Math.random() * replies.length)];
box.innerHTML += `<div class="msg"><span style="color:gold">Гасан (Admin):</span> ${reply}</div>`;
box.scrollTop = box.scrollHeight;
}, 1000);
input.value = "";
box.scrollTop = box.scrollHeight;
}
}
// Позор-метр
let score = 0;
function incrementScore(val) {
score += val;
document.getElementById('global-score').innerText = score;
}
// Фоновая бумага
setInterval(() => {
const p = document.createElement('div');
p.innerText = '🧻';
p.style.position = 'fixed';
p.style.left = Math.random() * 100 + 'vw';
p.style.top = '-50px';
p.style.zIndex = '0';
p.style.transition = '5s linear';
document.body.appendChild(p);
setTimeout(() => p.style.top = '110vh', 100);
setTimeout(() => p.remove(), 6000);
}, 2000);