Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Overbill1683
Stable Diffusion Webui
提交
5eb7ff77
S
Stable Diffusion Webui
项目概览
Overbill1683
/
Stable Diffusion Webui
10 个月 前同步成功
通知
1736
Star
81
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
分析
仓库
DevOps
项目成员
Pages
S
Stable Diffusion Webui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Pages
分析
分析
仓库分析
DevOps
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
提交
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
5eb7ff77
编写于
3月 25, 2023
作者:
S
space-nuko
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix Send to img2img buttons
上级
a0d07fb5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
34 addition
and
26 deletion
+34
-26
javascript/imageviewer.js
javascript/imageviewer.js
+3
-21
javascript/ui.js
javascript/ui.js
+31
-5
未找到文件。
javascript/imageviewer.js
浏览文件 @
5eb7ff77
...
...
@@ -32,13 +32,7 @@ function negmod(n, m) {
function
updateOnBackgroundChange
()
{
const
modalImage
=
gradioApp
().
getElementById
(
"
modalImage
"
)
if
(
modalImage
&&
modalImage
.
offsetParent
)
{
let
allcurrentButtons
=
gradioApp
().
querySelectorAll
(
"
.gallery-item.transition-all.
\\
!ring-2
"
)
let
currentButton
=
null
allcurrentButtons
.
forEach
(
function
(
elem
)
{
if
(
elem
.
parentElement
.
offsetParent
)
{
currentButton
=
elem
;
}
})
let
currentButton
=
selected_gallery_button
();
if
(
currentButton
?.
children
?.
length
>
0
&&
modalImage
.
src
!=
currentButton
.
children
[
0
].
src
)
{
modalImage
.
src
=
currentButton
.
children
[
0
].
src
;
...
...
@@ -50,22 +44,10 @@ function updateOnBackgroundChange() {
}
function
modalImageSwitch
(
offset
)
{
var
allgalleryButtons
=
gradioApp
().
querySelectorAll
(
"
.gradio-gallery .thumbnail-item
"
)
var
galleryButtons
=
[]
allgalleryButtons
.
forEach
(
function
(
elem
)
{
if
(
elem
.
parentElement
.
offsetParent
)
{
galleryButtons
.
push
(
elem
);
}
})
var
galleryButtons
=
all_gallery_buttons
();
if
(
galleryButtons
.
length
>
1
)
{
var
allcurrentButtons
=
gradioApp
().
querySelectorAll
(
"
.gradio-gallery .thumbnail-item.selected
"
)
var
currentButton
=
null
allcurrentButtons
.
forEach
(
function
(
elem
)
{
if
(
elem
.
parentElement
.
offsetParent
)
{
currentButton
=
elem
;
}
})
var
currentButton
=
selected_gallery_button
();
var
result
=
-
1
galleryButtons
.
forEach
(
function
(
v
,
i
)
{
...
...
javascript/ui.js
浏览文件 @
5eb7ff77
...
...
@@ -7,9 +7,31 @@ function set_theme(theme){
}
}
function
all_gallery_buttons
()
{
var
allGalleryButtons
=
gradioApp
().
querySelectorAll
(
'
[style="display: block;"].tabitem div[id$=_gallery].gradio-gallery .thumbnails > .thumbnail-item.thumbnail-small
'
);
var
visibleGalleryButtons
=
[];
allGalleryButtons
.
forEach
(
function
(
elem
)
{
if
(
elem
.
parentElement
.
offsetParent
)
{
visibleGalleryButtons
.
push
(
elem
);
}
})
return
visibleGalleryButtons
;
}
function
selected_gallery_button
()
{
var
allCurrentButtons
=
gradioApp
().
querySelectorAll
(
'
[style="display: block;"].tabitem div[id$=_gallery].gradio-gallery .thumbnail-item.thumbnail-small.selected
'
);
var
visibleCurrentButton
=
null
;
allCurrentButtons
.
forEach
(
function
(
elem
)
{
if
(
elem
.
parentElement
.
offsetParent
)
{
visibleCurrentButton
=
elem
;
}
})
return
visibleCurrentButton
;
}
function
selected_gallery_index
(){
var
buttons
=
gradioApp
().
querySelectorAll
(
'
[style="display: block;"].tabitem div[id$=_gallery] .gallery-item
'
)
var
button
=
gradioApp
().
querySelector
(
'
[style="display: block;"].tabitem div[id$=_gallery] .gallery-item.
\\
!ring-2
'
)
var
buttons
=
all_gallery_buttons
();
var
button
=
selected_gallery_button
();
var
result
=
-
1
buttons
.
forEach
(
function
(
v
,
i
){
if
(
v
==
button
)
{
result
=
i
}
})
...
...
@@ -18,14 +40,18 @@ function selected_gallery_index(){
}
function
extract_image_from_gallery
(
gallery
){
if
(
gallery
.
length
==
1
){
return
[
gallery
[
0
]]
if
(
gallery
.
length
==
0
){
return
[
null
];
}
if
(
gallery
.
length
==
1
){
return
[
gallery
[
0
]];
}
index
=
selected_gallery_index
()
if
(
index
<
0
||
index
>=
gallery
.
length
){
return
[
null
]
// Use the first image in the gallery as the default
index
=
0
;
}
return
[
gallery
[
index
]];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录