Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sephuroth11
stable-diffusion-webui
提交
db27b987
S
stable-diffusion-webui
项目概览
sephuroth11
/
stable-diffusion-webui
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
stable-diffusion-webui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
db27b987
编写于
10月 15, 2022
作者:
A
aoirusann
提交者:
AUTOMATIC1111
10月 15, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add hint for `ctrl/alt enter`
And duplicate implementations are removed
上级
661a6198
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
10 addition
and
14 deletion
+10
-14
javascript/ui.js
javascript/ui.js
+0
-10
modules/ui.py
modules/ui.py
+8
-2
script.js
script.js
+2
-2
未找到文件。
javascript/ui.js
浏览文件 @
db27b987
...
@@ -187,12 +187,10 @@ onUiUpdate(function(){
...
@@ -187,12 +187,10 @@ onUiUpdate(function(){
if
(
!
txt2img_textarea
)
{
if
(
!
txt2img_textarea
)
{
txt2img_textarea
=
gradioApp
().
querySelector
(
"
#txt2img_prompt > label > textarea
"
);
txt2img_textarea
=
gradioApp
().
querySelector
(
"
#txt2img_prompt > label > textarea
"
);
txt2img_textarea
?.
addEventListener
(
"
input
"
,
()
=>
update_token_counter
(
"
txt2img_token_button
"
));
txt2img_textarea
?.
addEventListener
(
"
input
"
,
()
=>
update_token_counter
(
"
txt2img_token_button
"
));
txt2img_textarea
?.
addEventListener
(
"
keyup
"
,
(
event
)
=>
submit_prompt
(
event
,
"
txt2img_generate
"
));
}
}
if
(
!
img2img_textarea
)
{
if
(
!
img2img_textarea
)
{
img2img_textarea
=
gradioApp
().
querySelector
(
"
#img2img_prompt > label > textarea
"
);
img2img_textarea
=
gradioApp
().
querySelector
(
"
#img2img_prompt > label > textarea
"
);
img2img_textarea
?.
addEventListener
(
"
input
"
,
()
=>
update_token_counter
(
"
img2img_token_button
"
));
img2img_textarea
?.
addEventListener
(
"
input
"
,
()
=>
update_token_counter
(
"
img2img_token_button
"
));
img2img_textarea
?.
addEventListener
(
"
keyup
"
,
(
event
)
=>
submit_prompt
(
event
,
"
img2img_generate
"
));
}
}
})
})
...
@@ -220,14 +218,6 @@ function update_token_counter(button_id) {
...
@@ -220,14 +218,6 @@ function update_token_counter(button_id) {
token_timeout
=
setTimeout
(()
=>
gradioApp
().
getElementById
(
button_id
)?.
click
(),
wait_time
);
token_timeout
=
setTimeout
(()
=>
gradioApp
().
getElementById
(
button_id
)?.
click
(),
wait_time
);
}
}
function
submit_prompt
(
event
,
generate_button_id
)
{
if
(
event
.
altKey
&&
event
.
keyCode
===
13
)
{
event
.
preventDefault
();
gradioApp
().
getElementById
(
generate_button_id
).
click
();
return
;
}
}
function
restart_reload
(){
function
restart_reload
(){
document
.
body
.
innerHTML
=
'
<h1 style="font-family:monospace;margin-top:20%;color:lightgray;text-align:center;">Reloading...</h1>
'
;
document
.
body
.
innerHTML
=
'
<h1 style="font-family:monospace;margin-top:20%;color:lightgray;text-align:center;">Reloading...</h1>
'
;
setTimeout
(
function
(){
location
.
reload
()},
2000
)
setTimeout
(
function
(){
location
.
reload
()},
2000
)
...
...
modules/ui.py
浏览文件 @
db27b987
...
@@ -433,7 +433,10 @@ def create_toprow(is_img2img):
...
@@ -433,7 +433,10 @@ def create_toprow(is_img2img):
with
gr
.
Row
():
with
gr
.
Row
():
with
gr
.
Column
(
scale
=
80
):
with
gr
.
Column
(
scale
=
80
):
with
gr
.
Row
():
with
gr
.
Row
():
prompt
=
gr
.
Textbox
(
label
=
"Prompt"
,
elem_id
=
f
"
{
id_part
}
_prompt"
,
show_label
=
False
,
placeholder
=
"Prompt"
,
lines
=
2
)
prompt
=
gr
.
Textbox
(
label
=
"Prompt"
,
elem_id
=
f
"
{
id_part
}
_prompt"
,
show_label
=
False
,
lines
=
2
,
placeholder
=
"Prompt (press Ctrl+Enter or Alt+Enter to generate)"
)
with
gr
.
Column
(
scale
=
1
,
elem_id
=
"roll_col"
):
with
gr
.
Column
(
scale
=
1
,
elem_id
=
"roll_col"
):
roll
=
gr
.
Button
(
value
=
art_symbol
,
elem_id
=
"roll"
,
visible
=
len
(
shared
.
artist_db
.
artists
)
>
0
)
roll
=
gr
.
Button
(
value
=
art_symbol
,
elem_id
=
"roll"
,
visible
=
len
(
shared
.
artist_db
.
artists
)
>
0
)
paste
=
gr
.
Button
(
value
=
paste_symbol
,
elem_id
=
"paste"
)
paste
=
gr
.
Button
(
value
=
paste_symbol
,
elem_id
=
"paste"
)
...
@@ -446,7 +449,10 @@ def create_toprow(is_img2img):
...
@@ -446,7 +449,10 @@ def create_toprow(is_img2img):
with
gr
.
Row
():
with
gr
.
Row
():
with
gr
.
Column
(
scale
=
8
):
with
gr
.
Column
(
scale
=
8
):
with
gr
.
Row
():
with
gr
.
Row
():
negative_prompt
=
gr
.
Textbox
(
label
=
"Negative prompt"
,
elem_id
=
"negative_prompt"
,
show_label
=
False
,
placeholder
=
"Negative prompt"
,
lines
=
2
)
negative_prompt
=
gr
.
Textbox
(
label
=
"Negative prompt"
,
elem_id
=
f
"
{
id_part
}
_neg_prompt"
,
show_label
=
False
,
lines
=
2
,
placeholder
=
"Negative prompt (press Ctrl+Enter or Alt+Enter to generate)"
)
with
gr
.
Column
(
scale
=
1
,
elem_id
=
"roll_col"
):
with
gr
.
Column
(
scale
=
1
,
elem_id
=
"roll_col"
):
sh
=
gr
.
Button
(
elem_id
=
"sh"
,
visible
=
True
)
sh
=
gr
.
Button
(
elem_id
=
"sh"
,
visible
=
True
)
...
...
script.js
浏览文件 @
db27b987
...
@@ -50,9 +50,9 @@ document.addEventListener("DOMContentLoaded", function() {
...
@@ -50,9 +50,9 @@ document.addEventListener("DOMContentLoaded", function() {
document
.
addEventListener
(
'
keydown
'
,
function
(
e
)
{
document
.
addEventListener
(
'
keydown
'
,
function
(
e
)
{
var
handled
=
false
;
var
handled
=
false
;
if
(
e
.
key
!==
undefined
)
{
if
(
e
.
key
!==
undefined
)
{
if
((
e
.
key
==
"
Enter
"
&&
(
e
.
metaKey
||
e
.
ctrlKey
)))
handled
=
true
;
if
((
e
.
key
==
"
Enter
"
&&
(
e
.
metaKey
||
e
.
ctrlKey
||
e
.
altKey
)))
handled
=
true
;
}
else
if
(
e
.
keyCode
!==
undefined
)
{
}
else
if
(
e
.
keyCode
!==
undefined
)
{
if
((
e
.
keyCode
==
13
&&
(
e
.
metaKey
||
e
.
ctrlKey
)))
handled
=
true
;
if
((
e
.
keyCode
==
13
&&
(
e
.
metaKey
||
e
.
ctrlKey
||
e
.
altKey
)))
handled
=
true
;
}
}
if
(
handled
)
{
if
(
handled
)
{
button
=
get_uiCurrentTabContent
().
querySelector
(
'
button[id$=_generate]
'
);
button
=
get_uiCurrentTabContent
().
querySelector
(
'
button[id$=_generate]
'
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录