mirror of
https://github.com/anapnoe/stable-diffusion-webui-ux.git
synced 2026-09-19 01:05:13 +02:00
fixes some issues with gradio 3.28.1
This commit is contained in:
+19
-14
@@ -58,7 +58,7 @@ function modalImageSwitch(offset) {
|
||||
})
|
||||
|
||||
if (result != -1) {
|
||||
var nextButton = galleryButtons[negmod((result + offset), galleryButtons.length)]
|
||||
nextButton = galleryButtons[negmod((result + offset), galleryButtons.length)]
|
||||
nextButton.click()
|
||||
const modalImage = gradioApp().getElementById("modalImage");
|
||||
const modal = gradioApp().getElementById("lightboxModal");
|
||||
@@ -145,11 +145,15 @@ function setupImageForLightbox(e) {
|
||||
}
|
||||
|
||||
function modalZoomSet(modalImage, enable) {
|
||||
if(modalImage) modalImage.classList.toggle('modalImageFullscreen', !!enable);
|
||||
if (enable) {
|
||||
modalImage.classList.add('modalImageFullscreen');
|
||||
} else {
|
||||
modalImage.classList.remove('modalImageFullscreen');
|
||||
}
|
||||
}
|
||||
|
||||
function modalZoomToggle(event) {
|
||||
var modalImage = gradioApp().getElementById("modalImage");
|
||||
modalImage = gradioApp().getElementById("modalImage");
|
||||
modalZoomSet(modalImage, !modalImage.classList.contains('modalImageFullscreen'))
|
||||
event.stopPropagation()
|
||||
}
|
||||
@@ -176,7 +180,7 @@ function galleryImageHandler(e) {
|
||||
}
|
||||
|
||||
onUiUpdate(function() {
|
||||
var fullImg_preview = gradioApp().querySelectorAll('.gradio-gallery > div > img')
|
||||
fullImg_preview = gradioApp().querySelectorAll('.gradio-gallery > div > img')
|
||||
if (fullImg_preview != null) {
|
||||
fullImg_preview.forEach(setupImageForLightbox);
|
||||
}
|
||||
@@ -248,11 +252,8 @@ document.addEventListener("DOMContentLoaded", function() {
|
||||
|
||||
modal.appendChild(modalNext)
|
||||
|
||||
try {
|
||||
gradioApp().appendChild(modal);
|
||||
} catch (e) {
|
||||
gradioApp().body.appendChild(modal);
|
||||
}
|
||||
gradioApp().appendChild(modal)
|
||||
|
||||
|
||||
document.body.appendChild(modal);
|
||||
|
||||
@@ -361,10 +362,13 @@ function createGallerySpotlight() {
|
||||
//console.log("clicked");
|
||||
slide = 0;
|
||||
gallery = [];
|
||||
|
||||
gradioApp().querySelectorAll("#"+selectedTabItemId+' .grid-wrap img').forEach(function (elem, i){
|
||||
|
||||
|
||||
gradioApp().querySelectorAll("#"+selectedTabItemId+' .thumbnails img').forEach(function (elem, i){
|
||||
elem.setAttribute("gal-id", i);
|
||||
if(fullImg_src == elem.src) slide = (i+1);
|
||||
//if(fullImg_src == elem.src) slide = parseInt(i+1);
|
||||
if(elem.parentElement.className.indexOf("selected") != -1) slide = parseInt(i+1);
|
||||
//console.log(slide);
|
||||
gallery[i] = {
|
||||
src: elem.src,
|
||||
title: "Seed:" + elem.src,
|
||||
@@ -406,7 +410,7 @@ function createGallerySpotlight() {
|
||||
|
||||
},
|
||||
onclose: function(index){
|
||||
gradioApp().querySelector("#"+selectedTabItemId+' .thumbnail-item:nth-child('+(slide+1)+')').click();
|
||||
gradioApp().querySelector("#"+selectedTabItemId+' .thumbnails .thumbnail-item:nth-child('+(slide+1)+')').click();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -431,13 +435,14 @@ function onUiHeaderTabUpdate(){
|
||||
intervalUiUpdateIViewer = setInterval(onUiUpdateIViewer, 500);
|
||||
}
|
||||
|
||||
|
||||
let fullImg_preview;
|
||||
function onUiUpdateIViewer(){
|
||||
clearInterval(intervalUiUpdateIViewer);
|
||||
//update_performant_inputs(selectedTabItemId);
|
||||
|
||||
//fullImg_preview = gradioApp().querySelector('#'+selectedTabItemId+' [id$="2img_results"] .modify-upload + img.w-full.object-contain');
|
||||
fullImg_preview = gradioApp().querySelector('#'+selectedTabItemId+' .preview img');
|
||||
fullImg_preview = gradioApp().querySelector('#'+selectedTabItemId+' .preview > img');
|
||||
if(opts.js_modal_lightbox && fullImg_preview ) {
|
||||
|
||||
fullImg_src = fullImg_preview.src;
|
||||
|
||||
+6
-4
@@ -374,7 +374,7 @@ onUiUpdate(function(){
|
||||
/* auto grow textarea */
|
||||
function autoGrowPromptTextarea(){
|
||||
gradioApp().querySelectorAll('[id$="_prompt"] textarea').forEach(function (elem) {
|
||||
elem.focus();
|
||||
elem.parentElement.click();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -386,10 +386,12 @@ onUiUpdate(function(){
|
||||
e.target.style.minHeight = e.target.scrollHeight + offset + 2 + 'px';
|
||||
});
|
||||
|
||||
elem.addEventListener('focus', function (e) {
|
||||
e.target.style.minHeight = 'auto';
|
||||
e.target.style.minHeight = e.target.scrollHeight + offset + 2 + 'px';
|
||||
elem.parentElement.addEventListener('click', function (e) {
|
||||
let textarea = e.currentTarget.querySelector('textarea');
|
||||
textarea.style.minHeight = 'auto';
|
||||
textarea.style.minHeight = textarea.scrollHeight + offset + 2 + 'px';
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user