-
Notifications
You must be signed in to change notification settings - Fork 0
/
leaderboard.js
88 lines (61 loc) · 1.72 KB
/
leaderboard.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
88
let leaderboard;
var scrollingDown = true;
var intervalId;
var scrollDistance = 1;
var refreshMultiplier = 1;
var Height = document.documentElement.scrollHeight;
var currentHeight = 0;
var bool = true;
var step = 2;
var speed = 80;
var interval = setInterval(scrollpage, speed)
function scrollpage() {
if (currentHeight < 0 || currentHeight > Height)
bool = !bool;
if (bool) {
window.scrollTo(0, currentHeight += step);
} else {
window.scrollTo(0, currentHeight -= step);
}
console.log(currentHeight);
}
var loadinterval = setInterval(() => {
location.reload();
}, (120000));
window.onload = async () => {
leaderboard = document.getElementById("leaderboard");
Object.keys(localStorage).forEach(function(key){
addUser(localStorage.getItem(key),key);
});
refreshMultiplier = Object.keys
};
function addUser(userInfo,name)
{
const tr = document.createElement("tr");
tr.id = name;
leaderboard.appendChild(tr);
addText(name,tr);
const data = userInfo.split(';');
addImage(data[0] + ";" + data[1],tr);
addText(data[2],tr);
addImage(data[3] + ";" + data[4],tr);
addText(data[5],tr);
addImage(data[6] + ";" + data[7],tr);
addText(data[8],tr);
addText(data[9],tr);
}
function addImage(imageData,tr)
{
const image = document.createElement("img");
const td = document.createElement("td");
image.src = imageData;
image.className = "leaderboardImage";
td.appendChild(image);
tr.appendChild(td);
}
function addText(textData,tr)
{
const td = document.createElement("td");
td.innerHTML = textData;
tr.appendChild(td);
}