diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-05-17 20:19:08 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-17 20:19:08 +0000 |
commit | 1d1b5da4bfc6ff899146b6198464134502374e7e (patch) | |
tree | 1cb30a63099a69f678d4901b495203b765a6df59 /javascript/ui.js | |
parent | b397f63e00bbfbe9087d80abb457aa9a593b181b (diff) | |
parent | 04b4508a66de58c9f3a422fdcad4dd2ec3ad39ce (diff) | |
download | stable-diffusion-webui-gfx803-1d1b5da4bfc6ff899146b6198464134502374e7e.tar.gz stable-diffusion-webui-gfx803-1d1b5da4bfc6ff899146b6198464134502374e7e.tar.bz2 stable-diffusion-webui-gfx803-1d1b5da4bfc6ff899146b6198464134502374e7e.zip |
Merge pull request #9348 from space-nuko/improve-frontend-responsiveness
Improve frontend responsiveness for some buttons
Diffstat (limited to 'javascript/ui.js')
-rw-r--r-- | javascript/ui.js | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/javascript/ui.js b/javascript/ui.js index ed9673d6..56ee05aa 100644 --- a/javascript/ui.js +++ b/javascript/ui.js @@ -438,4 +438,54 @@ function updateImg2imgResizeToTextAfterChangingImage(){ }, 500); return [] + +} + +function setRandomSeed(target_interface) { + let seed = gradioApp().querySelector(`#${target_interface}_seed input`); + if (!seed) { + return []; + } + seed.value = "-1"; + seed.dispatchEvent(new Event("input")); + return []; +} + +function setRandomSubseed(target_interface) { + let subseed = gradioApp().querySelector(`#${target_interface}_subseed input`); + if (!subseed) { + return []; + } + subseed.value = "-1"; + subseed.dispatchEvent(new Event("input")); + return []; +} + +function switchWidthHeightTxt2Img() { + let width = gradioApp().querySelector("#txt2img_width input[type=number]"); + let height = gradioApp().querySelector("#txt2img_height input[type=number]"); + if (!width || !height) { + return []; + } + let tmp = width.value; + width.value = height.value; + height.value = tmp; + width.dispatchEvent(new Event("input")); + height.dispatchEvent(new Event("input")); + return []; +} + +function switchWidthHeightImg2Img() { + let width = gradioApp().querySelector("#img2img_width input[type=number]"); + let height = gradioApp().querySelector("#img2img_height input[type=number]"); + if (!width || !height) { + return []; + } + let tmp = width.value; + width.value = height.value; + height.value = tmp; + width.dispatchEvent(new Event("input")); + height.dispatchEvent(new Event("input")); + return []; } + |