Skip to content

Commit 1710403

Browse files
committed
testing
1 parent 5b7f488 commit 1710403

File tree

1 file changed

+18
-22
lines changed

1 file changed

+18
-22
lines changed

docs/index.html

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<h1 id="title">Mercury 2025</h1>
1414

1515
<div id="pages_container">
16-
<button id="reset_button" onclick="resetPageButton()">Reset Page</button>
16+
<button id="reset_button" onclick="resetAllButton()">Reset All</button>
1717
</div>
1818

1919
<div id="loadingOverlay">Submitting...</div>
@@ -514,7 +514,7 @@ <h1 id="title">Mercury 2025</h1>
514514
}
515515

516516
// clearing old answers and enabling interactive elements
517-
clearAllAnswers(true);
517+
clearAllAnswers(false);
518518
document.body.style.pointerEvents = "auto";
519519
htmlGlobals.loadingOverlay.style.visibility = "hidden";
520520
submitting = false;
@@ -564,23 +564,17 @@ <h1 id="title">Mercury 2025</h1>
564564
localStorage.setItem('unsentSubmissions', JSON.stringify(newUnsentSubmissions));
565565
}
566566

567-
function clearPageAnswers(pageName) {
567+
function clearAllAnswers(ignoreResetTypes) {
568568
for (const question of questionObjects) {
569-
if (question.pageName !== pageName) continue;
570-
localStorage.removeItem(question.id);
571-
question.reset();
572-
}
573-
}
574-
575-
function clearAllAnswers() {
576-
for (const question of questionObjects) {
577-
if (question.resetType === RESET_TYPES.KEEP) continue;
578-
if (question.resetType === RESET_TYPES.INCREASE) {
579-
let value = localStorage.getItem(question.id) || 0;
580-
value = String(parseInt(value) + 1)
581-
localStorage.setItem(question.id, value);
582-
question.value = value;
583-
continue;
569+
if (!ignoreResetTypes) {
570+
if (question.resetType === RESET_TYPES.KEEP) continue;
571+
if (question.resetType === RESET_TYPES.INCREASE) {
572+
let value = localStorage.getItem(question.id) || 0;
573+
value = String(parseInt(value) + 1)
574+
localStorage.setItem(question.id, value);
575+
question.value = value;
576+
continue;
577+
}
584578
}
585579
localStorage.removeItem(question.id);
586580
question.reset();
@@ -692,12 +686,14 @@ <h1 id="title">Mercury 2025</h1>
692686
}, false);
693687
}
694688

695-
function resetPageButton() {
696-
const userConfirmed = confirm("Are you sure you want to reset Page?");
689+
function resetAllButton() {
690+
const userConfirmed = confirm("Are you sure you want to reset All?");
697691
if (userConfirmed) {
698-
clearPageAnswers(localStorage.getItem('currentPage') || pageMaps[0].name);
692+
clearAllAnswers(true);
693+
displayPage(pageMaps[0].name);
694+
} else {
695+
displayPage(localStorage.getItem('currentPage') || pageMaps[0].name);
699696
}
700-
displayPage(localStorage.getItem('currentPage') || pageMaps[0].name);
701697
}
702698

703699
function initializeApp() {

0 commit comments

Comments
 (0)