From 52e5c6bd3d71367a5fff52fc7ebe18c2a8d04d3a Mon Sep 17 00:00:00 2001 From: TechRunner Date: Sat, 18 Oct 2025 01:14:23 -0500 Subject: [PATCH] Added Remeber and Forget me --- javascript/simulation.js | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/javascript/simulation.js b/javascript/simulation.js index d379659..cdc721c 100644 --- a/javascript/simulation.js +++ b/javascript/simulation.js @@ -7,12 +7,31 @@ rock.src = "/media/Art/Rock1.png"; ctx.fill() -document.cookie = "username=TechRunner" +function remeberMe(){ + let input = document.getElementById("username"); + let username = input.value; + document.cookie = "username=" + username; + console.log(username); + cookieStore.getAll().then(data => { + console.log(data); + }) +} +function forgetMe(){ + document.cookie = "username=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/" + console.log("Poof!..."); +} cookieStore.getAll().then(data => { - for(let i = 0; i < data.length; i++){ - console.log(data[i]["value"]); + if (data){ + for(let i = 0; i < data.length; i++){ + console.log(data[i]["value"]); + if (data[i]["name"] == "username"){ + let username = data[i]["value"]; + document.getElementById("intotitle").textContent = "Welcome back " + username + " to the Void System"; + } + } } + console.log(document.cookie); })