-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
124 lines (94 loc) · 2.85 KB
/
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
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
var img = document.getElementById("popIna1");
var count = document.getElementById("score");
var TWScore = document.getElementById('my_score');
var MyScore = 10000;
var score = 0;
var audio = new Audio('wah.mp3');
var hk_score = 20000, tw_score = 10000, th_score = 7000, jp_score = 4500, my_score = 1000 ,fi_score = 2500, se_score = 1000, pl_score = 5000, dm_score = 2800, id_score=5900, hu_score=3190, sr_score = 3000;
// mouseclick event
img.addEventListener("mousedown", function(){
increaseScore();
img.src = 'popIna2.png';
audio.play();
});
img.addEventListener("mouseup", function(){
img.src = 'popIna1.png';
audio.play();
});
// touch event
img.addEventListener("touchstart", function(){
increaseScore();
img.src = 'popIna2.png';
audio.play();
});
img.addEventListener("touchmove", function(){
img.src = 'popIna1.png';
audio.play();
});
// Score on leaderboard
setInterval(startCountHk, 1);
function startCountHk(){
hk_score++;
document.getElementById("table").rows[1].cells.item(3).innerHTML = hk_score;
}
setInterval(startCountTw, 20);
function startCountTw(){
tw_score++;
document.getElementById("table").rows[2].cells.item(3).innerHTML = tw_score;
}
setInterval(startCountTh, 25);
function startCountTh(){
th_score++;
document.getElementById("table").rows[3].cells.item(3).innerHTML = th_score;
}
setInterval(startCountJp, 15);
function startCountJp(){
jp_score++;
document.getElementById("table").rows[4].cells.item(3).innerHTML = jp_score;
}
setInterval(startCountMy, 40);
function startCountMy(){
my_score++;
document.getElementById("table").rows[5].cells.item(3).innerHTML = my_score;
}
setInterval(startCountFi, 34);
function startCountFi(){
fi_score++;
document.getElementById("table").rows[6].cells.item(3).innerHTML = fi_score;
}
setInterval(startCountSe, 20);
function startCountSe(){
se_score++;
document.getElementById("table").rows[7].cells.item(3).innerHTML = se_score;
}
setInterval(startCountPl, 15);
function startCountPl(){
pl_score++;
document.getElementById("table").rows[8].cells.item(3).innerHTML = pl_score;
}
setInterval(startCountDm, 31);
function startCountDm(){
dm_score++;
document.getElementById("table").rows[9].cells.item(3).innerHTML = dm_score;
}
setInterval(startCountId, 29);
function startCountId(){
id_score++;
document.getElementById("table").rows[10].cells.item(3).innerHTML = id_score;
}
setInterval(startCountHu, 70);
function startCountHu(){
hu_score++;
document.getElementById("table").rows[11].cells.item(3).innerHTML = hu_score;
}
setInterval(startCountSr, 5);
function startCountSr(){
sr_score++;
document.getElementById("table").rows[12].cells.item(3).innerHTML = sr_score;
}
function increaseScore(){
score++;
MyScore++;
count.innerHTML = score;
TWScore.innerHTML = MyScore;
}