Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name sd-webui-img2img-modes
- // @namespace Violentmonkey Scripts
- // @match http://127.0.0.1:1111/
- // @grant none
- // @version 1.0
- // @author NAI Thread Anon
- // @description 28.07.2023, 00:00:00
- // ==/UserScript==
- let ModeButtons = document.createElement ('div');
- let UpscaleModeButton = document.createElement("button");
- UpscaleModeButton.innerHTML = "Upscale";
- UpscaleModeButton.setAttribute('id', 'UpscaleModeButton');
- UpscaleModeButton.style.margin = "3px";
- let InpaintModeButton = document.createElement("button");
- InpaintModeButton.innerHTML = "Inpaint";
- InpaintModeButton.setAttribute('id', 'InpaintModeButton');
- InpaintModeButton.style.margin = "3px";
- ModeButtons.appendChild(UpscaleModeButton);
- ModeButtons.appendChild(InpaintModeButton);
- ModeButtons.setAttribute('id', 'myModesContainer');
- document.body.appendChild(ModeButtons);
- ModeButtons.style.position = "fixed";
- ModeButtons.style.top = "0";
- ModeButtons.style.left = "0px";
- ModeButtons.style.margin = "3px";
- ModeButtons.style.zIndex = "9001";
- document.getElementById("UpscaleModeButton").addEventListener (
- "click", UpscaleModeButtonClickAction, false
- );
- document.getElementById("InpaintModeButton").addEventListener (
- "click", InpaintModeButtonClickAction, false
- );
- function UpscaleModeButtonClickAction (zEvent) {
- let img2img_batch_count = document.querySelector("#img2img_batch_count [type='range']");
- let img2img_dimensions = document.querySelector("#img2img_dimensions_row").children[0].children[1];
- let img2img_denoising_strength = document.querySelector("#img2img_denoising_strength [type='range']");
- let MD_i2i_enabled = document.querySelector("#MD-i2i-enabled [type='checkbox']");
- img2img_batch_count.value = 1;
- img2img_dimensions.click();
- img2img_denoising_strength.value = 0.35;
- MD_i2i_enabled.checked = true;
- img2img_batch_count.dispatchEvent(new Event("input", { bubbles: true }));
- img2img_denoising_strength.dispatchEvent(new Event("input", { bubbles: true }));
- MD_i2i_enabled.dispatchEvent(new Event("input", { bubbles: true }));
- }
- function InpaintModeButtonClickAction (zEvent) {
- let img2img_batch_count = document.querySelector("#img2img_batch_count [type='range']");
- let img2img_width = document.querySelector("#img2img_width [type='range']");
- let img2img_height = document.querySelector("#img2img_height [type='range']");
- let img2img_denoising_strength = document.querySelector("#img2img_denoising_strength [type='range']");
- let MD_i2i_enabled = document.querySelector("#MD-i2i-enabled [type='checkbox']");
- img2img_batch_count.value = 100;
- img2img_width.value = 600;
- img2img_height.value = 600;
- img2img_denoising_strength.value = 0.48;
- MD_i2i_enabled.checked = false;
- img2img_batch_count.dispatchEvent(new Event("input", { bubbles: true }));
- img2img_width.dispatchEvent(new Event("input", { bubbles: true }));
- img2img_height.dispatchEvent(new Event("input", { bubbles: true }));
- img2img_denoising_strength.dispatchEvent(new Event("input", { bubbles: true }));
- MD_i2i_enabled.dispatchEvent(new Event("input", { bubbles: true }));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement