Hide Image buttons hides task (#854)

* hide task when all images are hidden

* Update main.css

* remove console logs

* remove another console log

* Update main.js

* Update main.js
This commit is contained in:
AssassinJN 2023-02-10 12:28:07 -05:00 committed by GitHub
parent 1cc09cbe5f
commit f2f3ed71d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View File

@ -1204,3 +1204,7 @@ body.wait-pause {
.jconfirm.jconfirm-modern .jconfirm-box {
background-color: var(--background-color1);
}
.displayNone {
display:none !important;
}

View File

@ -279,9 +279,21 @@ function showImages(reqBody, res, outputContainer, livePreview) {
imageElem.setAttribute('data-guidance', imageGuidanceScale)
const imageRemoveBtn = imageItemElem.querySelector('.imgPreviewItemClearBtn')
let parentTaskContainer = imageRemoveBtn.closest('.imageTaskContainer')
imageRemoveBtn.addEventListener('click', (e) => {
console.log(e)
shiftOrConfirm(e, "Remove the image from the results?", () => { imageItemElem.style.display = 'none' })
shiftOrConfirm(e, "Remove the image from the results?", () => {
imageItemElem.style.display = 'none'
let allHidden = true;
let children = parentTaskContainer.querySelectorAll('.imgItem');
for(let x = 0; x < children.length; x++) {
let child = children[x];
if(child.style.display != "none") {
allHidden = false;
}
}
if(allHidden === true) {parentTaskContainer.classList.add("displayNone")}
})
})
const imageInfo = imageItemElem.querySelector('.imgItemInfo')