From e9162572506b9151e01d7b71422aed3838af5a18 Mon Sep 17 00:00:00 2001 From: buzz-lightsnack-2007 <73412182+buzz-lightsnack-2007@users.noreply.github.com> Date: Wed, 10 Apr 2024 23:24:42 +0800 Subject: [PATCH] prevent excessively setting CONTAINER's disabled state --- gui/scripts/windowman.JS | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gui/scripts/windowman.JS b/gui/scripts/windowman.JS index 160897e..b1826ce 100644 --- a/gui/scripts/windowman.JS +++ b/gui/scripts/windowman.JS @@ -386,6 +386,9 @@ export default class windowman { input_element.getAttribute("data-enable"), )) : false); + if ((input_element.parentElement.nodeName.toLowerCase()).includes(`li`)) { + input_element.parentElement.disabled = input_element.disabled; + } })(); } }); @@ -495,9 +498,9 @@ export default class windowman { if (CONTAINERS) { (CONTAINERS).forEach((CONTAINER) => { + CONTAINER.disabled = (ITEM != null) ? !((typeof ITEM).includes(`obj`) && !Array.isArray(ITEM)) : true; ([].concat(CONTAINER.querySelectorAll(`[data-result-content]`), CONTAINER.querySelectorAll(`[data-result-store]`), document.querySelectorAll(`[data-result-enable]`))).forEach(async function (ELEMENTS) { if (ELEMENTS) { - CONTAINER.disabled = (ITEM != null) ? !((typeof ITEM).includes(`obj`) && !Array.isArray(ITEM)) : true; (ELEMENTS).forEach(async function(ELEMENT) { ELEMENT.disabled = CONTAINER.disabled; if (!ELEMENT.disabled) { @@ -575,6 +578,11 @@ export default class windowman { } else if (ELEMENT.getAttribute(`data-result-content`) || ELEMENT.getAttribute(`data-result-store`)) { ELEMENT.innerText = ``; } + + // Disable the list element if in case it is a clickable element. + if ((ELEMENT.parentElement.nodeName.toLowerCase()).includes(`li`)) { + ELEMENT.parentElement.disabled = CONTAINER.disabled; + } }; }) }