diff --git a/css/game.css b/css/game.css index 966b42c..9d33e74 100644 --- a/css/game.css +++ b/css/game.css @@ -170,6 +170,7 @@ body, html { box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.5); z-index: 1000; font-family: Arial, sans-serif; /* Fuente más moderna */ + display: none; } /* Estilo para el modal */ diff --git a/js/CookieLegal.js b/js/CookieLegal.js index 2e96b83..86fa390 100644 --- a/js/CookieLegal.js +++ b/js/CookieLegal.js @@ -1,9 +1,11 @@ +const cookiePolicyVersion = "1.0"; + function openModal() { var modal = document.getElementById("cookiePolicyModal"); var contentContainer = document.getElementById("cookiePolicyContent"); var xhr = new XMLHttpRequest(); - xhr.onreadystatechange = function() { + xhr.onreadystatechange = function () { if (xhr.readyState == 4 && xhr.status == 200) { contentContainer.innerHTML = xhr.responseText; modal.style.display = "block"; @@ -20,9 +22,28 @@ function closeModal() { function acceptCookies() { // Aquí va el código para manejar la aceptación de cookies document.getElementById('cookieConsentPopup').style.display = 'none'; + setCookieConsentInLocalStorage(true); } function rejectCookies() { // Aquí va el código para manejar el rechazo de cookies - document.getElementById('cookieConsentPopup').style.display = 'none'; -} \ No newline at end of file + setCookieConsentInLocalStorage(false) +} + +function setCookieConsentInLocalStorage(consent) { + const consentData = { + consented: consent, + version: cookiePolicyVersion, + date: new Date().toISOString() + }; + localStorage.setItem('cookieConsent', JSON.stringify(consentData)); +} + +window.onload = function () { + const consentString = localStorage.getItem('cookieConsent'); + + if (!consentString) { + document.getElementById('cookieConsentPopup').style.display = 'block'; + return; + } +};