aboutsummaryrefslogtreecommitdiffstats
path: root/javascript/ui.js
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-12-16 07:05:10 +0000
committerAUTOMATIC1111 <16777216c@gmail.com>2023-12-16 07:05:10 +0000
commite9c6325fc635302e2b4b8295345833cb8b15f7fb (patch)
treeb501070bcf1ae667b1555e682598973818c945e0 /javascript/ui.js
parent29f04149b60bcf6e8e2b41a161d6cc7e8981710f (diff)
parent7504f14503d6ce5a014f1c558ea4f4d57675e1e9 (diff)
downloadstable-diffusion-webui-gfx803-e9c6325fc635302e2b4b8295345833cb8b15f7fb.tar.gz
stable-diffusion-webui-gfx803-e9c6325fc635302e2b4b8295345833cb8b15f7fb.tar.bz2
stable-diffusion-webui-gfx803-e9c6325fc635302e2b4b8295345833cb8b15f7fb.zip
Merge branch 'dev' into torch210
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');
});