timer ajouté
This commit is contained in:
parent
666e1d8467
commit
66296c36ac
4 changed files with 54 additions and 9 deletions
1
TODO.txt
Normal file
1
TODO.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
younes: final chrono , pop up cookie , centrer ligne , animation pop up
|
|
@ -5,6 +5,7 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Démineur</title>
|
<title>Démineur</title>
|
||||||
<link rel="stylesheet" href="style.css">
|
<link rel="stylesheet" href="style.css">
|
||||||
|
<script src="demineur.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body id="body_demineur">
|
<body id="body_demineur">
|
||||||
|
|
||||||
|
@ -15,17 +16,21 @@
|
||||||
<div class="item_nav">
|
<div class="item_nav">
|
||||||
<a href="https://demineur.nhtdev.com/fr/rules">Help</a>
|
<a href="https://demineur.nhtdev.com/fr/rules">Help</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="item_nav">
|
<div class="item_nav">
|
||||||
Temps:
|
Temps:
|
||||||
</div>
|
<input id="temps" type="number" value="000" disabled>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="item_nav">
|
<div class="item_nav">
|
||||||
Mines restantes:10
|
Mines restantes:10
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div id="jeu">ICI se retourve le jeu</div>
|
<div id="jeu">ICI se retourve le jeu</div>
|
||||||
|
<button id="debut_game" onclick="chrono()">GO!</button>
|
||||||
|
<button id="fin_game" onclick="reset()">CIAO</button>
|
||||||
|
|
||||||
|
<span class="vertical-line"></span>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
30
demineur.js
30
demineur.js
|
@ -7,3 +7,33 @@ class Case {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
function sleep(ms){
|
||||||
|
return new Promise(resolve => setTimeout(resolve, ms));
|
||||||
|
}
|
||||||
|
async function chrono(){
|
||||||
|
let k=document.getElementById("temps").value;
|
||||||
|
const myButton = document.getElementById("fin_game");
|
||||||
|
let arret=0;
|
||||||
|
|
||||||
|
while(arret==!1) {
|
||||||
|
|
||||||
|
await sleep(1000);
|
||||||
|
document.getElementById("temps").value=document.getElementById("temps").value*1+1;
|
||||||
|
myButton.addEventListener("click",() =>{arret=1;})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function reset(){
|
||||||
|
await sleep(500);
|
||||||
|
document.getElementById("temps").value=0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function Cookies() {
|
||||||
|
var accept = confirm("Tu veux des cookies ?");
|
||||||
|
if (accept === true) {
|
||||||
|
alert("Bon jeu!");
|
||||||
|
} else {
|
||||||
|
Cookies();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Cookies();
|
19
style.css
19
style.css
|
@ -1,6 +1,6 @@
|
||||||
#nav_demineur{
|
#nav_demineur{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background-position:0cm;
|
|
||||||
background-color: #2bd7d484;
|
background-color: #2bd7d484;
|
||||||
border-width: 2px;
|
border-width: 2px;
|
||||||
border-style: double;
|
border-style: double;
|
||||||
|
@ -18,13 +18,22 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
#jeu{
|
#jeu{
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: left;
|
||||||
/* border-width: 2px;
|
border-width: 2px;
|
||||||
border-style: double; */
|
border-style: double;
|
||||||
|
width: 49%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item_nav{
|
.item_nav{
|
||||||
margin-top: 3px;
|
margin-top: 3px;
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
}
|
}
|
||||||
|
.vertical-line{
|
||||||
|
border-left: 4px solid #000;
|
||||||
|
display: inline-block;
|
||||||
|
height: 400px;
|
||||||
|
margin: 0 50% ;
|
||||||
|
padding-top: 0;
|
||||||
|
}
|
Loading…
Reference in a new issue