-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
103 lines (88 loc) · 3.26 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1 id="title">Canelé Clicker</h1>
<!-- <image>
<img src="images/canelé.jpg" alt="Canelé">
</image> -->
<p style="font-size: 26px">
<span>Vous avez </span>
<span id="caneles" style="color:#a4721f">0</span>
<span> canelés, </span>
<span id="fours" style="color:#a4721f">1</span>
<span> fours et </span>
<span id="robots" style="color:#a4721f">0</span>
<span> robots</span>
</p>
<button id="bt_cook" onclick="Cook()" type="button">
Cuisiner
</button>
<button id="bt_buyfurnace" type="button" disabled>
Acheter un four (25 canelés)
</button>
<button id="bt_buyrobot" type="button" disabled>
Acheter un robot (100 canelés)
</button>
<!-- Rectangular switch
<label class="switch">
<input type="checkbox">
<span class="slider"></span>
</label>
Rounded switch
<label class="switch">
<input type="checkbox">
<span class="slider round"></span>
</label> -->
</body>
<script>
//function Function() {
document.onkeydown = function (e) {
var key = e.charCode || e.keyCode;
if ([32, 13].includes(key)) return false;
}
let Caneles = 0
let Fours = 1
let Robots = 0
document.getElementById("caneles").innerHTML = Caneles;
document.getElementById("fours").innerHTML = Fours;
document.getElementById("robots").innerHTML = Robots;
bt_cook.onclick = function () { // CUISINER CANELÉ
Caneles += Fours
if (Caneles >= 25) document.getElementById("bt_buyfurnace").disabled = false
document.getElementById("caneles").innerHTML = Caneles;
};
bt_buyfurnace.onclick = function () { // ACHETER FOURS
if (Caneles < 25) return
Caneles -= 25
Fours++
if (Caneles < 25) document.getElementById("bt_buyfurnace").disabled = true
if (Caneles < 100) document.getElementById("bt_buyrobot").disabled = true
document.getElementById("caneles").innerHTML = Caneles
document.getElementById("fours").innerHTML = Fours;
};
bt_buyrobot.onclick = function () { // ACHETER ROBOTS
if (Caneles < 100) return
Caneles -= 100
Robots++
if (Caneles < 25) document.getElementById("bt_buyfurnace").disabled = true
if (Caneles < 100) document.getElementById("bt_buyrobot").disabled = true
document.getElementById("caneles").innerHTML = Caneles;
document.getElementById("robots").innerHTML = Robots;
};
setInterval(() => {
Caneles += Robots
// Caneles++
if (Caneles >= 25) document.getElementById("bt_buyfurnace").disabled = false
if (Caneles >= 100) document.getElementById("bt_buyrobot").disabled = false
document.getElementById("caneles").innerHTML = Caneles;
}, 1000)
// }, 1500/Robots)
//}
//Function()
</script>
<!-- <script src="index.js" type="text/javascript"></script> -->
<noscript>Sorry, your browser does not support JavaScript!</noscript>
</html>