Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Stable Diffusion Webui
Commits
8410b135
Commit
8410b135
authored
Mar 26, 2023
by
missionfloyd
Committed by
GitHub
Mar 26, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'AUTOMATIC1111:master' into extra-network-preview-lazyload
parents
cb8c447f
3b5a3fab
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
27 deletions
+60
-27
javascript/imageviewer.js
javascript/imageviewer.js
+3
-21
javascript/ui.js
javascript/ui.js
+31
-5
modules/scripts.py
modules/scripts.py
+12
-0
style.css
style.css
+14
-1
No files found.
javascript/imageviewer.js
View file @
8410b135
...
@@ -32,13 +32,7 @@ function negmod(n, m) {
...
@@ -32,13 +32,7 @@ function negmod(n, m) {
function
updateOnBackgroundChange
()
{
function
updateOnBackgroundChange
()
{
const
modalImage
=
gradioApp
().
getElementById
(
"
modalImage
"
)
const
modalImage
=
gradioApp
().
getElementById
(
"
modalImage
"
)
if
(
modalImage
&&
modalImage
.
offsetParent
)
{
if
(
modalImage
&&
modalImage
.
offsetParent
)
{
let
allcurrentButtons
=
gradioApp
().
querySelectorAll
(
"
.gallery-item.transition-all.
\\
!ring-2
"
)
let
currentButton
=
selected_gallery_button
();
let
currentButton
=
null
allcurrentButtons
.
forEach
(
function
(
elem
)
{
if
(
elem
.
parentElement
.
offsetParent
)
{
currentButton
=
elem
;
}
})
if
(
currentButton
?.
children
?.
length
>
0
&&
modalImage
.
src
!=
currentButton
.
children
[
0
].
src
)
{
if
(
currentButton
?.
children
?.
length
>
0
&&
modalImage
.
src
!=
currentButton
.
children
[
0
].
src
)
{
modalImage
.
src
=
currentButton
.
children
[
0
].
src
;
modalImage
.
src
=
currentButton
.
children
[
0
].
src
;
...
@@ -50,22 +44,10 @@ function updateOnBackgroundChange() {
...
@@ -50,22 +44,10 @@ function updateOnBackgroundChange() {
}
}
function
modalImageSwitch
(
offset
)
{
function
modalImageSwitch
(
offset
)
{
var
allgalleryButtons
=
gradioApp
().
querySelectorAll
(
"
.gradio-gallery .thumbnail-item
"
)
var
galleryButtons
=
all_gallery_buttons
();
var
galleryButtons
=
[]
allgalleryButtons
.
forEach
(
function
(
elem
)
{
if
(
elem
.
parentElement
.
offsetParent
)
{
galleryButtons
.
push
(
elem
);
}
})
if
(
galleryButtons
.
length
>
1
)
{
if
(
galleryButtons
.
length
>
1
)
{
var
allcurrentButtons
=
gradioApp
().
querySelectorAll
(
"
.gradio-gallery .thumbnail-item.selected
"
)
var
currentButton
=
selected_gallery_button
();
var
currentButton
=
null
allcurrentButtons
.
forEach
(
function
(
elem
)
{
if
(
elem
.
parentElement
.
offsetParent
)
{
currentButton
=
elem
;
}
})
var
result
=
-
1
var
result
=
-
1
galleryButtons
.
forEach
(
function
(
v
,
i
)
{
galleryButtons
.
forEach
(
function
(
v
,
i
)
{
...
...
javascript/ui.js
View file @
8410b135
...
@@ -7,9 +7,31 @@ function set_theme(theme){
...
@@ -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
(){
function
selected_gallery_index
(){
var
buttons
=
gradioApp
().
querySelectorAll
(
'
[style="display: block;"].tabitem div[id$=_gallery] .gallery-item
'
)
var
buttons
=
all_gallery_buttons
();
var
button
=
gradioApp
().
querySelector
(
'
[style="display: block;"].tabitem div[id$=_gallery] .gallery-item.
\\
!ring-2
'
)
var
button
=
selected_gallery_button
();
var
result
=
-
1
var
result
=
-
1
buttons
.
forEach
(
function
(
v
,
i
){
if
(
v
==
button
)
{
result
=
i
}
})
buttons
.
forEach
(
function
(
v
,
i
){
if
(
v
==
button
)
{
result
=
i
}
})
...
@@ -18,14 +40,18 @@ function selected_gallery_index(){
...
@@ -18,14 +40,18 @@ function selected_gallery_index(){
}
}
function
extract_image_from_gallery
(
gallery
){
function
extract_image_from_gallery
(
gallery
){
if
(
gallery
.
length
==
1
){
if
(
gallery
.
length
==
0
){
return
[
gallery
[
0
]]
return
[
null
];
}
if
(
gallery
.
length
==
1
){
return
[
gallery
[
0
]];
}
}
index
=
selected_gallery_index
()
index
=
selected_gallery_index
()
if
(
index
<
0
||
index
>=
gallery
.
length
){
if
(
index
<
0
||
index
>=
gallery
.
length
){
return
[
null
]
// Use the first image in the gallery as the default
index
=
0
;
}
}
return
[
gallery
[
index
]];
return
[
gallery
[
index
]];
...
...
modules/scripts.py
View file @
8410b135
...
@@ -553,3 +553,15 @@ def IOComponent_init(self, *args, **kwargs):
...
@@ -553,3 +553,15 @@ def IOComponent_init(self, *args, **kwargs):
original_IOComponent_init
=
gr
.
components
.
IOComponent
.
__init__
original_IOComponent_init
=
gr
.
components
.
IOComponent
.
__init__
gr
.
components
.
IOComponent
.
__init__
=
IOComponent_init
gr
.
components
.
IOComponent
.
__init__
=
IOComponent_init
def
BlockContext_init
(
self
,
*
args
,
**
kwargs
):
res
=
original_BlockContext_init
(
self
,
*
args
,
**
kwargs
)
add_classes_to_gradio_component
(
self
)
return
res
original_BlockContext_init
=
gr
.
blocks
.
BlockContext
.
__init__
gr
.
blocks
.
BlockContext
.
__init__
=
BlockContext_init
style.css
View file @
8410b135
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
--block-background-fill
:
transparent
;
--block-background-fill
:
transparent
;
}
}
.block.padded
{
.block.padded
:not
(
.gradio-accordion
)
{
padding
:
0
!important
;
padding
:
0
!important
;
}
}
...
@@ -65,6 +65,19 @@ div.compact{
...
@@ -65,6 +65,19 @@ div.compact{
margin-bottom
:
0
;
margin-bottom
:
0
;
}
}
.gradio-dropdown
ul
.options
{
max-height
:
35em
;
z-index
:
3000
;
}
.gradio-dropdown
ul
.options
li
.item
{
padding
:
0.05em
0
;
}
.gradio-dropdown
ul
.options
li
.item.selected
{
background-color
:
var
(
--secondary-500
);
}
.gradio-dropdown
div
.wrap.wrap.wrap.wrap
{
.gradio-dropdown
div
.wrap.wrap.wrap.wrap
{
box-shadow
:
0
1px
2px
0
rgba
(
0
,
0
,
0
,
0.05
);
box-shadow
:
0
1px
2px
0
rgba
(
0
,
0
,
0
,
0.05
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment