From 9a8db0158c1136ce11b14c4ef25d2ff6b0f477b8 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Wed, 11 Jun 2025 15:18:14 +0200 Subject: [PATCH] feat: Make it possible to load the character roster from localStorage --- index.html | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/index.html b/index.html index 5acf19c..0aca890 100644 --- a/index.html +++ b/index.html @@ -523,6 +523,17 @@ saveCharacterRoster(); }; + const loadCharacterRoster = (doLocalStorageCheck) => { + if (doLocalStorageCheck && !checkLocalStorage()) { + alert("Local Storage is not available, cannot load roster."); + + return; + } + + var newRoster = localStorage.getItem("character-roster"); + characterRoster = (newRoster === null) ? {} : JSON.parse(newRoster); + }; + document.addEventListener( "DOMContentLoaded", () => { @@ -539,6 +550,7 @@ btnSaveCharacter.addEventListener("click", saveCurrentCharacter); clearSheet(); + loadCharacterRoster(true); }, );