Skip to content

Commit

Permalink
fix button color
Browse files Browse the repository at this point in the history
  • Loading branch information
daswer123 committed Sep 1, 2023
1 parent 0029e7c commit 74828c4
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions javascript/inpaint-warning.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,28 +177,32 @@ onUiLoaded(async () => {



// Creating an Observer
const observer = new MutationObserver((mutations) => {
for (const mutation of mutations) {
if (mutation.type === "attributes" && mutation.attributeName === "class") {
if (enableLabel) {
handleInputChange(input, inpaintingPattern, inpaintButton);
}

if (enableBtnColor) {
const modelClass = input.value;
if (inpaintingPattern.test(modelClass)) {
// Enable button colors
updateButtonColors(buttons, true, normalColor, hoverColor);
} else {
// Disable button colors
updateButtonColors(buttons, false, normalColor, hoverColor);
// if (mutation.type === "attributes" && mutation.attributeName === "class") {

setTimeout(() => { // delay check for 3 seconds
console.log(input.value)
if (enableLabel) {
handleInputChange(input, inpaintingPattern, inpaintButton);
}

if (enableBtnColor) {
const modelClass = input.value;
if (inpaintingPattern.test(modelClass)) {
// Enable button colors
updateButtonColors(buttons, true, normalColor, hoverColor);
} else {
// Disable button colors
updateButtonColors(buttons, false, normalColor, hoverColor);
}
}
}
}, 3000);

}
}
// }
});

// Beginning Observation
observer.observe(input, { attributes: true });

Expand Down

0 comments on commit 74828c4

Please sign in to comment.