FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
stable-diffusion-webui/javascript/generationParams.js at master · dmkwon/stable-diffusion-webui · GitHub
dmkwon
/
stable-diffusion-webui
Public
forked from
AUTOMATIC1111/stable-diffusion-webui
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
stable-diffusion-webui
/
javascript
/
generationParams.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
35 lines (32 loc) · 1.47 KB
Breadcrumbs
stable-diffusion-webui
/
javascript
/
generationParams.js
Copy path
File metadata and controls
35 lines (32 loc) · 1.47 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// attaches listeners to the txt2img and img2img galleries to update displayed generation param text when the image changes
let
txt2img_gallery
,
img2img_gallery
,
modal
=
undefined
;
onAfterUiUpdate
(
function
(
)
{
if
(
!
txt2img_gallery
)
{
txt2img_gallery
=
attachGalleryListeners
(
"txt2img"
)
;
}
if
(
!
img2img_gallery
)
{
img2img_gallery
=
attachGalleryListeners
(
"img2img"
)
;
}
if
(
!
modal
)
{
modal
=
gradioApp
(
)
.
getElementById
(
'lightboxModal'
)
;
modalObserver
.
observe
(
modal
,
{
attributes
:
true
,
attributeFilter
:
[
'style'
]
}
)
;
}
}
)
;
let
modalObserver
=
new
MutationObserver
(
function
(
mutations
)
{
mutations
.
forEach
(
function
(
mutationRecord
)
{
let
selectedTab
=
gradioApp
(
)
.
querySelector
(
'#tabs div button.selected'
)
?.
innerText
;
if
(
mutationRecord
.
target
.
style
.
display
===
'none'
&&
(
selectedTab
===
'txt2img'
||
selectedTab
===
'img2img'
)
)
{
gradioApp
(
)
.
getElementById
(
selectedTab
+
"_generation_info_button"
)
?.
click
(
)
;
}
}
)
;
}
)
;
function
attachGalleryListeners
(
tab_name
)
{
var
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
;
}
Back
|
FazBrowse Home
|
New Git URL