-
Notifications
You must be signed in to change notification settings - Fork 4
/
splash.js
63 lines (41 loc) · 1.18 KB
/
splash.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
var splashCacheAll;
var splashCache;
async function randomSay() {
if (splashCache) {
if (!splashCache.length) {
splashCache = splashCacheAll;
}
var says = splashCache;
} else {
var say = await fetch("./splashes.json");
var says = await say.json();
splashCacheAll = says;
splashCache = says;
}
var getRandomSay = says[Math.floor(Math.random() * says.length)];
splashCache = splashCache.filter((splash) => splash !== getRandomSay);
return getRandomSay;
}
async function setRandomSay() {
var randomSplash = await randomSay();
if (randomSplash == "%REAL_IP%") {
var ips = await getIPs();
if (ips[0]) {
randomSplash = "Your real IP is " + ips[0];
} else {
randomSplash = "Cannot get your real IP :(";
}
}
else if (randomSplash == "%SPLASH_NUMBER%") {
randomSplash = "There are " + splashCacheAll.length + " of these messages!";
}
document.querySelector(".splash").innerText = randomSplash;
if(randomSplash.length > 20){
$(".splash").addClass("bigtext");
}else if (randomSplash.length < 7){
$(".splash").addClass("smalltext");
}
}
if (document.querySelector(".splash")) {
setRandomSay();
}