feat: Make it possible to load the character roster from localStorage

This commit is contained in:
2025-06-11 15:18:14 +02:00
parent ccdc0de9f2
commit 9a8db0158c

View File

@@ -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);
},
);
</script>