-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
200 lines (175 loc) · 5.05 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
let runsEl = document.getElementById("runs")
let wicketsEl = document.getElementById("wickets")
let oversEl = document.getElementById("thisover")
let completedEl = document.getElementById("completed")
let oversCompletedEl = document.getElementById("overscompleted")
let totaldeliveries = 0
let runs = 0
let wickets = 0
let deliveries = 1
let ball = 0
function dot() {
if(deliveries==6){
completedEl.textContent = "OVER COMPLETED"
deliveries = 1
totaldeliveries += 1
runsEl.textContent = runs
ball = 0
oversEl.textContent += ball + " / "
oversCompletedEl.textContent = Math.trunc(totaldeliveries/6)
}
else{
deliveries += 1
runsEl.textContent = runs
completedEl.textContent = "Over Ongoing"
totaldeliveries += 1
ball = 0
oversEl.textContent += ball + " - "
oversCompletedEl.textContent = Math.trunc(totaldeliveries/6)
}
}
function single() {
if(deliveries==6){
completedEl.textContent = "OVER COMPLETED"
deliveries = 1
runs += 1
totaldeliveries += 1
runsEl.textContent = runs
ball = 1
oversEl.textContent += ball + " / "
oversCompletedEl.textContent = Math.trunc(totaldeliveries/6)
}
else{
runs += 1
deliveries += 1
runsEl.textContent = runs
completedEl.textContent = "Over Ongoing"
ball = 1
oversEl.textContent += ball + " - "
totaldeliveries += 1
oversCompletedEl.textContent = Math.trunc(totaldeliveries/6)
}
}
function double() {
if(deliveries==6){
completedEl.textContent = "OVER COMPLETED"
deliveries = 1
runs += 2
runsEl.textContent = runs
ball = 2
oversEl.textContent += ball + " / "
totaldeliveries += 1
oversCompletedEl.textContent = Math.trunc(totaldeliveries/6)
}
else{
runs += 2
deliveries += 1
runsEl.textContent = runs
completedEl.textContent = "Over Ongoing"
ball = 2
oversEl.textContent += ball + " - "
totaldeliveries += 1
oversCompletedEl.textContent = Math.trunc(totaldeliveries/6)
}}
function triple() {
if(deliveries==6){
completedEl.textContent = "OVER COMPLETED"
deliveries = 1
runs += 3
runsEl.textContent = runs
ball = 3
oversEl.textContent += ball + " / "
totaldeliveries += 1
oversCompletedEl.textContent = Math.trunc(totaldeliveries/6)
}
else{
runs += 3
deliveries += 1
runsEl.textContent = runs
completedEl.textContent = "Over Ongoing"
ball = 3
oversEl.textContent += ball + " - "
totaldeliveries += 1
oversCompletedEl.textContent = Math.trunc(totaldeliveries/6)
}}
function four() {
if(deliveries==6){
completedEl.textContent = "OVER COMPLETED"
deliveries = 1
runs += 4
runsEl.textContent = runs
ball = 4
oversEl.textContent += ball + " / "
totaldeliveries += 1
oversCompletedEl.textContent = Math.trunc(totaldeliveries/6)
}
else{
runs += 4
deliveries += 1
runsEl.textContent = runs
completedEl.textContent = "Over Ongoing"
ball = 4
oversEl.textContent += ball + " - "
totaldeliveries += 1
oversCompletedEl.textContent = Math.trunc(totaldeliveries/6)
}}
function six() {
if(deliveries==6){
completedEl.textContent = "OVER COMPLETED"
deliveries = 1
runs += 6
runsEl.textContent = runs
ball = 6
oversEl.textContent += ball + " / "
totaldeliveries += 1
oversCompletedEl.textContent = Math.trunc(totaldeliveries/6)
}
else{
runs += 6
deliveries += 1
runsEl.textContent = runs
completedEl.textContent = "Over Ongoing"
ball = 6
oversEl.textContent += ball + " - "
totaldeliveries += 1
oversCompletedEl.textContent = Math.trunc(totaldeliveries/6)
}}
function noball() {
runs += 1
runsEl.textContent = runs
completedEl.textContent = "Click the runs scored on noball (CLICK DOT BALL IN CASE OF A WICKET)"
deliveries -= 1
totaldeliveries -= 1
ball = "NB"
oversEl.textContent += ball
oversCompletedEl.textContent = Math.trunc(totaldeliveries/6)
}
function wide() {
runs += 1
runsEl.textContent = runs
completedEl.textContent = "Over Ongoing"
ball = "WD"
oversEl.textContent += ball + " - "
oversCompletedEl.textContent = Math.trunc(totaldeliveries/6)
}
function wicket() {
if(deliveries==6){
completedEl.textContent = "OVER COMPLETED"
deliveries = 1
wickets += 1
wicketsEl.textContent = wickets
ball = "W"
oversEl.textContent += ball + " / "
totaldeliveries += 1
oversCompletedEl.textContent = Math.trunc(totaldeliveries/6)
}
else{
wickets += 1
deliveries += 1
wicketsEl.textContent = wickets
completedEl.textContent = "Over Ongoing"
ball = "W"
oversEl.textContent += ball + " - "
totaldeliveries += 1
oversCompletedEl.textContent = Math.trunc(totaldeliveries/6)
}}