fix checkbox behaviour (remember checked)

This commit is contained in:
ReznoRMichael 2021-01-27 03:11:31 +01:00
parent 1836c04310
commit 2f4ae7a4a2
2 changed files with 7 additions and 7 deletions

File diff suppressed because one or more lines are too long

View file

@ -92,10 +92,6 @@ function HKCheckCompletion(jsonObject) {
// Prevents adding current percent data after each function call (each click of Analyze button) // Prevents adding current percent data after each function call (each click of Analyze button)
ResetCompletion(DIV_ID); ResetCompletion(DIV_ID);
// Prevents wrong checkbox behaviour
CheckboxHintsToggle("hide");
CheckboxLocationsToggle("hide");
// Shallow Clone const objects (used for destructive functions) // Shallow Clone const objects (used for destructive functions)
let HK_HINTS_temp = Object.assign({}, HK_HINTS); let HK_HINTS_temp = Object.assign({}, HK_HINTS);
let HK_BOSSES_temp = Object.assign({}, HK_BOSSES); let HK_BOSSES_temp = Object.assign({}, HK_BOSSES);
@ -264,6 +260,10 @@ function HKCheckCompletion(jsonObject) {
CompletionHTML(DIV_ID); CompletionHTML(DIV_ID);
// Prevents wrong checkbox behaviour (must run after everything is finished)
CheckboxHintsToggle();
CheckboxLocationsToggle();
// finish and show benchmark // finish and show benchmark
benchHKCCEnd = new Date(); benchHKCCEnd = new Date();
console.info("HKCheckCompletion() time (ms) =", benchHKCCEnd - benchHKCCBegin); console.info("HKCheckCompletion() time (ms) =", benchHKCCEnd - benchHKCCBegin);
@ -921,7 +921,7 @@ function InitialHTMLPopulate(divIdObj) {
* Toggles display of "hk-hints". On click with no parameters or on demand when called with a parameter * Toggles display of "hk-hints". On click with no parameters or on demand when called with a parameter
* @param {string} param "hide", "show" or none (optional) * @param {string} param "hide", "show" or none (optional)
*/ */
function CheckboxHintsToggle(param) { function CheckboxHintsToggle(param = "none") {
let checkboxId = document.getElementById("checkbox-hints"); let checkboxId = document.getElementById("checkbox-hints");
switch (param) { switch (param) {
@ -950,7 +950,7 @@ function CheckboxHintsToggle(param) {
* Toggles display of ".location" class. On click with no parameters or on demand when called with a parameter * Toggles display of ".location" class. On click with no parameters or on demand when called with a parameter
* @param {string} param "hide", "show" or none (optional) * @param {string} param "hide", "show" or none (optional)
*/ */
function CheckboxLocationsToggle(param) { function CheckboxLocationsToggle(param = "none") {
let checkboxId = document.getElementById("checkbox-locations"); let checkboxId = document.getElementById("checkbox-locations");
let allClassElements = document.querySelectorAll(".location"); let allClassElements = document.querySelectorAll(".location");
let length = allClassElements.length; let length = allClassElements.length;