Upload progressbar.js
Browse files- progressbar.js +19 -5
progressbar.js
CHANGED
@@ -1,5 +1,10 @@
|
|
1 |
// code related to showing and updating progressbar shown as the image is being made
|
2 |
let lastTimeSuccess = 0; //epoch time in second
|
|
|
|
|
|
|
|
|
|
|
3 |
function rememberGallerySelection() {
|
4 |
|
5 |
}
|
@@ -52,12 +57,18 @@ function setTitle(progress) {
|
|
52 |
title = '[' + progress.trim() + '] ' + title;
|
53 |
}
|
54 |
else if (lastTimeSuccess > 0){ // hoangpl display duration since last time success
|
55 |
-
var
|
56 |
-
if (
|
57 |
-
title = 'exceed
|
58 |
}
|
59 |
-
else
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
}
|
62 |
}
|
63 |
if (document.title != title) {
|
@@ -125,6 +136,9 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre
|
|
125 |
if (res.eta) {
|
126 |
progressText += " ETA: " + formatTime(res.eta);
|
127 |
lastTimeSuccess = getCurTimeInSeconds(); // hoangpl
|
|
|
|
|
|
|
128 |
}
|
129 |
|
130 |
setTitle(progressText);
|
|
|
1 |
// code related to showing and updating progressbar shown as the image is being made
|
2 |
let lastTimeSuccess = 0; //epoch time in second
|
3 |
+
let timeWarning = 160;
|
4 |
+
let maxTimeWarning = 3600;
|
5 |
+
let firstTimeStart = 0;
|
6 |
+
|
7 |
+
|
8 |
function rememberGallerySelection() {
|
9 |
|
10 |
}
|
|
|
57 |
title = '[' + progress.trim() + '] ' + title;
|
58 |
}
|
59 |
else if (lastTimeSuccess > 0){ // hoangpl display duration since last time success
|
60 |
+
var curTime = getCurTimeInSeconds();
|
61 |
+
if (curTime - firstTimeStart > 14400){
|
62 |
+
title = 'exceed 4 hours ';
|
63 |
}
|
64 |
+
else{
|
65 |
+
var durationSinceLastSuccess = curTime - lastTimeSuccess;
|
66 |
+
if (durationSinceLastSuccess > maxTimeWarning){ // hoangpl no need update ui
|
67 |
+
title = 'exceed > ' + maxTimeWarning + 's';
|
68 |
+
}
|
69 |
+
else if (durationSinceLastSuccess > timeWarning){
|
70 |
+
title = 'warning ' + durationSinceLastSuccess + 's';
|
71 |
+
}
|
72 |
}
|
73 |
}
|
74 |
if (document.title != title) {
|
|
|
136 |
if (res.eta) {
|
137 |
progressText += " ETA: " + formatTime(res.eta);
|
138 |
lastTimeSuccess = getCurTimeInSeconds(); // hoangpl
|
139 |
+
if (firstTimeStart <= 0){
|
140 |
+
firstTimeStart = lastTimeSuccess;
|
141 |
+
}
|
142 |
}
|
143 |
|
144 |
setTitle(progressText);
|