-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-leaderboard Script.js
42 lines (32 loc) · 1.24 KB
/
update-leaderboard Script.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
var audio = new Audio('sound/scribble.wav');
nameAndScoreTemplate = document.getElementsByClassName("nameAndScore");
namesAndScoresContainer = document.getElementById("namesAndScoresContainer");
enterNameInput = document.getElementById("enterName").getElementsByTagName("input")[0];
enterScoreInput = document.getElementById("enterScore").getElementsByTagName("input")[0];
Interval();
function Interval()
{
setLeaderBoard(nameAndScoreTemplate, namesAndScoresContainer, audio, true);
setTimeout(Interval, 10000);
}
function enterNameAndScore()
{
insertData(enterNameInput.value, enterScoreInput.value);
enterNameInput.value = "";
enterScoreInput.value = 0;
}
function editCurrentScore(id)
{
score = document.getElementById(id).getElementsByTagName("input")[0].value;
editScore(id, score);
}
function decrementScore(id)
{
currentScore = document.getElementById(id).getElementsByClassName("score")[0].getElementsByTagName("h3")[0].innerHTML;
editScore(id, parseInt(currentScore) - 1);
}
function incrementScore(id)
{
currentScore = document.getElementById(id).getElementsByClassName("score")[0].getElementsByTagName("h3")[0].innerHTML;
editScore(id, parseInt(currentScore) + 1);
}