aboutsummaryrefslogtreecommitdiff
path: root/javascript/progressbar.js
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-05-17 23:18:56 +0300
committerGitHub <noreply@github.com>2023-05-17 23:18:56 +0300
commit04b4508a66de58c9f3a422fdcad4dd2ec3ad39ce (patch)
tree1cb30a63099a69f678d4901b495203b765a6df59 /javascript/progressbar.js
parent7201d940a4fe664beb9662fadbeade4ee1d788f7 (diff)
parentb397f63e00bbfbe9087d80abb457aa9a593b181b (diff)
Merge branch 'dev' into improve-frontend-responsiveness
Diffstat (limited to 'javascript/progressbar.js')
-rw-r--r--javascript/progressbar.js11
1 files changed, 5 insertions, 6 deletions
diff --git a/javascript/progressbar.js b/javascript/progressbar.js
index 4ac9b8db..8d2c3492 100644
--- a/javascript/progressbar.js
+++ b/javascript/progressbar.js
@@ -1,16 +1,15 @@
// code related to showing and updating progressbar shown as the image is being made
-function rememberGallerySelection(id_gallery){
+function rememberGallerySelection(){
}
-function getGallerySelectedIndex(id_gallery){
+function getGallerySelectedIndex(){
}
function request(url, data, handler, errorHandler){
var xhr = new XMLHttpRequest();
- var url = url;
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.onreadystatechange = function () {
@@ -66,7 +65,7 @@ function randomId(){
// starts sending progress requests to "/internal/progress" uri, creating progressbar above progressbarContainer element and
// preview inside gallery element. Cleans up all created stuff when the task is over and calls atEnd.
// calls onProgress every time there is a progress update
-function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgress){
+function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgress, inactivityTimeout=40){
var dateStart = new Date()
var wasEverActive = false
var parentProgressbar = progressbarContainer.parentNode
@@ -107,7 +106,7 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre
divProgress.style.width = rect.width + "px";
}
- progressText = ""
+ let progressText = ""
divInner.style.width = ((res.progress || 0) * 100.0) + '%'
divInner.style.background = res.progress ? "" : "transparent"
@@ -138,7 +137,7 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre
return
}
- if(elapsedFromStart > 5 && !res.queued && !res.active){
+ if(elapsedFromStart > inactivityTimeout && !res.queued && !res.active){
removeProgressBar()
return
}