-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkolega.js
32 lines (29 loc) · 963 Bytes
/
kolega.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
function getRandomColor() {
var letters = '0123456789ABCDEF';
var color = '#';
for (var i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
}
const els = document.querySelectorAll("body *");
const colorInterval = setInterval(() => {
//let prvek = els[Math.floor(Math.random() * els.length)];
//prvek.style = 'background-color:' + getRandomColor();
//console.log('color', prvek);
}, 1);
const interval = setInterval(() => {
const prvky = document.querySelectorAll("body *");
if (!prvky.length) {
clearInterval(interval);
clearInterval(colorInterval);
const body = document.querySelectorAll("body")[0];
body.className = 'warning';
setTimeout(function () {
body.className = 'blinking';
}, 3000);
}
let prvek = prvky[Math.floor(Math.random() * prvky.length)];
console.log(prvek);
prvek.remove();
}, 100);