From 8ccc27127bd5abcba05f30f8a72fc37025b588ac Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Sun, 30 Apr 2023 22:08:52 +0300 Subject: Fix a whole bunch of implicit globals --- javascript/ui.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'javascript/ui.js') diff --git a/javascript/ui.js b/javascript/ui.js index e14b33f5..fed96f98 100644 --- a/javascript/ui.js +++ b/javascript/ui.js @@ -1,7 +1,7 @@ // various functions for interaction with ui.py not large enough to warrant putting them in separate files function set_theme(theme){ - gradioURL = window.location.href + var gradioURL = window.location.href if (!gradioURL.includes('?__theme=')) { window.location.replace(gradioURL + '?__theme=' + theme); } @@ -47,7 +47,7 @@ function extract_image_from_gallery(gallery){ return [gallery[0]]; } - index = selected_gallery_index() + var index = selected_gallery_index() if (index < 0 || index >= gallery.length){ // Use the first image in the gallery as the default @@ -58,7 +58,7 @@ function extract_image_from_gallery(gallery){ } function args_to_array(args){ - res = [] + var res = [] for(var i=0;i Date: Sun, 30 Apr 2023 22:12:24 +0300 Subject: Fix unused variables --- javascript/ui.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'javascript/ui.js') diff --git a/javascript/ui.js b/javascript/ui.js index fed96f98..aa440bf6 100644 --- a/javascript/ui.js +++ b/javascript/ui.js @@ -207,7 +207,7 @@ function submit_img2img(){ return res } -function restoreProgressTxt2img(x){ +function restoreProgressTxt2img(){ var id = localStorage.getItem("txt2img_task_id") if(id) { @@ -218,7 +218,7 @@ function restoreProgressTxt2img(x){ return [id] } -function restoreProgressImg2img(x){ +function restoreProgressImg2img(){ var id = localStorage.getItem("img2img_task_id") if(id) { -- cgit v1.2.1 From c714300265919e325ae1340459c4866541940687 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Sun, 30 Apr 2023 22:15:59 +0300 Subject: Use substring instead of deprecated substr --- javascript/ui.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'javascript/ui.js') diff --git a/javascript/ui.js b/javascript/ui.js index aa440bf6..e2b9bfe4 100644 --- a/javascript/ui.js +++ b/javascript/ui.js @@ -351,7 +351,7 @@ onUiUpdate(function(){ onOptionsChanged(function(){ var elem = gradioApp().getElementById('sd_checkpoint_hash') var sd_checkpoint_hash = opts.sd_checkpoint_hash || "" - var shorthash = sd_checkpoint_hash.substr(0,10) + var shorthash = sd_checkpoint_hash.substring(0,10) if(elem && elem.textContent != shorthash){ elem.textContent = shorthash -- cgit v1.2.1 From fc966c029943ce37aaecd620645c770478395afc Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Mon, 8 May 2023 15:30:32 +0300 Subject: do not show licenses page when user selects Show all pages in settings --- javascript/ui.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'javascript/ui.js') diff --git a/javascript/ui.js b/javascript/ui.js index b63b84b2..611b70d1 100644 --- a/javascript/ui.js +++ b/javascript/ui.js @@ -348,6 +348,9 @@ onUiUpdate(function(){ settings_tabs.appendChild(show_all_pages) show_all_pages.onclick = function(){ gradioApp().querySelectorAll('#settings > div').forEach(function(elem){ + if(elem.id == "settings_tab_licenses") + return; + elem.style.display = "block"; }) } -- cgit v1.2.1 From ad6ec0226118b80e79446f16747976a1dd1fabcd Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Tue, 9 May 2023 11:42:47 +0300 Subject: prevent Reload UI button/link from reloading the page when it's not yet ready --- javascript/ui.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'javascript/ui.js') diff --git a/javascript/ui.js b/javascript/ui.js index 611b70d1..ed9673d6 100644 --- a/javascript/ui.js +++ b/javascript/ui.js @@ -395,7 +395,16 @@ function update_token_counter(button_id) { function restart_reload(){ document.body.innerHTML='

Reloading...

'; - setTimeout(function(){location.reload()},2000) + + var requestPing = function(){ + requestGet("./internal/ping", {}, function(data){ + location.reload(); + }, function(){ + setTimeout(requestPing, 500); + }) + } + + setTimeout(requestPing, 2000); return [] } -- cgit v1.2.1