mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 01:04:32 +02:00
update gradio
This commit is contained in:
@@ -1,7 +1,27 @@
|
||||
/* global gradioApp, onUiUpdate */
|
||||
// attaches listeners to the txt2img and img2img galleries to update displayed generation param text when the image changes
|
||||
|
||||
let txt2img_gallery; let img2img_gallery; let
|
||||
modal;
|
||||
function attachGalleryListeners(tab_name) {
|
||||
const gallery = gradioApp().querySelector(`#${tab_name}_gallery`);
|
||||
gallery?.addEventListener('click', () => setTimeout(() => {
|
||||
gradioApp()
|
||||
.getElementById(`${tab_name}_generation_info_button`)
|
||||
?.click();
|
||||
}, 500));
|
||||
gallery?.addEventListener('keydown', (e) => {
|
||||
if (e.keyCode == 37 || e.keyCode == 39) { // left or right arrow
|
||||
gradioApp()
|
||||
.getElementById(`${tab_name}_generation_info_button`)
|
||||
.click();
|
||||
}
|
||||
});
|
||||
return gallery;
|
||||
}
|
||||
|
||||
let txt2img_gallery;
|
||||
let img2img_gallery;
|
||||
let modal;
|
||||
|
||||
onUiUpdate(() => {
|
||||
if (!txt2img_gallery) txt2img_gallery = attachGalleryListeners('txt2img');
|
||||
if (!img2img_gallery) img2img_gallery = attachGalleryListeners('img2img');
|
||||
@@ -19,12 +39,3 @@ let modalObserver = new MutationObserver((mutations) => {
|
||||
});
|
||||
});
|
||||
|
||||
function attachGalleryListeners(tab_name) {
|
||||
gallery = gradioApp().querySelector(`#${tab_name}_gallery`);
|
||||
gallery?.addEventListener('click', () => gradioApp().getElementById(`${tab_name}_generation_info_button`).click());
|
||||
gallery?.addEventListener('keydown', (e) => {
|
||||
if (e.keyCode == 37 || e.keyCode == 39) // left or right arrow
|
||||
{ gradioApp().getElementById(`${tab_name}_generation_info_button`).click(); }
|
||||
});
|
||||
return gallery;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user