aboutsummaryrefslogtreecommitdiffstats
path: root/javascript/ui.js
diff options
context:
space:
mode:
authorhako-mikan <122196982+hako-mikan@users.noreply.github.com>2024-02-09 14:17:40 +0000
committerGitHub <noreply@github.com>2024-02-09 14:17:40 +0000
commit0bc7867ccd4ac24f5f270cb767c4642d0a0c001c (patch)
tree2ad13a0cf77bc189a8c9097bd507f9674f993da6 /javascript/ui.js
parent816096e642187a18b11e2729c42c0b5f677f047d (diff)
parentcf2772fab0af5573da775e7437e6acdca424f26e (diff)
downloadstable-diffusion-webui-gfx803-0bc7867ccd4ac24f5f270cb767c4642d0a0c001c.tar.gz
stable-diffusion-webui-gfx803-0bc7867ccd4ac24f5f270cb767c4642d0a0c001c.tar.bz2
stable-diffusion-webui-gfx803-0bc7867ccd4ac24f5f270cb767c4642d0a0c001c.zip
Merge branch 'AUTOMATIC1111:master' into master
Diffstat (limited to 'javascript/ui.js')
-rw-r--r--javascript/ui.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/javascript/ui.js b/javascript/ui.js
index 2e262602..18c9f891 100644
--- a/javascript/ui.js
+++ b/javascript/ui.js
@@ -170,6 +170,23 @@ function submit_img2img() {
return res;
}
+function submit_extras() {
+ showSubmitButtons('extras', false);
+
+ var id = randomId();
+
+ requestProgress(id, gradioApp().getElementById('extras_gallery_container'), gradioApp().getElementById('extras_gallery'), function() {
+ showSubmitButtons('extras', true);
+ });
+
+ var res = create_submit_args(arguments);
+
+ res[0] = id;
+
+ console.log(res);
+ return res;
+}
+
function restoreProgressTxt2img() {
showRestoreProgressButton("txt2img", false);
var id = localGet("txt2img_task_id");
@@ -198,9 +215,33 @@ function restoreProgressImg2img() {
}
+/**
+ * Configure the width and height elements on `tabname` to accept
+ * pasting of resolutions in the form of "width x height".
+ */
+function setupResolutionPasting(tabname) {
+ var width = gradioApp().querySelector(`#${tabname}_width input[type=number]`);
+ var height = gradioApp().querySelector(`#${tabname}_height input[type=number]`);
+ for (const el of [width, height]) {
+ el.addEventListener('paste', function(event) {
+ var pasteData = event.clipboardData.getData('text/plain');
+ var parsed = pasteData.match(/^\s*(\d+)\D+(\d+)\s*$/);
+ if (parsed) {
+ width.value = parsed[1];
+ height.value = parsed[2];
+ updateInput(width);
+ updateInput(height);
+ event.preventDefault();
+ }
+ });
+ }
+}
+
onUiLoaded(function() {
showRestoreProgressButton('txt2img', localGet("txt2img_task_id"));
showRestoreProgressButton('img2img', localGet("img2img_task_id"));
+ setupResolutionPasting('txt2img');
+ setupResolutionPasting('img2img');
});