-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflow.js
More file actions
42 lines (36 loc) · 974 Bytes
/
flow.js
File metadata and controls
42 lines (36 loc) · 974 Bytes
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
var loaded = false;
var fill = false;
var data = getData();
window.onload = function()
{
let days = getDate(totalDays, -1, true);
let today = days[totalDays];
days.push(getDate(1)[0]);
data.data.labels = days;
fetch("https://bolo-cors.herokuapp.com/https://discorddb.000webhostapp.com/get?k=&e=json&f=serverActivity").then((d) => d.json()).then((d) => {
let flow = [ [ ], [ ] ];
for (let i = 0; i <= totalDays; i++)
for (let j = 0; j < 2; j++)
flow[j].push((d[days[i]] && d[days[i]].m) ? d[days[i]].m[j] : 0);
data.data.datasets = [
{
label: "Joined",
backgroundColor: hexToRGBA("#718BD8"),
borderColor: "#718BD8",
data: flow[0]
},
{
label: "Left",
backgroundColor: hexToRGBA("#DD4546"),
borderColor: "#DD4546",
data: flow[1]
}
];
loaded = create();
});
}
window.onkeypress = function(k){
if (!loaded) return;
if (k.keyCode == 32)
create(fill = !fill);
}