diff options
author | Florian Horn <florianins@gmail.com> | 2022-10-27 22:58:18 +0000 |
---|---|---|
committer | Florian Horn <florianins@gmail.com> | 2022-10-27 22:58:18 +0000 |
commit | 403c5dba86f0faac6746df24d16e4d08aab8c9c5 (patch) | |
tree | 6a6dc5937edc37a36c2c4f4a0cec0cc0263ceff0 | |
parent | bf25b51c3167426d3a340d2a3facea58813d4914 (diff) | |
download | stable-diffusion-webui-gfx803-403c5dba86f0faac6746df24d16e4d08aab8c9c5.tar.gz stable-diffusion-webui-gfx803-403c5dba86f0faac6746df24d16e4d08aab8c9c5.tar.bz2 stable-diffusion-webui-gfx803-403c5dba86f0faac6746df24d16e4d08aab8c9c5.zip |
hide save btn for other tabs than txt2img and img2img
-rw-r--r-- | javascript/imageviewer.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/javascript/imageviewer.js b/javascript/imageviewer.js index 3aa3b29e..67916536 100644 --- a/javascript/imageviewer.js +++ b/javascript/imageviewer.js @@ -13,6 +13,15 @@ function showModal(event) { } lb.style.display = "block"; lb.focus() + + const tabTxt2Img = gradioApp().getElementById("tab_txt2img") + const tabImg2Img = gradioApp().getElementById("tab_img2img") + // show the save button in modal only on txt2img or img2img tabs + if (tabTxt2Img.style.display != "none" || tabImg2Img.style.display != "none") { + gradioApp().getElementById("modal_save").style.display = "inline" + } else { + gradioApp().getElementById("modal_save").style.display = "none" + } event.stopPropagation() } @@ -86,9 +95,9 @@ function saveImage(){ const tabImg2Img = gradioApp().getElementById("tab_img2img") const saveTxt2Img = "save_txt2img" const saveImg2Img = "save_img2img" - if (tabTxt2Img.style["display"] != "none") { + if (tabTxt2Img.style.display != "none") { gradioApp().getElementById(saveTxt2Img).click() - } else if (tabImg2Img.style["display"] != "none") { + } else if (tabImg2Img.style.display != "none") { gradioApp().getElementById(saveImg2Img).click() } else { console.error("missing implementation for saving modal of this type") @@ -222,6 +231,7 @@ document.addEventListener("DOMContentLoaded", function() { const modalSave = document.createElement("span") modalSave.className = "modalSave cursor" + modalSave.id = "modal_save" modalSave.innerHTML = "🖫" modalSave.addEventListener("click", modalSaveImage, true) modalSave.title = "Save Image(s)" |