Skip to content

Commit

Permalink
Utterance checkbox not saved (#185)
Browse files Browse the repository at this point in the history
Adds a new local storage element "utterance-allowed".
  • Loading branch information
ProgramComputer authored Jan 7, 2024
1 parent 12a90a3 commit e26d469
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions do_test_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,15 @@ function do_test_prepare_ajax_test_area($selector, $selection, $count, $testtype

?>
<script type="text/javascript">
window.onload = (event) => {
var utterancecheckbox = document.getElementById('utterance-allowed')

var utterancechecked = JSON.parse(localStorage.getItem('utterance-allowed'));
utterancecheckbox.checked = utterancechecked;
utterancecheckbox.addEventListener('change', function () {
localStorage.setItem('utterance-allowed', utterancecheckbox.checked);
});
};
/**
* Get a new word test.
*/
Expand Down

0 comments on commit e26d469

Please sign in to comment.