mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-08-08 21:30:27 +00:00
removed unused import; now using javascript to watch prompt textarea
This commit is contained in:
@@ -182,21 +182,23 @@ onUiUpdate(function(){
|
||||
});
|
||||
|
||||
json_elem.parentElement.style.display="none"
|
||||
|
||||
if (!txt2img_textarea) {
|
||||
txt2img_textarea = gradioApp().querySelector("#txt2img_prompt > label > textarea");
|
||||
txt2img_textarea?.addEventListener("input", () => update_token_counter("txt2img_token_button"));
|
||||
}
|
||||
if (!img2img_textarea) {
|
||||
img2img_textarea = gradioApp().querySelector("#img2img_prompt > label > textarea");
|
||||
img2img_textarea?.addEventListener("input", () => update_token_counter("img2img_token_button"));
|
||||
}
|
||||
})
|
||||
|
||||
let txt2img_textarea, img2img_textarea = undefined;
|
||||
let wait_time = 800
|
||||
let token_timeout;
|
||||
function txt2img_token_counter(text) {
|
||||
return update_token_counter("txt2img_token_button", text);
|
||||
}
|
||||
|
||||
function img2img_token_counter(text) {
|
||||
return update_token_counter("img2img_token_button", text);
|
||||
}
|
||||
|
||||
function update_token_counter(button_id, text) {
|
||||
function update_token_counter(button_id) {
|
||||
if (token_timeout)
|
||||
clearTimeout(token_timeout);
|
||||
token_timeout = setTimeout(() => gradioApp().getElementById(button_id)?.click(), wait_time);
|
||||
return [];
|
||||
}
|
||||
|
Reference in New Issue
Block a user