From 1cd9c7fdac25ed66a95187b64dcb2881ba0be800 Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Tue, 22 Aug 2023 16:59:40 +0530 Subject: [PATCH] Show the negative embeddings button only if the negative prompt panel is open --- ui/media/js/main.js | 11 +++++++++++ ui/media/js/parameters.js | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ui/media/js/main.js b/ui/media/js/main.js index fb20c5dc..1ce88d4d 100644 --- a/ui/media/js/main.js +++ b/ui/media/js/main.js @@ -2517,6 +2517,17 @@ window.addEventListener("beforeunload", function(e) { } }) +document.addEventListener("collapsibleClick", function(e) { + let header = e.detail + if (header === document.querySelector("#negative_prompt_handle")) { + if (header.classList.contains("active")) { + negativeEmbeddingsButton.classList.remove("displayNone") + } else { + negativeEmbeddingsButton.classList.add("displayNone") + } + } +}) + createCollapsibles() prettifyInputs(document) diff --git a/ui/media/js/parameters.js b/ui/media/js/parameters.js index 7fdf8632..2209f286 100644 --- a/ui/media/js/parameters.js +++ b/ui/media/js/parameters.js @@ -487,6 +487,7 @@ async function getAppConfig() { document.querySelector("#controlnet_model_container").style.display = "none" document.querySelector("#hypernetwork_model_container").style.display = "" document.querySelector("#hypernetwork_strength_container").style.display = "" + document.querySelector("#negative-embeddings-button").style.display = "none" document.querySelectorAll("#sampler_name option.diffusers-only").forEach((option) => { option.style.display = "none" @@ -506,7 +507,6 @@ async function getAppConfig() { }) document.querySelector("#clip_skip_config").classList.remove("displayNone") document.querySelector("#embeddings-button").classList.remove("displayNone") - document.querySelector("#negative-embeddings-button").classList.remove("displayNone") IMAGE_STEP_SIZE = 8 customWidthField.step = IMAGE_STEP_SIZE customHeightField.step = IMAGE_STEP_SIZE