aboutsummaryrefslogtreecommitdiff
path: root/javascript/progressbar.js
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-08-20 13:00:59 +0300
committerAUTOMATIC1111 <16777216c@gmail.com>2023-08-20 13:00:59 +0300
commita0d721e109d7c7b75aefaf3853f7bf58da43847b (patch)
tree36db8dbb2ae746214521530b26ba04db1a7168d4 /javascript/progressbar.js
parent499cef3c2b5786a388fc6cc228de3df0d5f16f75 (diff)
make live preview display work independently from progress bar
Diffstat (limited to 'javascript/progressbar.js')
-rw-r--r--javascript/progressbar.js28
1 files changed, 18 insertions, 10 deletions
diff --git a/javascript/progressbar.js b/javascript/progressbar.js
index 29299787..8a339982 100644
--- a/javascript/progressbar.js
+++ b/javascript/progressbar.js
@@ -93,8 +93,8 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre
atEnd();
};
- var fun = function(id_task, id_live_preview) {
- request("./internal/progress", {id_task: id_task, id_live_preview: id_live_preview}, function(res) {
+ var funProgress = function(id_task) {
+ request("./internal/progress", {id_task: id_task, live_preview: false}, function(res) {
if (res.completed) {
removeProgressBar();
return;
@@ -119,7 +119,6 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre
progressText += " ETA: " + formatTime(res.eta);
}
-
setTitle(progressText);
if (res.textinfo && res.textinfo.indexOf("\n") == -1) {
@@ -142,7 +141,20 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre
return;
}
+ if (onProgress) {
+ onProgress(res);
+ }
+
+ setTimeout(() => {
+ funProgress(id_task, res.id_live_preview);
+ }, opts.live_preview_refresh_period || 500);
+ }, function() {
+ removeProgressBar();
+ });
+ }
+ var funLivePreview = function(id_task, id_live_preview) {
+ request("./internal/progress", {id_task: id_task, id_live_preview: id_live_preview}, function(res) {
if (res.live_preview && gallery) {
rect = gallery.getBoundingClientRect();
if (rect.width) {
@@ -160,18 +172,14 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre
img.src = res.live_preview;
}
-
- if (onProgress) {
- onProgress(res);
- }
-
setTimeout(() => {
- fun(id_task, res.id_live_preview);
+ funLivePreview(id_task, res.id_live_preview);
}, opts.live_preview_refresh_period || 500);
}, function() {
removeProgressBar();
});
};
- fun(id_task, 0);
+ funProgress(id_task, 0);
+ funLivePreview(id_task, 0);
}