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();
|
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(
|
document.addEventListener(
|
||||||
"DOMContentLoaded",
|
"DOMContentLoaded",
|
||||||
() => {
|
() => {
|
||||||
@@ -539,6 +550,7 @@
|
|||||||
btnSaveCharacter.addEventListener("click", saveCurrentCharacter);
|
btnSaveCharacter.addEventListener("click", saveCurrentCharacter);
|
||||||
|
|
||||||
clearSheet();
|
clearSheet();
|
||||||
|
loadCharacterRoster(true);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
Reference in New Issue
Block a user