Compare commits
No commits in common. "091919c6127757436a0d4094818185931ec223b0" and "d322df708ea3bd0301a054980adc49db1c96d181" have entirely different histories.
091919c612
...
d322df708e
5 changed files with 8 additions and 36 deletions
BIN
case_flag.png
BIN
case_flag.png
Binary file not shown.
Before Width: | Height: | Size: 308 B |
BIN
case_zero.png
BIN
case_zero.png
Binary file not shown.
Before Width: | Height: | Size: 263 B |
|
@ -33,10 +33,8 @@
|
|||
<div id="jeu">
|
||||
<button id="debut_game" onclick="chrono()">GO!</button>
|
||||
<button id="fin_game" onclick="reset()">CIAO</button>
|
||||
|
||||
<div id="grille">
|
||||
<script type="text/javascript">grilleButtons(7,7);</script>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
38
demineur.js
38
demineur.js
|
@ -7,9 +7,8 @@ class Case {
|
|||
this.hidden = true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
//Fonction pour créer un cookie.
|
||||
function setCookie(name, value, days) {
|
||||
const expires = new Date(Date.now() + days * 864e5).toUTCString();
|
||||
|
@ -19,7 +18,6 @@ function setCookie(name, value, days) {
|
|||
function getCookie(name) {
|
||||
return document.cookie.split('; ').find(row => row.startsWith(name + '='))?.split('=')[1];
|
||||
}
|
||||
>>>>>>> d322df708ea3bd0301a054980adc49db1c96d181
|
||||
|
||||
function sleep(ms){
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
|
@ -71,8 +69,6 @@ function creerGrille(haut, larg) {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function cookie(){
|
||||
const popup = document.getElementById('popup');
|
||||
const closePopupButton = document.getElementById('accept-button');
|
||||
|
@ -95,50 +91,28 @@ const cookieAccepted = getCookie('cookiesAccepted');
|
|||
if (!cookieAccepted){
|
||||
cookie();
|
||||
}
|
||||
|
||||
|
||||
function selectImage(idCase) {
|
||||
const coords = idCase.split("_") ;
|
||||
const x = parseInt(coords[0]) ;
|
||||
const y = parseInt(coords[0]) ;
|
||||
}
|
||||
|
||||
function changeImage(mouseEvent) {
|
||||
if (!(mouseEvent.target.classList.contains("buttonFlagged"))) {
|
||||
mouseEvent.target.style.background="url('case_mine.png')" ;
|
||||
mouseEvent.target.classList.add("buttonRevealed") ;
|
||||
}
|
||||
mouseEvent.target.style.background="url('case_mine.png')" ;
|
||||
}
|
||||
|
||||
|
||||
function changeImageFlag(rightClick) {
|
||||
|
||||
rightClick.preventDefault() ;
|
||||
if (rightClick.target.classList.contains("buttonRevealed")) {
|
||||
return 0 ;
|
||||
} else if (rightClick.target.classList.contains("buttonFlagged")) {
|
||||
rightClick.target.style.background="url('case_vide.png')" ;
|
||||
rightClick.target.classList.remove("buttonFlagged") ;
|
||||
} else {
|
||||
rightClick.target.style.background="url('case_flag.png')" ;
|
||||
rightClick.target.classList.add("buttonFlagged") ;
|
||||
}
|
||||
}
|
||||
|
||||
function grilleButtons(haut, larg) {
|
||||
const divGrille = document.getElementById("grille") ;
|
||||
for (var i=0;i<haut;i++) {
|
||||
for (var j=0;j<larg;j++){
|
||||
|
||||
var newCase = document.createElement("BUTTON") ;
|
||||
newCase.style.gridrow=i.toString() ;
|
||||
newCase.classList.add("button_case") ;
|
||||
newCase.id = i.toString() + "_" + j.toString() ;
|
||||
newCase.style.background="url('case_vide.png')" ;
|
||||
newCase.addEventListener("click", changeImage);
|
||||
newCase.addEventListener("contextmenu", changeImageFlag);
|
||||
divGrille.appendChild(newCase) ;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
#jeu{
|
||||
|
||||
display: flex;
|
||||
justify-content: left;
|
||||
border-width: 2px;
|
||||
justify-content: left;
|
||||
border-width: 2px;
|
||||
border-style: double;
|
||||
width: 49%;
|
||||
|
||||
|
|
Loading…
Reference in a new issue