diff --git a/ui/media/css/main.css b/ui/media/css/main.css index 82186dd2..ea338653 100644 --- a/ui/media/css/main.css +++ b/ui/media/css/main.css @@ -1439,7 +1439,7 @@ div.top-right { right: 8px; } -button.useForControlnetBtn { +.task-fs-initimage .top-right button { margin-top: 6px; } diff --git a/ui/media/js/main.js b/ui/media/js/main.js index 281f4b49..3195969c 100644 --- a/ui/media/js/main.js +++ b/ui/media/js/main.js @@ -1362,7 +1362,7 @@ async function onTaskStart(task) { } /* Hover effect for the init image in the task list */ -function createInitImageHover(taskEntry) { +function createInitImageHover(taskEntry, task) { taskEntry.querySelectorAll(".task-initimg").forEach((thumb) => { let thumbimg = thumb.querySelector("img") let img = createElement("img", { src: thumbimg.src }) @@ -1371,7 +1371,9 @@ function createInitImageHover(taskEntry) { div.innerHTML = `
- ` + +
+ ` div.querySelector(".useAsInputBtn").addEventListener("click", (e) => { e.preventDefault() onUseAsInputClick(null, img) @@ -1380,6 +1382,13 @@ function createInitImageHover(taskEntry) { e.preventDefault() controlImagePreview.src = img.src }) + div.querySelector(".downloadPreviewImg").addEventListener("click", (e) => { + e.preventDefault() + + const name = "image." + task.reqBody["output_format"] + const blob = dataURItoBlob(img.src) + saveAs(blob, name) + }) thumb.querySelector(".task-fs-initimage").appendChild(div) }) return @@ -1474,7 +1483,7 @@ function createTask(task) { ` if (task.reqBody.init_image !== undefined || task.reqBody.control_image !== undefined) { - createInitImageHover(taskEntry) + createInitImageHover(taskEntry, task) } if (task.reqBody.control_image !== undefined && task.reqBody.control_filter_to_apply !== undefined) {