forked from extern/easydiffusion
Add "Remove" button to each image's hover menu
This commit is contained in:
parent
21108650f7
commit
4eae540086
@ -285,6 +285,7 @@ function showImages(reqBody, res, outputContainer, livePreview) {
|
|||||||
imageSeedLabel.innerText = 'Seed: ' + req.seed
|
imageSeedLabel.innerText = 'Seed: ' + req.seed
|
||||||
|
|
||||||
let buttons = [
|
let buttons = [
|
||||||
|
{ text: 'Remove', on_click: onRemoveClick, class: 'secondaryButton' },
|
||||||
{ text: 'Use as Input', on_click: onUseAsInputClick },
|
{ text: 'Use as Input', on_click: onUseAsInputClick },
|
||||||
{ text: 'Download', on_click: onDownloadImageClick },
|
{ text: 'Download', on_click: onDownloadImageClick },
|
||||||
{ text: 'Make Similar Images', on_click: onMakeSimilarClick },
|
{ text: 'Make Similar Images', on_click: onMakeSimilarClick },
|
||||||
@ -302,9 +303,12 @@ function showImages(reqBody, res, outputContainer, livePreview) {
|
|||||||
const newButton = document.createElement('button')
|
const newButton = document.createElement('button')
|
||||||
newButton.classList.add('tasksBtns')
|
newButton.classList.add('tasksBtns')
|
||||||
newButton.innerText = btnInfo.text
|
newButton.innerText = btnInfo.text
|
||||||
newButton.addEventListener('click', function() {
|
newButton.addEventListener('click', function(event) {
|
||||||
btnInfo.on_click(req, img)
|
btnInfo.on_click(req, img, event)
|
||||||
})
|
})
|
||||||
|
if (btnInfo.class !== undefined) {
|
||||||
|
newButton.classList.add(btnInfo.class)
|
||||||
|
}
|
||||||
imgItemInfo.appendChild(newButton)
|
imgItemInfo.appendChild(newButton)
|
||||||
}
|
}
|
||||||
buttons.forEach(btn => {
|
buttons.forEach(btn => {
|
||||||
@ -318,6 +322,10 @@ function showImages(reqBody, res, outputContainer, livePreview) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onRemoveClick(req, img, event) {
|
||||||
|
shiftOrConfirm(event, "Remove the image from the results?", () => { findClosestAncestor(img, '.imgItem').style.display='none' })
|
||||||
|
}
|
||||||
|
|
||||||
function onUseAsInputClick(req, img) {
|
function onUseAsInputClick(req, img) {
|
||||||
const imgData = img.src
|
const imgData = img.src
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user