diff options
author | AUTOMATIC <16777216c@gmail.com> | 2022-09-07 18:26:19 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2022-09-07 18:26:19 +0000 |
commit | ee29bb77bfe3d2095bc08861bcdebeea20b890f1 (patch) | |
tree | 52f801f4a6cbc175a716721797d0b0a5f6198fc7 /script.js | |
parent | 795d49aa24846425e0c0ef3caf068d097dc39cbc (diff) | |
download | stable-diffusion-webui-gfx803-ee29bb77bfe3d2095bc08861bcdebeea20b890f1.tar.gz stable-diffusion-webui-gfx803-ee29bb77bfe3d2095bc08861bcdebeea20b890f1.tar.bz2 stable-diffusion-webui-gfx803-ee29bb77bfe3d2095bc08861bcdebeea20b890f1.zip |
FIX GRADIO CRASHING WHEN SWITCHING FROM TAB WITH MASK THANK YOU
Diffstat (limited to 'script.js')
-rw-r--r-- | script.js | 23 |
1 files changed, 21 insertions, 2 deletions
@@ -103,11 +103,31 @@ 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){ addTitles(gradioApp()); + + // 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(); + } + } + }) }); mutationObserver.observe( gradioApp(), { childList:true, subtree:true }) + + }); function selected_gallery_index(){ @@ -150,6 +170,5 @@ function submit(){ for(var i=0;i<arguments.length;i++){ res.push(arguments[i]) } - console.log(res) return res -}
\ No newline at end of file +} |