From 241196186be652cfa1e2f129c77ab30a473e6baa Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Thu, 5 Jun 2025 19:29:52 +0200 Subject: [PATCH] Load character roster from localStorage upon startup --- index.html | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/index.html b/index.html index d3a91b4..26cc8be 100644 --- a/index.html +++ b/index.html @@ -433,6 +433,16 @@ input.disabled = !toUnlock; }; + const saveCharacterRoster = () => { + if (!checkLocalStorage()) { + alert("Local Storage is not available, cannot save roster."); + + return; + } + + localStorage.setItem("character-roster", JSON.stringify()) + }; + document.addEventListener( "DOMContentLoaded", () => { @@ -440,6 +450,10 @@ document.getElementById("no-local-storage").style.display = "initial"; alert("Local Storage is not available, saving and loading data will be unavailable."); } + + var newRoster = localStorage.getItem("character-roster"); + + characterRoster = (newRoster === null) ? {} : JSON.parse(newRoster); }, );