diff --git a/client/singleplayer/bonuses.js b/client/singleplayer/bonuses.js index bf5170662..32dbc3678 100644 --- a/client/singleplayer/bonuses.js +++ b/client/singleplayer/bonuses.js @@ -343,6 +343,7 @@ document.getElementById('difficulties').addEventListener('change', function () { randomQuestions = []; difficulties = getDropdownValues('difficulties'); loadRandomBonuses(difficulties, validCategories, validSubcategories); + localStorage.setItem('difficultiesBonusSave', JSON.stringify(difficulties)); }); @@ -491,6 +492,18 @@ window.onload = async () => { updateStatDisplay(); + if (localStorage.getItem('difficultiesBonusSave')) { + difficulties = JSON.parse(localStorage.getItem('difficultiesBonusSave')); + for (let element of document.getElementById('difficulties').children) { + const input = element.querySelector('input'); + const difficulty = parseInt(input.value); + if (difficulties.includes(difficulty)) { + element.classList.add('active'); + input.checked = true; + } + } + } + if (localStorage.getItem('packetNumberBonusSave')) { document.getElementById('packet-number').value = localStorage.getItem('packetNumberBonusSave'); } diff --git a/client/singleplayer/tossups.js b/client/singleplayer/tossups.js index 188b56daf..d5f365870 100644 --- a/client/singleplayer/tossups.js +++ b/client/singleplayer/tossups.js @@ -492,6 +492,7 @@ document.getElementById('difficulties').addEventListener('change', function () { randomQuestions = []; difficulties = getDropdownValues('difficulties'); loadRandomTossups(difficulties, validCategories, validSubcategories); + localStorage.setItem('difficultiesTossupSave', JSON.stringify(difficulties)); }); @@ -644,6 +645,18 @@ window.onload = async () => { updateStatDisplay(); + if (localStorage.getItem('difficultiesTossupSave')) { + difficulties = JSON.parse(localStorage.getItem('difficultiesTossupSave')); + for (let element of document.getElementById('difficulties').children) { + const input = element.querySelector('input'); + const difficulty = parseInt(input.value); + if (difficulties.includes(difficulty)) { + element.classList.add('active'); + input.checked = true; + } + } + } + if (localStorage.getItem('packetNumberTossupSave')) { document.getElementById('packet-number').value = localStorage.getItem('packetNumberTossupSave'); }