-
Notifications
You must be signed in to change notification settings - Fork 1
/
Score.html
290 lines (253 loc) · 8.11 KB
/
Score.html
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
<!DOCTYPE html>
<html>
<head>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Darumadrop+One&display=swap"
rel="stylesheet"
/>
<title>Sudoku Project</title>
<style>
* {
padding: 0;
margin: 0;
}
body {
background-image: url(pic/bg-home.png);
background-size:cover;
background-repeat: no-repeat;
height: 100vh;
font-family: 'Darumadrop One', cursive;
}
.content {
text-align: center;
position: absolute;
width: 50%;
left: 25%;
}
.your{
font-size: 120px;
font-weight: 600;
color: #ecba40;
-webkit-text-stroke-width: 2px;
-webkit-text-stroke-color: black;
}
.score{
font-size: 120px;
font-weight: 600;
color: #eb3d24;
-webkit-text-stroke-width: 2px;
-webkit-text-stroke-color: black;
}
/*Jane*/
.yourScore{
display: flex;
}
.content{
position: absolute;
left: 50%;
transform: translateX(-50%);
top: 30px;
align-items: center ;
font-size: 75px;
}
.box-score{
display: flex;
font-size: 32px;
border-radius: 10px;
border: 5px solid black;
margin-top: 20px;
background-color: white;
width: 700px;
height: 400px;
}
.title-box{
font-size: 40px;
-webkit-text-stroke-width: 2px;
-webkit-text-stroke-color: black;
}
/*Preme*/
.modeBox{
width: 33%;
}
.dum{
width: 33%;
}
.timeBox{
background-color: rgb(210, 240, 210);
width: 33%;
}
/*Preme*/
.back {
position: absolute;
bottom: 30px;
left: 35px;
}
.back img {
width: 100px;
}
.back :hover {
filter: invert(100%);
}
.mute img{
width: 80px;
}
.mute{
position: absolute;
bottom: 45px;
right: 80px;
}
/*------*/
/*Preme*/
.iambutton{
cursor: pointer;
}
/**/
/*Joon*/
.reset{
font-size: 32px;
width: 250px;
padding: 7px;
height: 50px;
background-color: #ddb575;
border: 2px solid black;
border-radius: 50px;
margin-top: 15px;
margin-left: auto;
margin-right: auto;
cursor: pointer;
}
.reset:hover{
color: greenyellow;
font-weight: 600;
-webkit-text-stroke-width: 1px;
-webkit-text-stroke-color: black;
}
/**/
</style>
</head>
<body>
<div class="content">
<div class="yourScore">
<div class="your">YOUR</div>
<div class="score">SCORE</div>
</div>
<!--Show score--> <!--Preme-->
<div class="box-score" style="overflow: auto;">
<div class="modeBox">
<div class="title-box" style="color: #3980bf;">MODE</div>
</div>
<div class="timeBox">
<div class="title-box" style="color: #49a256;">TIME</div>
</div>
<div class="dum">
<div class="title-box" style="color: #3980bf;">IQ</div>
</div>
</div>
<div class="reset" onclick="ClearAll();">
RESET SCORE
</div>
<!--Preme-->
</div>
<!--Jane-->
<a href="Home.html"><div class="back" onclick="" id="backButton"><img src="pic/back.png" /></div></a>
<div class="mute" onclick="" id="muteButton"><img id="soundImage" src="pic/sound_on.png"></div>
<!--Jane-->
<!--preme-->
<script src="Sudoku.js"></script>
<script>
Sudoku.createaudio()
var APPLICATION_STATE = {
todoList: []
}
async function loadTodoList(afterLoadFunction) {
var headers = new Headers();
headers.append("Content-Type", "application/json");
var requestOptions = {
method: "GET",
headers: headers
};
await fetch(`https://crudcrud.com/api/db4432fd032843efa62855de937ac967/history`, requestOptions)
.then(res => res.json())
.then(data => afterLoadFunction(data))
}
function refreshTodoList () {
loadTodoList(function (data) {
APPLICATION_STATE.todoList = data;
renderTodoList();
});
}
function renderTodoList() {
for (var idx = 0; idx < APPLICATION_STATE.todoList.length; idx++) {
var todoItem = APPLICATION_STATE.todoList[idx];
const showhistoryMODE = document.createElement("div");
showhistoryMODE.setAttribute("id", `mode${idx + 1}`);
showhistoryMODE.innerHTML = `${todoItem.name.mode}`
let elapsedTime = todoItem.name.time
const hours = Math.floor(elapsedTime / (1000 * 60 * 60));
const minutes = Math.floor((elapsedTime % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((elapsedTime % (1000 * 60)) / 1000);
const showhistoryTIME = document.createElement("div");
showhistoryTIME.setAttribute("id", `time${idx + 1}`);
showhistoryTIME.innerHTML = `${Sudoku.padZero(hours)} : ${Sudoku.padZero(minutes)} : ${Sudoku.padZero(seconds)}`
const showhistoryWRONG = document.createElement("div");
showhistoryWRONG.setAttribute("id", `wrong${idx + 1}`);
showhistoryWRONG.innerHTML = `${todoItem.name.wrong}`
document.getElementsByClassName("modeBox")[0].appendChild(showhistoryMODE);
document.getElementsByClassName("timeBox")[0].appendChild(showhistoryTIME);
document.getElementsByClassName("dum")[0].appendChild(showhistoryWRONG);
}
}
function deleteTodoItem(id) {
var headers = new Headers();
headers.append("Content-Type", "application/json");
var requestOptions = {
method: "DELETE",
headers: headers
};
fetch(`https://crudcrud.com/api/db4432fd032843efa62855de937ac967/history/${id}`, requestOptions)
.then(res => message())
}
function message()
{
alert("ClearAll");
window.location = 'Score.html'
}
function ClearAll(){
fetch(`https://crudcrud.com/api/db4432fd032843efa62855de937ac967/history`, ({
method: "GET"
}))
.then(res => res.json())
.then(data => data.forEach(element => {
deleteTodoItem(element._id)
})
)
}
window.onload = function () {
refreshTodoList();
};
/*let played = JSON.parse(localStorage.history)
played.forEach((element, index) => {
const showhistoryMODE = document.createElement("div");
showhistoryMODE.setAttribute("id", `mode${index + 1}`);
showhistoryMODE.innerHTML = `${element.mode}`
let elapsedTime = element.time
const hours = Math.floor(elapsedTime / (1000 * 60 * 60));
const minutes = Math.floor((elapsedTime % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((elapsedTime % (1000 * 60)) / 1000);
const showhistoryTIME = document.createElement("div");
showhistoryTIME.setAttribute("id", `time${index + 1}`);
showhistoryTIME.innerHTML = `${Sudoku.padZero(hours)} : ${Sudoku.padZero(minutes)} : ${Sudoku.padZero(seconds)}`
const showhistoryWRONG = document.createElement("div");
showhistoryWRONG.setAttribute("id", `wrong${index + 1}`);
showhistoryWRONG.innerHTML = `${element.wrong}`
document.getElementsByClassName("modeBox")[0].appendChild(showhistoryMODE);
document.getElementsByClassName("timeBox")[0].appendChild(showhistoryTIME);
document.getElementsByClassName("dum")[0].appendChild(showhistoryWRONG);
})*/;
</script>
<!--preme-->
</body>
</html>