aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/js/file-upload.js
diff options
context:
space:
mode:
authorluckydonald <luckydonald@flutterb.at>2014-08-13 11:40:36 +0200
committerluckydonald <luckydonald@flutterb.at>2014-08-13 11:40:36 +0200
commit5e86ff6d8543897221b87e1e1b64f3603e7faac1 (patch)
tree4a143b277922c51120f8dc42e35c2c06a44605f5 /apps/files/js/file-upload.js
parent159747117ff5af514b71e13caff13e89128ceb6f (diff)
downloadnextcloud-server-5e86ff6d8543897221b87e1e1b64f3603e7faac1.tar.gz
nextcloud-server-5e86ff6d8543897221b87e1e1b64f3603e7faac1.zip
Fixed Positioning, fixed formatting for both mobile and desktop.
Tooltips still frustrate me- And the updated code with tabs nicely. yay.
Diffstat (limited to 'apps/files/js/file-upload.js')
-rw-r--r--apps/files/js/file-upload.js43
1 files changed, 37 insertions, 6 deletions
diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js
index fcc0179090e..564122bd2a9 100644
--- a/apps/files/js/file-upload.js
+++ b/apps/files/js/file-upload.js
@@ -487,12 +487,43 @@ OC.Upload = {
}
var smoothRemaining = (bufferTotal/bufferSize);
var date = new Date(smoothRemaining * 1000);
- var stringRemaining = (date.getUTCHours() > 0 ? ('0' + date.getUTCHours()).slice(-2) + ':':'') +
- ('0' + date.getUTCMinutes()).slice(-2) + ':' +
- ('0' + date.getUTCSeconds()).slice(-2);
- $('#uploadprogressbar .label .mobile').text(t('files', '{loadedSize}', {loadedSize: humanFileSize(data.loaded)}));
- $('#uploadprogressbar .label .desktop').text(t('files', '{loadedSize} of {totalSize}', {loadedSize: humanFileSize(data.loaded), totalSize: humanFileSize(data.total)}));
- $('#uploadprogressbar').attr('title', t('files', '{bitrate}. {timeRemaining} seconds remaining.', {timeRemaining: stringRemaining, bitrate: humanFileSize(data.bitrate) + '/s'}));
+ var timeStringMobile = "";
+ var timeStringDesktop = "";
+ if(date.getUTCHours()>0){
+ timeStringDesktop = t('files', '{hours}:{minutes}:{seconds} Hour{plural_s} left' , {
+ hours:date.getUTCHours(),
+ minutes: ('0' + date.getUTCMinutes()).slice(-2),
+ seconds: ('0' + date.getUTCSeconds()).slice(-2),
+ plural_s: (!(date.getUTCHours()== 1 && date.getUTCMinutes()== 0 && date.getUTCSeconds()== 0) ? "s": "")
+ });
+ timeStringMobile = t('files', '{hours}:{minutes}:{seconds}h' , {
+ hours:date.getUTCHours(),
+ minutes: ('0' + date.getUTCMinutes()).slice(-2),
+ seconds: ('0' + date.getUTCSeconds()).slice(-2)
+ });
+ } else if(date.getUTCMinutes()>0){
+ timeStringDesktop = t('files', '{minutes}:{seconds} Minute{plural_s} left' , {
+ minutes: date.getUTCMinutes(),
+ seconds: ('0' + date.getUTCSeconds()).slice(-2),
+ plural_s: (!(date.getUTCMinutes()== 1 && date.getUTCSeconds()== 0)? "s": "")
+ });
+ timeStringMobile = t('files', '{minutes}:{seconds}min' , {
+ minutes: date.getUTCMinutes(),
+ seconds: ('0' + date.getUTCSeconds()).slice(-2)
+ });
+ } else if(date.getUTCSeconds()>0){
+ timeStringDesktop = t('files', '{seconds} Second{plural_s} left' , {
+ seconds: date.getUTCSeconds(),
+ plural_s: (!date.getUTCSeconds()== 1 ? "s": "")
+ });
+ timeStringMobile = t('files', '{seconds}s' , {seconds: date.getUTCSeconds()});
+ } else {
+ timeStringDesktop = t('files', 'Any moment now...');
+ timeStringMobile = t('files', 'Soon...');
+ }
+ $('#uploadprogressbar .label .mobile').text(timeStringMobile);//t('files', '{loadedSize}', {loadedSize: humanFileSize(data.loaded)}));
+ $('#uploadprogressbar .label .desktop').text(timeStringDesktop);//
+ $('#uploadprogressbar').attr('title', t('files', '{loadedSize} of {totalSize} ({bitrate})', {loadedSize: humanFileSize(data.loaded), totalSize: humanFileSize(data.total), bitrate: humanFileSize(data.bitrate) + '/s'}));
$('#uploadprogressbar').progressbar('value', progress);
});
fileupload.on('fileuploadstop', function(e, data) {