mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-08-03 10:50:23 +00:00
remove some code duplication from #9348
This commit is contained in:
@@ -441,51 +441,27 @@ function updateImg2imgResizeToTextAfterChangingImage(){
|
||||
|
||||
}
|
||||
|
||||
function setRandomSeed(target_interface) {
|
||||
let seed = gradioApp().querySelector(`#${target_interface}_seed input`);
|
||||
if (!seed) {
|
||||
return [];
|
||||
}
|
||||
seed.value = "-1";
|
||||
seed.dispatchEvent(new Event("input"));
|
||||
|
||||
|
||||
function setRandomSeed(elem_id) {
|
||||
var input = gradioApp().querySelector("#" + elem_id + " input");
|
||||
if (!input) return [];
|
||||
|
||||
input.value = "-1";
|
||||
updateInput(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 switchWidthHeight(tabname) {
|
||||
var width = gradioApp().querySelector("#" + tabname + "_width input[type=number]");
|
||||
var height = gradioApp().querySelector("#" + tabname + "_height input[type=number]");
|
||||
if (!width || !height) 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;
|
||||
var tmp = width.value;
|
||||
width.value = height.value;
|
||||
height.value = tmp;
|
||||
width.dispatchEvent(new Event("input"));
|
||||
height.dispatchEvent(new Event("input"));
|
||||
|
||||
updateInput(width);
|
||||
updateInput(height);
|
||||
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 [];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user