-
Notifications
You must be signed in to change notification settings - Fork 25
/
app.js
87 lines (69 loc) · 3.13 KB
/
app.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
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
/* Need Help? Join my discord @ discord.gg/yWddFpQ */
// And yes... I know this is __very__ messy.
/* Uncomment for PLAIN TEXT (also uncomment title in index) document.getElementById('title').innerHTML = config.text.title; */
document.getElementById('link').innerHTML = config.text.link;
var audio = `<div data-video=${config.videoID} data-autoplay="1" data-loop="1" id="youtube-audio"> </div>`;
if (config.music === true) {
$("body").append(audio);
}
$(function () {
var llllll = config.images.forEach(appen)
function appen(i) {
document.getElementById("bg").innerHTML= document.getElementById("bg").innerHTML + `<img width="100%"height="100%" src=imgs/${i}>`;
}
function random(pp) {
return Math.floor(Math.random() * pp);
}
var img = $('div#bg img');
var len = img.length;
var current = random(len);
img.hide();
img.eq(current).show();
var x = setInterval(function () {
img.eq(current).fadeOut(config.transitionInterval, function () {
current = random(len);
img.eq(current).fadeIn(config.transitionInterval);
});
}, 2 * config.transitionInterval + config.imgInterval);
})
/* forked from https://cdn.rawgit.com/labnol/files/master/yt.js */
function onYouTubeIframeAPIReady() {
var e = document.getElementById("youtube-audio"),
t = document.createElement(null);
e.appendChild(t); var a = document.createElement("div");
a.setAttribute("id", "youtube-player"), e.appendChild(a);
var o = function (e) {
t.setAttribute("src", "https://i.imgur.com/" + a) };
e.onclick = function () { r.getPlayerState() === YT.PlayerState.PLAYING || r.getPlayerState() === YT.PlayerState.BUFFERING ? (r.pauseVideo(), o(!1)) : (r.playVideo(), o(!0)) }; var r = new YT.Player("youtube-player", { height: "0", width: "0", videoId: e.dataset.video, playerVars: { autoplay: e.dataset.autoplay, loop: e.dataset.loop }, events: { onReady: function (e) { r.setPlaybackQuality("small"), r.setVolume(config.musicVolume)
o(r.getPlayerState() !== YT.PlayerState.CUED) },
onStateChange: function (e) { e.data === YT.PlayerState.ENDED && o(!1) } } })
}
// From cfx-keks
var count = 0;
var thisCount = 0;
const handlers = {
startInitFunctionOrder(data) {
count = data.count;
document.querySelector('.letni h3').innerHTML += [data.type][data.order - 1] || '';
},
initFunctionInvoking(data) {
document.querySelector('.yeet').style.left = '0%';
document.querySelector('.yeet').style.width = ((data.idx / count) * 100) + '%';
},
startDataFileEntries(data) {
count = data.count;
document.querySelector('.letni h3').innerHTML += "\u{1f358}";
},
performMapLoadFunction(data) {
++thisCount;
document.querySelector('.yeet').style.left = '0%';
document.querySelector('.yeet').style.width = ((thisCount / count) * 100) + '%';
},
onLogLine(data) {
document.querySelector('.letni p').innerHTML = data.message + "..!";
}
};
window.addEventListener('message', function (e) {
(handlers[e.data.eventName] || function () { })(e.data);
});
/////////////////////////////////////////////