From 022bc97c2775af882c3c7b4614e8fa85c05c6e95 Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Sat, 10 Sep 2022 08:10:54 +0300 Subject: [PATCH] update for code that was supposed to be hiding mask for the gradio bug but isn't. --- script.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/script.js b/script.js index 7637089e..0f4e79f6 100644 --- a/script.js +++ b/script.js @@ -110,7 +110,6 @@ function addTitles(root){ } tabNames = {"txt2img": 1, "img2img": 1, "Extras": 1, "PNG Info": 1, "Settings": 1} -processedTabs = {} document.addEventListener("DOMContentLoaded", function() { var mutationObserver = new MutationObserver(function(m){ @@ -119,16 +118,18 @@ document.addEventListener("DOMContentLoaded", function() { // fix for gradio breaking when you switch away from tab with mask gradioApp().querySelectorAll('button').forEach(function(button){ title = button.textContent.trim() - if(processedTabs[title]) return if(tabNames[button.textContent.trim()]==null) return; - processedTabs[title]=1 - button.onclick = function(){ - mask_buttons = gradioApp().querySelectorAll('#img2maskimg button'); - if(mask_buttons.length == 2){ - mask_buttons[1].click(); + if(button.onclick == null){ + button.onclick = function(){ + console.log("hiding mask") + mask_buttons = gradioApp().querySelectorAll('#img2maskimg button'); + if(mask_buttons.length == 2){ + mask_buttons[1].click(); + } } } + }) }); mutationObserver.observe( gradioApp(), { childList:true, subtree:true })