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
40ddb6df
Commit
40ddb6df
authored
Oct 22, 2022
by
yfszzx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inspiration perfected
parent
58ee008f
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
41 deletions
+49
-41
javascript/inspiration.js
javascript/inspiration.js
+10
-9
modules/inspiration.py
modules/inspiration.py
+39
-32
No files found.
javascript/inspiration.js
View file @
40ddb6df
function
public_image_index_in_gallery
(
item
,
gallery
){
var
imgs
=
gallery
.
querySelectorAll
(
"
img.h-full
"
)
var
imgs
=
gallery
.
querySelectorAll
(
"
img.h-full
"
)
var
index
;
var
i
=
0
;
imgs
.
forEach
(
function
(
e
){
...
...
@@ -7,18 +7,23 @@ function public_image_index_in_gallery(item, gallery){
index
=
i
;
i
+=
1
;
});
var
num
=
imgs
.
length
/
2
index
=
(
index
<
num
)
?
index
:
(
index
-
num
)
var
all_imgs
=
gallery
.
querySelectorAll
(
"
img
"
)
if
(
all_imgs
.
length
>
imgs
.
length
){
var
num
=
imgs
.
length
/
2
index
=
(
index
<
num
)
?
index
:
(
index
-
num
)
}
return
index
;
}
function
inspiration_selected
(
name
,
name_list
){
var
btn
=
gradioApp
().
getElementById
(
"
inspiration_select_button
"
)
return
[
gradioApp
().
getElementById
(
"
inspiration_select_button
"
).
getAttribute
(
"
img-index
"
)];
}
}
function
inspiration_click_get_button
(){
gradioApp
().
getElementById
(
"
inspiration_get_button
"
).
click
();
}
var
inspiration_image_click
=
function
(){
var
index
=
public_image_index_in_gallery
(
this
,
gradioApp
().
getElementById
(
"
inspiration_gallery
"
));
var
btn
=
gradioApp
().
getElementById
(
"
inspiration_select_button
"
);
...
...
@@ -32,16 +37,12 @@ document.addEventListener("DOMContentLoaded", function() {
if
(
gallery
)
{
var
node
=
gallery
.
querySelector
(
"
.absolute.backdrop-blur.h-full
"
)
if
(
node
)
{
node
.
style
.
display
=
"
None
"
;
//parentNode.removeChild(node)
node
.
style
.
display
=
"
None
"
;
}
gallery
.
querySelectorAll
(
'
img
'
).
forEach
(
function
(
e
){
e
.
onclick
=
inspiration_image_click
});
}
});
mutationObserver
.
observe
(
gradioApp
(),
{
childList
:
true
,
subtree
:
true
});
});
modules/inspiration.py
View file @
40ddb6df
This diff is collapsed.
Click to expand it.
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