Skip to content

Commit

Permalink
add toggle for room history
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffrey-wu committed Dec 27, 2022
1 parent e83a69b commit 8e58ee3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions client/singleplayer/bonuses.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@
<input class="form-check-input" id="toggle-select-by-set-name" type="checkbox" value role="switch" checked>
<label class="form-check-label" for="toggle-select-by-set-name">Select by set name</label>
</div>
<div class="form-check form-switch">
<input class="form-check-input" id="toggle-show-history" type="checkbox" value role="switch" checked>
<label class="form-check-label" for="toggle-show-history">Show question history</label>
</div>
<div class="d-none d-lg-block">
<hr>
<p>
Expand Down
15 changes: 15 additions & 0 deletions client/singleplayer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,23 @@ document.getElementById('toggle-select-by-set-name').addEventListener('click', f
});


document.getElementById('toggle-show-history').addEventListener('click', function () {
if (this.checked) {
document.getElementById('room-history').classList.remove('d-none');
localStorage.setItem('showHistory', 'true');
} else {
document.getElementById('room-history').classList.add('d-none');
localStorage.setItem('showHistory', 'false');
}
});

if (localStorage.getItem('selectBySetName') === 'false') {
document.getElementById('toggle-select-by-set-name').checked = false;
document.getElementById('difficulty-settings').classList.remove('d-none');
document.getElementById('set-settings').classList.add('d-none');
}

if (localStorage.getItem('showHistory') === 'false') {
document.getElementById('toggle-show-history').checked = false;
document.getElementById('room-history').classList.add('d-none');
}
4 changes: 4 additions & 0 deletions client/singleplayer/tossups.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@
<input class="form-check-input" id="toggle-select-by-set-name" type="checkbox" value role="switch" checked>
<label class="form-check-label" for="toggle-select-by-set-name">Select by set name</label>
</div>
<div class="form-check form-switch">
<input class="form-check-input" id="toggle-show-history" type="checkbox" value role="switch" checked>
<label class="form-check-label" for="toggle-show-history">Show question history</label>
</div>
</div>
<div class="col-12 col-lg-9 col-xxl-10">
<div class="buttons position-sticky top-0 pt-2">
Expand Down

0 comments on commit 8e58ee3

Please sign in to comment.