diff options
author | Jairo Correa <jn.j41r0@gmail.com> | 2022-10-02 21:31:19 +0000 |
---|---|---|
committer | Jairo Correa <jn.j41r0@gmail.com> | 2022-10-02 21:31:19 +0000 |
commit | ad0cc85d1f0bd52877963f296eb1257a0c2b012b (patch) | |
tree | c7703e74e1964800bc1dbf11654c055f0dc21f8a /javascript/ui.js | |
parent | ad1fbbae93fa17f797a76bc59220d074990b85b4 (diff) | |
parent | 4c2eccf8e96825333ed400f8a8a2be78141ed8ec (diff) | |
download | stable-diffusion-webui-gfx803-ad0cc85d1f0bd52877963f296eb1257a0c2b012b.tar.gz stable-diffusion-webui-gfx803-ad0cc85d1f0bd52877963f296eb1257a0c2b012b.tar.bz2 stable-diffusion-webui-gfx803-ad0cc85d1f0bd52877963f296eb1257a0c2b012b.zip |
Merge branch 'master' into stable
Diffstat (limited to 'javascript/ui.js')
-rw-r--r-- | javascript/ui.js | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/javascript/ui.js b/javascript/ui.js index bfe02410..b1053201 100644 --- a/javascript/ui.js +++ b/javascript/ui.js @@ -199,6 +199,26 @@ let txt2img_textarea, img2img_textarea = undefined; let wait_time = 800 let token_timeout; +function update_txt2img_tokens(...args) { + update_token_counter("txt2img_token_button") + if (args.length == 2) + return args[0] + return args; +} + +function update_img2img_tokens(...args) { + update_token_counter("img2img_token_button") + if (args.length == 2) + return args[0] + return args; +} + +function update_token_counter(button_id) { + if (token_timeout) + 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(); @@ -207,8 +227,7 @@ function submit_prompt(event, generate_button_id) { } } -function update_token_counter(button_id) { - if (token_timeout) - clearTimeout(token_timeout); - token_timeout = setTimeout(() => gradioApp().getElementById(button_id)?.click(), wait_time); +function restart_reload(){ + document.body.innerHTML='<h1 style="font-family:monospace;margin-top:20%;color:lightgray;text-align:center;">Reloading...</h1>'; + setTimeout(function(){location.reload()},2000) } |