feat(character-sheet): Create the clearSheet() helper
This commit is contained in:
37
index.html
37
index.html
@@ -345,6 +345,28 @@
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
const poolTypes = ["might", "speed", "intellect"];
|
||||
|
||||
const inpCampaignName = document.getElementById("inp-campaign-name");
|
||||
const inpCharacterName = document.getElementById("inp-character-name");
|
||||
const inpMaxEffort = document.getElementById("inp-max-effort");
|
||||
const inpArmor = document.getElementById("inp-armor");
|
||||
const inpPoolValue = {
|
||||
might: document.getElementById("inp-pool-value-might"),
|
||||
speed: document.getElementById("inp-pool-value-speed"),
|
||||
intellect: document.getElementById("inp-pool-value-intellect"),
|
||||
};
|
||||
const inpPoolMax = {
|
||||
might: document.getElementById("inp-pool-max-might"),
|
||||
speed: document.getElementById("inp-pool-max-speed"),
|
||||
intellect: document.getElementById("inp-pool-max-intellect"),
|
||||
};
|
||||
const inpPoolEdge = {
|
||||
might: document.getElementById("inp-pool-edge-might"),
|
||||
speed: document.getElementById("inp-pool-edge-speed"),
|
||||
intellect: document.getElementById("inp-pool-edge-intellect"),
|
||||
};
|
||||
|
||||
const checkLocalStorage = () => {
|
||||
let storage;
|
||||
try {
|
||||
@@ -374,6 +396,19 @@
|
||||
input.disabled = !toUnlock;
|
||||
};
|
||||
|
||||
const clearSheet = () => {
|
||||
inpCampaignName.value = "";
|
||||
inpCharacterName.value = "";
|
||||
inpMaxEffort.value = 1;
|
||||
inpArmor.value = 0;
|
||||
|
||||
for (var poolType of poolTypes) {
|
||||
inpPoolValue[poolType].value = 0;
|
||||
inpPoolMax[poolType].value = 0;
|
||||
inpPoolEdge[poolType].value = 0;
|
||||
}
|
||||
};
|
||||
|
||||
document.addEventListener(
|
||||
"DOMContentLoaded",
|
||||
() => {
|
||||
@@ -385,6 +420,8 @@
|
||||
document
|
||||
.querySelectorAll(".input-unlocker")
|
||||
.forEach((elem) => {elem.addEventListener("change", toggleInputLockedHandler)});
|
||||
|
||||
clearSheet();
|
||||
},
|
||||
);
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user