feat: Make it possible to load the character roster from localStorage
This commit is contained in:
12
index.html
12
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);
|
||||
},
|
||||
);
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user