forked from CsokiHUN/fivem-loading
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
58 lines (49 loc) · 1.82 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
<!DOCTYPE html>
<html lang="hu">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Loading Screen by Csoki</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<video id="video" autoplay muted loop>
<source src="assets/video.mp4" type="video/mp4" />
Your Browser does not support the video element
</video>
<audio
src="assets/music.mp3"
type="audio/mp3"
autoplay="true"
looped="true"
></audio>
<div class="loadbar"><div class="thingy"></div></div>
<script type="text/javascript">
let count = 0;
let thisCount = 0;
const handlers = {
startInitFunctionOrder(data) {
count = data.count;
},
initFunctionInvoking(data) {
document.querySelector('.thingy').style.left = '0%';
document.querySelector('.thingy').style.width =
(data.idx / count) * 100 + '%';
},
startDataFileEntries(data) {
count = data.count;
},
performMapLoadFunction(data) {
++thisCount;
document.querySelector('.thingy').style.left = '0%';
document.querySelector('.thingy').style.width =
(thisCount / count) * 100 + '%';
},
};
window.addEventListener('message', function (e) {
(handlers[e.data.eventName] || function () {})(e.data);
});
</script>
</body>
</html>