finalisation popup cookie
This commit is contained in:
parent
091919c612
commit
8b895ee383
2 changed files with 23 additions and 45 deletions
43
demineur.js
43
demineur.js
|
@ -8,18 +8,6 @@ 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){
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
|
@ -44,15 +32,7 @@ async function reset(){
|
|||
|
||||
}
|
||||
|
||||
function Cookies() {
|
||||
var accept = confirm("Tu veux des cookies ?");
|
||||
if (accept === true) {
|
||||
alert("Bon jeu!");
|
||||
} else {
|
||||
Cookies();
|
||||
}
|
||||
}
|
||||
//Cookies();
|
||||
|
||||
|
||||
|
||||
let grille = [];
|
||||
|
@ -70,21 +50,32 @@ function creerGrille(haut, larg) {
|
|||
|
||||
}
|
||||
|
||||
// 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];
|
||||
}
|
||||
|
||||
|
||||
function cookie(){
|
||||
const popup = document.getElementById('popup');
|
||||
const closePopupButton = document.getElementById('accept-button');
|
||||
|
||||
const close_popup_button = document.getElementById('accept-button');
|
||||
const keep_popup_button = document.getElementById('refuse-button');
|
||||
// Fonction pour afficher la pop-up
|
||||
|
||||
popup.classList.add('show');
|
||||
|
||||
keep_popup_button.addEventListener('click', () => {
|
||||
keep_popup_button.style.display = 'none';
|
||||
});
|
||||
|
||||
// Fonction pour fermer la pop-up
|
||||
closePopupButton.addEventListener('click', () => {
|
||||
setCookie('cookiesAccepted', 'true', 1); // Stocke l'acceptation pendant 1 jour
|
||||
close_popup_button.addEventListener('click', () => {
|
||||
// setCookie('cookiesAccepted', 'true', 1); // Stocke l'acceptation pendant 1 jour
|
||||
popup.classList.remove('show');
|
||||
});
|
||||
|
||||
|
|
23
style.css
23
style.css
|
@ -38,7 +38,6 @@
|
|||
padding-right: 10px;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
.popup {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
|
@ -70,15 +69,7 @@
|
|||
width: 100%;
|
||||
}
|
||||
|
||||
#accept-button {
|
||||
background-color: #007BFF;
|
||||
color: #fff;
|
||||
border: none;
|
||||
padding: 10px 20px;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
#refuse-button {
|
||||
#accept-button, #refuse-button {
|
||||
background-color: #007BFF;
|
||||
color: #fff;
|
||||
border: none;
|
||||
|
@ -87,12 +78,8 @@
|
|||
cursor: pointer;
|
||||
}
|
||||
|
||||
#close-popup:hover {
|
||||
background-color: #0056b3;
|
||||
=======
|
||||
.button_case{
|
||||
width : 50px;
|
||||
height : 50px;
|
||||
border : 0px;
|
||||
>>>>>>> 2a2cf84cf311b49f5c290c8502b43f35efa7ec30
|
||||
|
||||
#refuse-button:hover,#accept-button:hover {
|
||||
background-color: #1ecfee;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue