diff options
author | brkirch <brkirch@users.noreply.github.com> | 2022-10-04 01:04:19 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-04 01:04:19 -0400 |
commit | b88e4ea7d6536ddc814a9101a258f87b06230019 (patch) | |
tree | 913bdda300b7082aa61429689d0a730cecda1525 /javascript/ui.js | |
parent | bdaa36c84470adbdce3e98c01a69af5e95adfb02 (diff) | |
parent | 2865ef4b9ab16d56326cc805541bebcf01d099bc (diff) |
Merge branch 'master' into master
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) } |