Repository navigation
Expand file tree
/
Copy pathlife.html
More file actions
417 lines (371 loc) · 15.5 KB
/
Copy pathlife.html
File metadata and controls
417 lines (371 loc) · 15.5 KB
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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
<html>
<title>Life</title>
<head>
<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
</head>
<body>
<p onload="load()">
<table>
<tr>
<th class="buttonbar"><button class="button_life " onclick="plus1_1() ">+1</button></th>
<th class="buttonbar "><button class="button_life " onclick="plus5_1() ">+5</button></th>
<th class="buttonbar "><button class="button_life " onclick="plus10_1() ">+10</button></th>
</tr>
<tr>
<td id="id1 " class="lifebar "><button id="11 " class="button_res " onclick="res20_1() "> 20</button></td>
<td id="id2 " class="lifebar "><button id="21 " class="lifedisplay " onclick="display_2() "><span id="life1 "></span></button></td>
<td id="id3 " class="lifebar "><button id="31 " class="button_res " onclick="res40_1() "><span id="res40inf_1 ">40</button></td>
</tr>
<tr>
<td class="buttonbar "><button class="button_life " onclick="minus1_1() ">- 1</button></td>
<td class="buttonbar "><button class="button_life " onclick="minus5_1() "> - 5</button></td>
<td class="buttonbar "><button class="button_life " onclick="minus10_1() "> - 10</button></td>
</tr>
<tr>
<td class="buttonbar "><button class="button_life " onclick="plus1_2() ">+1</button></td>
<td class="buttonbar "><button class="button_life " onclick="plus5_2() ">+5</button></td>
<td class="buttonbar "><button class="button_life " onclick="plus10_2() ">+10</button></td>
</tr>
<tr>
<td id="id4 " class="lifebar "><button id="12 " class="button_res " onclick="res20_2() ">20</span></button></td>
<td id="id5 " class="lifebar "><button id="22 " class="lifedisplay " onclick="display_2() "><span id="life2 "></span></button></td>
<td id="id6 " class="lifebar "><button id="32 " class="button_res " onclick="res40_2() ">40</button></td>
</tr>
<tr>
<td class="buttonbar "><button class="button_life " onclick="minus1_2() ">- 1</button></td>
<td class="buttonbar "><button class="button_life " onclick="minus5_2() ">- 5</button></td>
<td class="buttonbar "><button class="button_life " onclick="minus10_2() ">- 10</button></td>
</tr>
</table>
<button onclick="window.location.href='start.html' ; " class="back ">Zurück</button>
</p>
<script>
var temp = 0;
var v1 = 1;
var v5 = 5;
var v10 = 10;
var v20 = 20;
var v40 = 40;
var lifex = 20;
var lifey = 20;
var ähm = 1;
document.getElementById("life1 ").textContent = lifex;
document.getElementById("life2 ").textContent = lifey;
document.getElementById("res20inf_1 ").textContent = " ";
document.getElementById("res40inf_1 ").textContent = " ";
document.getElementById("res20inf_2 ").textContent = " ";
document.getElementById("res40inf_2 ").textContent = " ";
//Reset Life to 20
function res20_1() {
if (lifex < 1) {
document.getElementById("life1 ").textContent = "20 ";
document.getElementById("life2 ").textContent = "20 ";
lifex = v20;
lifey = v20;
resstyle();
}
}
//Reset Life to 40
function res40_1() {
if (lifex < 1) {
document.getElementById("life1 ").textContent = "40 ";
document.getElementById("life2 ").textContent = "40 ";
lifex = v40;
lifey = v40;
resstyle();
}
}
//Reset Life to 20
function res20_2() {
if (lifey < 1) {
document.getElementById("life1 ").textContent = "20 ";
document.getElementById("life2 ").textContent = "20 ";
lifex = v20;
lifey = v20;
resstyle();
}
}
//Reset Life to 40
function res40_2() {
if (lifey < 1) {
document.getElementById("life1 ").textContent = "40 ";
document.getElementById("life2 ").textContent = "40 ";
lifex = v40;
lifey = v40;
resstyle();
}
}
//Plus 1 at Life 1
function plus1_1() {
temp = lifex;
lifex = temp + v1;
document.getElementById("life1 ").textContent = lifex;
//Start Style
stylefunction();
}
//Plus 5 at Life 1
function plus5_1() {
temp = lifex;
lifex = temp + v5;
document.getElementById("life1 ").textContent = lifex;
//Start Style
stylefunction();
}
//Plus 10 at Life 1
function plus10_1() {
temp = lifex;
lifex = temp + v10;
document.getElementById("life1 ").textContent = lifex;
//Start Style
stylefunction();
}
//Minus 1 at Life 1
function minus1_1() {
temp = lifex;
lifex = temp - v1;
document.getElementById("life1 ").textContent = lifex;
//Start Style
stylefunction();
}
//Minus 5 at Life 1
function minus5_1() {
temp = lifex;
lifex = temp - v5;
document.getElementById("life1 ").textContent = lifex;
//Start Style
stylefunction();
}
//Minus 10 at Life 1
function minus10_1() {
temp = lifex;
lifex = temp - v10;
document.getElementById("life1 ").textContent = lifex;
//Start Style
stylefunction();
}
function plus1_2() {
temp = lifey;
lifey = temp + v1;
document.getElementById("life2 ").textContent = lifey;
//Start Style
stylefunction();
}
function plus5_2() {
temp = lifey;
lifey = temp + v5;
document.getElementById("life2 ").textContent = lifey;
if (lifey > 0) {
//Start Style
stylefunction();
}
}
function plus10_2() {
temp = lifey;
lifey = temp + v10;
document.getElementById("life2 ").textContent = lifey;
//Start Style
stylefunction();
}
//Minus 1 at Life 2
function minus1_2() {
temp = lifey;
lifey = temp - v1;
document.getElementById("life2 ").textContent = lifey;
//Start Style
stylefunction();
}
//Minus 5 at Life 2
function minus5_2() {
temp = lifey;
lifey = temp - v5;
document.getElementById("life2 ").textContent = lifey;
//Start Style
stylefunction();
}
//Minus 10 at Life 2
function minus10_2() {
temp = lifey;
lifey = temp - v10;
document.getElementById("life2 ").textContent = lifey;
//Start Style
stylefunction();
}
//Style update checker
function stylefunction() {
if (lifex > 0) {
//Button color
document.getElementById("11 ").style.backgroundColor = "#28EDCA "
document.getElementById("21 ").style.backgroundColor = "#28EDCA "
document.getElementById("31 ").style.backgroundColor = "#28EDCA "
//Text color
document.getElementById("11 ").style.color = "#28EDCA "
document.getElementById("31 ").style.color = "#28EDCA "
//Table color
document.getElementById("id1 ").style.backgroundColor = "#28EDCA "
document.getElementById("id2 ").style.backgroundColor = "#28EDCA "
document.getElementById("id3 ").style.backgroundColor = "#28EDCA "
document.getElementById("id3 ").style.borderColor = "#28EDCA "
document.getElementById("id1 ").style.borderColor = "#28EDCA "
document.getElementById("id2 ").style.borderColor = "#28EDCA "
}
if (lifex < 1) {
//Button color
document.getElementById("11 ").style.backgroundColor = "#EB0600 "
document.getElementById("21 ").style.backgroundColor = "#EB0600 "
document.getElementById("31 ").style.backgroundColor = "#EB0600 "
//Text color
document.getElementById("11 ").style.color = "white "
document.getElementById("31 ").style.color = "white "
//Table color
document.getElementById("id1 ").style.backgroundColor = "#EB0600 "
document.getElementById("id2 ").style.backgroundColor = "#EB0600 "
document.getElementById("id3 ").style.backgroundColor = "#EB0600 "
document.getElementById("id3 ").style.borderColor = "#EB0600 "
document.getElementById("id1 ").style.borderColor = "#EB0600 "
document.getElementById("id2 ").style.borderColor = "#EB0600 "
}
if (lifey > 0) {
//Button color
document.getElementById("12 ").style.backgroundColor = "#28EDCA "
document.getElementById("22 ").style.backgroundColor = "#28EDCA "
document.getElementById("32 ").style.backgroundColor = "#28EDCA "
//Text color
document.getElementById("12 ").style.color = "#28EDCA "
document.getElementById("32 ").style.color = "#28EDCA "
//Table color
document.getElementById("id4 ").style.backgroundColor = "#28EDCA "
document.getElementById("id5 ").style.backgroundColor = "#28EDCA "
document.getElementById("id6 ").style.backgroundColor = "#28EDCA "
document.getElementById("id4 ").style.borderColor = "#28EDCA "
document.getElementById("id5 ").style.borderColor = "#28EDCA "
document.getElementById("id6 ").style.borderColor = "#28EDCA "
}
if (lifey < 1) {
//Button color
document.getElementById("12 ").style.backgroundColor = "#EB0600 "
document.getElementById("22 ").style.backgroundColor = "#EB0600 "
document.getElementById("32 ").style.backgroundColor = "#EB0600 "
//Text color
document.getElementById("12 ").style.color = "white "
document.getElementById("32 ").style.color = "white "
//Table color
document.getElementById("id4 ").style.backgroundColor = "#EB0600 "
document.getElementById("id5 ").style.backgroundColor = "#EB0600 "
document.getElementById("id6 ").style.backgroundColor = "#EB0600 "
document.getElementById("id4 ").style.borderColor = "#EB0600 "
document.getElementById("id5 ").style.borderColor = "#EB0600 "
document.getElementById("id6 ").style.borderColor = "#EB0600 "
}
}
//Reset Styler
function resstyle() {
//Button color
document.getElementById("11 ").style.backgroundColor = "#28EDCA "
document.getElementById("21 ").style.backgroundColor = "#28EDCA "
document.getElementById("31 ").style.backgroundColor = "#28EDCA "
document.getElementById("12 ").style.backgroundColor = "#28EDCA "
document.getElementById("22 ").style.backgroundColor = "#28EDCA "
document.getElementById("32 ").style.backgroundColor = "#28EDCA "
//Text color
document.getElementById("11 ").style.color = "#28EDCA "
document.getElementById("31 ").style.color = "#28EDCA "
document.getElementById("12 ").style.color = "#28EDCA "
document.getElementById("32 ").style.color = "#28EDCA "
//Table color
document.getElementById("id1 ").style.backgroundColor = "#28EDCA "
document.getElementById("id2 ").style.backgroundColor = "#28EDCA "
document.getElementById("id3 ").style.backgroundColor = "#28EDCA "
document.getElementById("id3 ").style.borderColor = "#28EDCA "
document.getElementById("id1 ").style.borderColor = "#28EDCA "
document.getElementById("id2 ").style.borderColor = "#28EDCA "
document.getElementById("id4 ").style.backgroundColor = "#28EDCA "
document.getElementById("id5 ").style.backgroundColor = "#28EDCA "
document.getElementById("id6 ").style.backgroundColor = "#28EDCA "
document.getElementById("id4 ").style.borderColor = "#28EDCA "
document.getElementById("id5 ").style.borderColor = "#28EDCA "
document.getElementById("id6 ").style.borderColor = "#28EDCA "
}
</script>
<style>
.button_life {
background-color: #4CAF50;
border: none;
color: white;
padding: 10px 1cm;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 0px;
cursor: pointer;
font-size: 30px;
font-family: 'Roboto', sans-serif;
}
.button_res {
background-color: #28EDCA;
border: none;
color: #28EDCA;
padding: 12.5px 1.85cm;
text-align: center;
text-decoration: none;
display: inline-block;
margin: 4px 0px;
cursor: pointer;
font-size: 40px;
font-family: 'Roboto', sans-serif;
}
.lifedisplay {
background-color: #28EDCA;
border: none;
color: white;
padding: 12.5px 1cm;
text-align: center;
text-decoration: none;
display: inline-block;
margin: 4px 0px;
cursor: pointer;
font-size: 40px;
font-family: 'Roboto', sans-serif;
}
table {
font-family: 'Roboto', sans-serif;
border-collapse: collapse;
text-align: center;
}
.buttonbar {
border: 1px solid #4CAF50;
background-color: #4CAF50;
width: 201.333;
height: 68px;
text-align: center;
}
.lifebar {
border: 1px solid #28EDCA;
text-align: center;
width: 68px;
width: 201.333;
background-color: #28EDCA;
}
h1 {
font-size: 40px;
margin: 0px;
font-family: 'Roboto', sans-serif;
}
a {
font-size: 25px;
font-family: 'Roboto', sans-serif;
}
.back {
background-color: #4CAF50;
border: none;
color: white;
height: 30px;
width: 100px;
text-decoration: none;
font-size: 20px;
cursor: pointer;
font-family: 'Roboto', sans-serif;
}
</style>
</body>
</html>