summaryrefslogtreecommitdiffstats
path: root/apps/files/js
diff options
context:
space:
mode:
authorluckydonald <luckydonald@flutterb.at>2014-08-13 18:46:23 +0200
committerluckydonald <luckydonald@flutterb.at>2014-08-13 18:46:23 +0200
commitf261c45b0ed470ca1419260d02f1f80f4a9e3f60 (patch)
tree5b86dee1fab626ee21a5810a60d7874d3c86f21a /apps/files/js
parentefdff4e148a3880fc66f139474ccdb17b7a46188 (diff)
downloadnextcloud-server-f261c45b0ed470ca1419260d02f1f80f4a9e3f60.tar.gz
nextcloud-server-f261c45b0ed470ca1419260d02f1f80f4a9e3f60.zip
Changes for scrutinizer. Yay!
Diffstat (limited to 'apps/files/js')
-rw-r--r--apps/files/js/file-upload.js44
1 files changed, 29 insertions, 15 deletions
diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js
index cb9196f0593..b703e15bbfa 100644
--- a/apps/files/js/file-upload.js
+++ b/apps/files/js/file-upload.js
@@ -445,7 +445,7 @@ OC.Upload = {
var lastUpdate = new Date().getMilliseconds();
var lastSize = 0;
var bufferSize = 20;
- var buffer = new Array();
+ var buffer = [];
var bufferIndex = 0;
var bufferTotal = 0;
for(var i = 0; i < bufferSize;i++){
@@ -465,7 +465,12 @@ OC.Upload = {
$('#uploadprogresswrapper input.stop').show();
$('#uploadprogresswrapper .label').show();
$('#uploadprogressbar').progressbar({value: 0});
- $('#uploadprogressbar .ui-progressbar-value').html('<em class="label inner"><span class="desktop">' + t('files', 'Uploading...') + '</span><span class="mobile">' + t('files', '...') + '</span></em>');
+ $('#uploadprogressbar .ui-progressbar-value').
+ html('<em class="label inner"><span class="desktop">'
+ + t('files', 'Uploading...')
+ + '</span><span class="mobile">'
+ + t('files', '...')
+ + '</span></em>');
$('#uploadprogressbar').tipsy({gravity:'n', fade:true, live:true});
OC.Upload._showProgressBar();
});
@@ -483,41 +488,44 @@ OC.Upload = {
lastSize = data.loaded;
diffSize = diffSize / diffUpdate; // apply timing factor, eg. 1mb/2s = 0.5mb/s
var remainingSeconds = ((data.total - data.loaded) / diffSize);
- if(remainingSeconds>0){ //buffer to make it smoother
+ if(remainingSeconds > 0){ //buffer to make it smoother
bufferTotal = bufferTotal - (buffer[bufferIndex]) + remainingSeconds;
buffer[bufferIndex] = remainingSeconds;
bufferIndex = (bufferIndex + 1) % bufferSize;
}
- var smoothRemaining = (bufferTotal/bufferSize);
+ var smoothRemaining = (bufferTotal / bufferSize);
var date = new Date(smoothRemaining * 1000);
var timeStringMobile = "";
var timeStringDesktop = "";
- if(date.getUTCHours()>0){
- timeStringDesktop = t('files', '{hours}:{minutes}:{seconds} hour{plural_s} left' , {
- hours:date.getUTCHours(),
+ 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")
- });
+ plural_s: ( date.getUTCHours() === 1
+ && date.getUTCMinutes() === 0
+ && date.getUTCSeconds() === 0 ? "": "s"
+ )
+ });
timeStringMobile = t('files', '{hours}:{minutes}h' , {
hours:date.getUTCHours(),
minutes: ('0' + date.getUTCMinutes()).slice(-2),
seconds: ('0' + date.getUTCSeconds()).slice(-2)
});
- } else if(date.getUTCMinutes()>0){
+ } 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")
- });
+ plural_s: (date.getUTCMinutes() === 1 && date.getUTCSeconds() === 0 ? "": "s")
+ });
timeStringMobile = t('files', '{minutes}:{seconds}m' , {
minutes: date.getUTCMinutes(),
seconds: ('0' + date.getUTCSeconds()).slice(-2)
});
- } else if(date.getUTCSeconds()>0){
+ } else if(date.getUTCSeconds() > 0){
timeStringDesktop = t('files', '{seconds} second{plural_s} left' , {
seconds: date.getUTCSeconds(),
- plural_s: (date.getUTCSeconds() == 1 ? "": "s")
+ plural_s: (date.getUTCSeconds() === 1 ? "": "s")
});
timeStringMobile = t('files', '{seconds}s' , {seconds: date.getUTCSeconds()});
} else {
@@ -526,7 +534,13 @@ OC.Upload = {
}
$('#uploadprogressbar .label .mobile').text(timeStringMobile);
$('#uploadprogressbar .label .desktop').text(timeStringDesktop);
- $('#uploadprogressbar').attr('original-title', t('files', '{loadedSize} of {totalSize} ({bitrate})', {loadedSize: humanFileSize(data.loaded), totalSize: humanFileSize(data.total), bitrate: humanFileSize(data.bitrate) + '/s'}));
+ $('#uploadprogressbar').attr('original-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) {