mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-08-04 11:12:35 +00:00
token counters now update when roll artist and style buttons are pressed https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/1194#issuecomment-1261203893
This commit is contained in:
@@ -199,12 +199,21 @@ let txt2img_textarea, img2img_textarea = undefined;
|
||||
let wait_time = 800
|
||||
let token_timeout;
|
||||
|
||||
function submit_prompt(event, generate_button_id) {
|
||||
if (event.altKey && event.keyCode === 13) {
|
||||
event.preventDefault();
|
||||
gradioApp().getElementById(generate_button_id).click();
|
||||
return;
|
||||
}
|
||||
function roll_artist_txt2img(prompt_text) {
|
||||
update_token_counter("txt2img_token_button")
|
||||
return prompt_text;
|
||||
}
|
||||
function roll_artist_img2img(prompt_text) {
|
||||
update_token_counter("img2img_token_button")
|
||||
return prompt_text;
|
||||
}
|
||||
function update_style_txt2img(prompt_text, negative_prompt, style1, style2) {
|
||||
update_token_counter("txt2img_token_button")
|
||||
return [prompt_text, negative_prompt, style1, style2]
|
||||
}
|
||||
function update_style_img2img(prompt_text, negative_prompt, style1, style2) {
|
||||
update_token_counter("img2img_token_button")
|
||||
return [prompt_text, negative_prompt, style1, style2]
|
||||
}
|
||||
|
||||
function update_token_counter(button_id) {
|
||||
@@ -212,3 +221,10 @@ function update_token_counter(button_id) {
|
||||
clearTimeout(token_timeout);
|
||||
token_timeout = setTimeout(() => gradioApp().getElementById(button_id)?.click(), wait_time);
|
||||
}
|
||||
function submit_prompt(event, generate_button_id) {
|
||||
if (event.altKey && event.keyCode === 13) {
|
||||
event.preventDefault();
|
||||
gradioApp().getElementById(generate_button_id).click();
|
||||
return;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user