Merge branch 'main' of https://git.etud.insa-toulouse.fr/bocquel/Projet_JS
This commit is contained in:
commit
091919c612
4 changed files with 102 additions and 5 deletions
2
TODO.txt
2
TODO.txt
|
@ -1,2 +1,2 @@
|
||||||
younes: final chrono , pop up cookie , centrer ligne , animation pop up
|
younes: pop up cookie animation pop up
|
||||||
raph : finir de faire marcher la grille, lier la grille à l'affichage des mines, faire la logique du jeu
|
raph : finir de faire marcher la grille, lier la grille à l'affichage des mines, faire la logique du jeu
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<title>Démineur</title>
|
<title>Démineur</title>
|
||||||
<link rel="stylesheet" href="style.css">
|
<link rel="stylesheet" href="style.css">
|
||||||
|
|
||||||
<script type="text/javascript" src="demineur.js"></script>
|
<script type="text/javascript" src="demineur.js" defer></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body id="body_demineur">
|
<body id="body_demineur">
|
||||||
|
@ -41,6 +41,14 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="popup" class="popup">
|
||||||
|
<div class="popup-content">
|
||||||
|
<h2>Bonjour !</h2>
|
||||||
|
<p>Voulez vous des cookies?</p>
|
||||||
|
|
||||||
|
<button id="refuse-button">non :(</button>
|
||||||
|
<button id="accept-button">Avec Plaisir!</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
40
demineur.js
40
demineur.js
|
@ -8,6 +8,18 @@ class Case {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
//Fonction pour créer un cookie.
|
||||||
|
function setCookie(name, value, days) {
|
||||||
|
const expires = new Date(Date.now() + days * 864e5).toUTCString();
|
||||||
|
document.cookie = `${name}=${value}; expires=${expires}; path=/`;
|
||||||
|
}
|
||||||
|
// Fonction pour lire un cookie
|
||||||
|
function getCookie(name) {
|
||||||
|
return document.cookie.split('; ').find(row => row.startsWith(name + '='))?.split('=')[1];
|
||||||
|
}
|
||||||
|
>>>>>>> d322df708ea3bd0301a054980adc49db1c96d181
|
||||||
|
|
||||||
function sleep(ms){
|
function sleep(ms){
|
||||||
return new Promise(resolve => setTimeout(resolve, ms));
|
return new Promise(resolve => setTimeout(resolve, ms));
|
||||||
|
@ -59,13 +71,37 @@ function creerGrille(haut, larg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function cookie(){
|
||||||
|
const popup = document.getElementById('popup');
|
||||||
|
const closePopupButton = document.getElementById('accept-button');
|
||||||
|
|
||||||
|
// Fonction pour afficher la pop-up
|
||||||
|
|
||||||
|
popup.classList.add('show');
|
||||||
|
|
||||||
|
|
||||||
|
// Fonction pour fermer la pop-up
|
||||||
|
closePopupButton.addEventListener('click', () => {
|
||||||
|
setCookie('cookiesAccepted', 'true', 1); // Stocke l'acceptation pendant 1 jour
|
||||||
|
popup.classList.remove('show');
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const cookieAccepted = getCookie('cookiesAccepted');
|
||||||
|
|
||||||
|
if (!cookieAccepted){
|
||||||
|
cookie();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function selectImage(idCase) {
|
function selectImage(idCase) {
|
||||||
const coords = idCase.split("_") ;
|
const coords = idCase.split("_") ;
|
||||||
const x = parseInt(coords[0]) ;
|
const x = parseInt(coords[0]) ;
|
||||||
const y = parseInt(coords[0]) ;
|
const y = parseInt(coords[0]) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function changeImage(mouseEvent) {
|
function changeImage(mouseEvent) {
|
||||||
if (!(mouseEvent.target.classList.contains("buttonFlagged"))) {
|
if (!(mouseEvent.target.classList.contains("buttonFlagged"))) {
|
||||||
|
|
53
style.css
53
style.css
|
@ -38,8 +38,61 @@
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
.popup {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-color: rgba(0, 0, 0, 0.7);
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
z-index: 1000;
|
||||||
|
visibility: hidden;
|
||||||
|
opacity: 0;
|
||||||
|
transition: visibility 0.3s, opacity 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup.show {
|
||||||
|
visibility: visible;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-content {
|
||||||
|
background-color: #fff;
|
||||||
|
padding: 20px;
|
||||||
|
border-radius: 10px;
|
||||||
|
text-align: center;
|
||||||
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
||||||
|
max-width: 400px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#accept-button {
|
||||||
|
background-color: #007BFF;
|
||||||
|
color: #fff;
|
||||||
|
border: none;
|
||||||
|
padding: 10px 20px;
|
||||||
|
border-radius: 5px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
#refuse-button {
|
||||||
|
background-color: #007BFF;
|
||||||
|
color: #fff;
|
||||||
|
border: none;
|
||||||
|
padding: 10px 20px;
|
||||||
|
border-radius: 5px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
#close-popup:hover {
|
||||||
|
background-color: #0056b3;
|
||||||
|
=======
|
||||||
.button_case{
|
.button_case{
|
||||||
width : 50px;
|
width : 50px;
|
||||||
height : 50px;
|
height : 50px;
|
||||||
border : 0px;
|
border : 0px;
|
||||||
|
>>>>>>> 2a2cf84cf311b49f5c290c8502b43f35efa7ec30
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue