navmesh commited on
Commit
4255c3b
·
1 Parent(s): 0570193

Upload progressbar.js

Browse files
Files changed (1) hide show
  1. progressbar.js +10 -10
progressbar.js CHANGED
@@ -50,16 +50,15 @@ function setTitle(progress) {
50
 
51
  if (opts.show_progress_in_title && progress) {
52
  title = '[' + progress.trim() + '] ' + title;
53
- lastTimeSuccess = getCurTimeInSeconds();
54
  }
55
- // else{
56
- // var curTime = getCurTimeInSeconds();
57
- // if (lastTimeSuccess > 0 && curTime - lastTimeSuccess >= 150){
58
- // var durationSinceLastSuccess = curTime - lastTimeSuccess;
59
- // title = 'warning ' + durationSinceLastSuccess + 's';
60
- // }
61
- // }
62
- if (document.title != title) {
63
  document.title = title;
64
  }
65
  }
@@ -93,7 +92,7 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre
93
 
94
  var removeProgressBar = function() {
95
  if (!divProgress) {
96
- // setTitle(""); // hoangpl continue update title
97
  return;
98
  }
99
 
@@ -123,6 +122,7 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre
123
 
124
  if (res.eta) {
125
  progressText += " ETA: " + formatTime(res.eta);
 
126
  }
127
 
128
  setTitle(progressText);
 
50
 
51
  if (opts.show_progress_in_title && progress) {
52
  title = '[' + progress.trim() + '] ' + title;
 
53
  }
54
+ else{ // hoangpl display duration since last time success
55
+ var curTime = getCurTimeInSeconds();
56
+ if (lastTimeSuccess > 0 && curTime - lastTimeSuccess >= 20){ // hoangpl test , def val is 150
57
+ var durationSinceLastSuccess = curTime - lastTimeSuccess;
58
+ title = 'warning ' + durationSinceLastSuccess + 's';
59
+ }
60
+ }
61
+ if (document.title !== title) {
62
  document.title = title;
63
  }
64
  }
 
92
 
93
  var removeProgressBar = function() {
94
  if (!divProgress) {
95
+ setTitle(""); // hoangpl continue update title
96
  return;
97
  }
98
 
 
122
 
123
  if (res.eta) {
124
  progressText += " ETA: " + formatTime(res.eta);
125
+ lastTimeSuccess = getCurTimeInSeconds(); // hoangpl
126
  }
127
 
128
  setTitle(progressText);