Skip to content

Commit 870f259

Browse files
committed
stat
1 parent eee3f60 commit 870f259

File tree

5 files changed

+53
-29
lines changed

5 files changed

+53
-29
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
a simple counter for the board game [carrom](https://en.wikipedia.org/wiki/Carrom).
1+
a simple counter for the board game [carrom](https://en.wikipedia.org/wiki/Carrom).

carrom.css

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ body{
1616

1717
.player2{
1818

19-
left:50%;
19+
left: 50%;
2020
width: 50%;
2121
height: 46%;
2222
background-color: #FFB3BA;
@@ -48,16 +48,18 @@ body{
4848
margin-top:10%;
4949
}
5050

51-
span{
51+
#p1score, #p2score, #p3score, #p4score{
52+
5253
display: inline-block;
5354
margin-top:35%;
5455
}
5556

5657
.decbtn{
5758

5859
position: absolute;
59-
left:20%;
60+
left:30%;
6061
top:70%;
62+
left:20%;
6163

6264
border: none;
6365
border-radius: 50%;
@@ -105,7 +107,7 @@ body{
105107

106108
span{
107109
font-size: 4rem;
108-
line-height: 0.5;
110+
line-height: 1.5;
109111
}
110112
}
111113
}
@@ -196,13 +198,20 @@ body{
196198
width: 98%;
197199
height: 91%;
198200

199-
button{
201+
#gamesplayed{
202+
203+
position: absolute;
204+
top: 1%;
205+
left: 25%;
206+
}
207+
208+
#closebtn{
200209

201210
background: none;
202211
border: none;
203212
position: absolute;
204-
top: 2%;
205-
right: 4%;
213+
top: 0.5%;
214+
right: 1%;
206215
color: #fff;
207216

208217
span{
@@ -213,7 +222,7 @@ body{
213222
#stattable{
214223

215224
position: absolute;
216-
top: 10%;
225+
top: 7%;
217226
left: 5%;
218227
width: 90%;
219228
border-collapse: collapse;
@@ -223,14 +232,21 @@ body{
223232
}
224233
}
225234

235+
#summarytag{
236+
237+
position: absolute;
238+
top: 39%;
239+
left: 5%;
240+
}
241+
226242
#gametable{
227243

228-
/* visibility: hidden; */
229244
position: relative;
230-
top: 55%;
245+
top: 45%;
231246
left: 5%;
232247
width: 90%;
233248
border-collapse: collapse;
249+
/* border: none; */
234250

235251
td{
236252
padding: 15px;

carrom.html

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,28 @@
1515

1616
<div class="player1" id="player1">
1717

18-
<p id="p1namep">player 1</p>
18+
<p id="p1namep"></p>
1919
<span id="p1score">0</span>
2020
<button class="decbtn" id="p1dec"><span class="material-icons">remove</span></button>
2121
<button class="ranibtn" id="p1rani"><span class="material-symbols-outlined">crown</span></button>
2222
</div>
2323

2424
<div class="player2" id="player2">
25-
<p id="p2namep">player 2</p>
25+
<p id="p2namep"></p>
2626
<span id="p2score">0</span>
2727
<button class="decbtn" id="p2dec"><span class="material-icons">remove</span></button>
2828
<button class="ranibtn" id="p2rani"><span class="material-symbols-outlined">crown</span></button>
2929
</div>
3030

3131
<div class="player3" id="player3">
32-
<p id="p3namep">player 3</p>
32+
<p id="p3namep"></p>
3333
<span id="p3score">0</span>
3434
<button class="decbtn" id="p3dec"><span class="material-icons">remove</span></button>
3535
<button class="ranibtn" id="p3rani"><span class="material-symbols-outlined">crown</span></button>
3636
</div>
3737

3838
<div class="player4" id="player4">
39-
<p id="p4namep">player 4</p>
39+
<p id="p4namep"></p>
4040
<span id="p4score">0</span>
4141
<button class="decbtn" id="p4dec"><span class="material-icons">remove</span></button>
4242
<button class="ranibtn" id="p4rani"><span class="material-symbols-outlined">crown</span></button>
@@ -59,6 +59,8 @@
5959

6060
<div class="statchild">
6161

62+
<p id="gamesplayed">games played : 0</p>
63+
6264
<button id="closebtn"><span class="material-icons">close</span></button>
6365

6466
<table id="stattable">
@@ -94,7 +96,7 @@
9496
</tr>
9597
</table>
9698

97-
<p id="gamesplayed" style="position: absolute; top: 45%; left: 5%;">games played : 0</p>
99+
<p id="summarytag">summary of each game:</p>
98100

99101
<table id="gametable">
100102

index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@
3535
<div class="names">
3636

3737
<input type="text" id="p1name" placeholder="player 1">
38-
<span style="position:absolute; top: 25%; left:47%" id="vsspan">vs</span>
3938
<input type="text" id="p2name" placeholder="player 2">
4039
<input type="text" id="p3name" placeholder="player 3">
4140
<input type="text" id="p4name" placeholder="player 4">
41+
42+
<span style="position:absolute; top: 25%; left:47%" id="vsspan">vs</span>
4243
</div>
4344

4445
<div id="start">

index.js

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,21 @@ document.getElementById('gamemode2').onclick=function(){
3636

3737
startbtn.onclick=function(){
3838

39-
const p1name = document.getElementById('p1name').value;
40-
const p2name = document.getElementById('p2name').value;
41-
const p3name = document.getElementById('p3name').value;
42-
const p4name = document.getElementById('p4name').value;
43-
44-
sessionStorage.setItem('p1name', p1name);
45-
sessionStorage.setItem('p2name', p2name);
46-
sessionStorage.setItem('p3name', p3name);
47-
sessionStorage.setItem('p4name', p4name);
48-
49-
// window.location.href = 'https://kilsw1ch.github.io/Carrom-Counter/carrom.html';
50-
window.location.href = 'carrom.html';
39+
// if(p1namefield.value!="" && p2namefield.value!=""){
40+
41+
// sessionStorage.setItem('p1name', p1namefield.value);
42+
// sessionStorage.setItem('p2name', p2namefield.value);
43+
44+
// window.location.href = 'carrom.html';
45+
// }
46+
47+
if(p1namefield.value!="" && p2namefield.value!="" && p3namefield.value!="" && p4namefield.value!=""){
48+
49+
sessionStorage.setItem('p1name', p1namefield.value);
50+
sessionStorage.setItem('p2name', p2namefield.value);
51+
sessionStorage.setItem('p3name', p3namefield.value);
52+
sessionStorage.setItem('p4name', p4namefield.value);
53+
54+
window.location.href = 'carrom.html';
55+
}
5156
}

0 commit comments

Comments
 (0)