aboutsummaryrefslogtreecommitdiff
path: root/javascript/ui.js
diff options
context:
space:
mode:
Diffstat (limited to 'javascript/ui.js')
-rw-r--r--javascript/ui.js27
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)
}