-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
137 lines (124 loc) · 3.96 KB
/
index.html
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
<html>
<head>
<meta charset="UTF-8">
<title>
Рома, не шатай лодку!
</title>
<style>
body {
background: black;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
min-height: 100vh;
}
button{
border: none;
color: white;
margin: 5px;
padding: 14px 28px;
cursor: pointer;
background-color: #f44336;
margin: 5px;
}
button:hover{
border: none;
background: #da190b;
animation: shake 0.5s;
animation-iteration-count: infinite;
}
img{
max-height: 200px;
}
.main{
margin-left: auto;
margin-right: auto;
float: left;
max-width: 100%;
justify-content: center
}
.forBtn{
padding: 5px;
}
.hidden {
display: none;
}
.roma {
padding: 5px;
}
.roma:hover{
filter: brightness(60%) contrast(200%) invert(210%) hue-rotate(140deg);
}
@keyframes shake {
0% { transform: translate(1px, 1px) rotate(0deg); }
10% { transform: translate(-1px, -2px) rotate(-1deg); }
20% { transform: translate(-3px, 0px) rotate(1deg); }
30% { transform: translate(3px, 2px) rotate(0deg); }
40% { transform: translate(1px, -1px) rotate(1deg); }
50% { transform: translate(-1px, 2px) rotate(-1deg); }
60% { transform: translate(-3px, 1px) rotate(0deg); }
70% { transform: translate(3px, 1px) rotate(-1deg); }
80% { transform: translate(-1px, -1px) rotate(1deg); }
90% { transform: translate(1px, 2px) rotate(0deg); }
100% { transform: translate(1px, -2px) rotate(-1deg); }
}
</style>
</head>
<body>
<div id="main" class="main forBtn">
<img src="kek.png" alt="roma" class="roma">
<span id="imgContainer">
<img src="good-boy.jpeg" alt="doggo" id="goodImg" class="hidden">
</span>
</div>
<script>
console.log("%cRoma, we love you! 💖 TTTeam", "color: lightcoral; font-size: x-large")
const sadImagesThatMakeYouThink = ['slonik.jpg', 'ruki.jpg', 'koteika.jpg', 'water.gif', 'doggo.jpg', '1.jpg', '2.png', '3.png', '4.png', '5.png', '6-2.png', '7.png', '8.png', '9.png', '10.png', '11.png', '12.png', '13.png', '14.png', '15.png', '16.png', '17.png', '18.png', '19.png', '20.png', '21.png']
const imgContainer = document.getElementById('imgContainer');
sadImagesThatMakeYouThink.forEach((imgUrl) => {
const img = document.createElement('img');
img.className = 'hidden sad'
imgContainer.prepend(img);
img.src = imgUrl
})
const allImagesInImgContainer = imgContainer.querySelectorAll('img')
const sadImagesInImgContainer = imgContainer.querySelectorAll('img.sad')
const hideAllImages = () => {
allImagesInImgContainer.forEach(img => img.classList.add('hidden'))
}
let previousRand
const setRandomImage = () => {
const maxRand = previousRand === undefined
? sadImagesThatMakeYouThink.length
: sadImagesThatMakeYouThink.length - 1
const rand = Math.floor(Math.random() * maxRand)
const noRepeatRand = rand >= previousRand ? rand + 1 : rand
hideAllImages()
sadImagesInImgContainer[noRepeatRand].classList.remove('hidden')
previousRand = noRepeatRand
}
setRandomImage()
const btn = document.createElement('button');
btn.addEventListener('click', function() {
setRandomImage()
}, false);
btn.textContent = 'Шатать';
const goodImg = document.getElementById('goodImg')
const btnCool = document.createElement('button');
btnCool.addEventListener('click', function() {
hideAllImages()
goodImg.classList.remove('hidden')
}, false);
btnCool.textContent = 'Рома хороший';
const div1 = document.getElementById('main');
const div2 = document.createElement('div');
div2.appendChild(btn);
div2.appendChild(btnCool);
document.body.appendChild(div1);
document.body.appendChild(div2);
console.log('made with love (c) TTTeam')
</script>
</body>
</html>