file-upload.js modified : Remaining upload time corrected
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
parent
ec5377306d
commit
62fb3bb3ef
|
@ -960,6 +960,7 @@ OC.Uploader.prototype = _.extend({
|
||||||
var bufferSize = 20;
|
var bufferSize = 20;
|
||||||
var buffer = [];
|
var buffer = [];
|
||||||
var bufferIndex = 0;
|
var bufferIndex = 0;
|
||||||
|
var bufferIndex2 = 0;
|
||||||
var bufferTotal = 0;
|
var bufferTotal = 0;
|
||||||
for(var i = 0; i < bufferSize;i++){
|
for(var i = 0; i < bufferSize;i++){
|
||||||
buffer[i] = 0;
|
buffer[i] = 0;
|
||||||
|
@ -1005,8 +1006,16 @@ OC.Uploader.prototype = _.extend({
|
||||||
bufferTotal = bufferTotal - (buffer[bufferIndex]) + remainingSeconds;
|
bufferTotal = bufferTotal - (buffer[bufferIndex]) + remainingSeconds;
|
||||||
buffer[bufferIndex] = remainingSeconds; //buffer to make it smoother
|
buffer[bufferIndex] = remainingSeconds; //buffer to make it smoother
|
||||||
bufferIndex = (bufferIndex + 1) % bufferSize;
|
bufferIndex = (bufferIndex + 1) % bufferSize;
|
||||||
|
bufferIndex2 = bufferIndex2++;
|
||||||
}
|
}
|
||||||
var smoothRemainingSeconds = (bufferTotal / bufferSize); //seconds
|
var smoothRemainingSeconds;
|
||||||
|
if(bufferIndex2<20) {
|
||||||
|
smoothRemainingSeconds = bufferTotal / bufferIndex2;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
smoothRemainingSeconds = bufferTotal / bufferSize;
|
||||||
|
}
|
||||||
|
|
||||||
var h = moment.duration(smoothRemainingSeconds, "seconds").humanize();
|
var h = moment.duration(smoothRemainingSeconds, "seconds").humanize();
|
||||||
$('#uploadprogressbar .label .mobile').text(h);
|
$('#uploadprogressbar .label .mobile').text(h);
|
||||||
$('#uploadprogressbar .label .desktop').text(h);
|
$('#uploadprogressbar .label .desktop').text(h);
|
||||||
|
|
Loading…
Reference in New Issue