Commit 8121804f by Dányi Bence

webui: whitespace fix

parent bfb09f0f
......@@ -28,10 +28,10 @@ var cloud = (function(cloud) {
return cloud.convert(self.quota.rawSoft(), 1);
});
self.quota.usedBar = ko.computed(function() {
return(self.quota.rawUsed() / self.quota.rawHard() * 100).toFixed(0) + '%';
return (self.quota.rawUsed() / self.quota.rawHard() * 100).toFixed(0) + '%';
}, self);
self.quota.softPos = ko.computed(function() {
return(self.quota.rawSoft() / self.quota.rawHard() * 100).toFixed(0) + '%';
return (self.quota.rawSoft() / self.quota.rawHard() * 100).toFixed(0) + '%';
}, self);
self.sortBy = ko.observable('name');
......@@ -51,28 +51,28 @@ var cloud = (function(cloud) {
var sortFiles = (function() {
self.files.sort({
name: function(a, b) {
if(a.type === b.type) {
if (a.type === b.type) {
return a.originalName.localeCompare(b.originalName);
}
if(a.type === gettext('file')) {
if (a.type === gettext('file')) {
return 1;
}
return -1;
},
date: function(a, b) {
if(a.type === b.type) {
if (a.type === b.type) {
return new Date(b.mTime).getTime() - new Date(a.mTime).getTime();
}
if(a.type === gettext('file')) {
if (a.type === gettext('file')) {
return 1;
}
return -1;
},
size: function(a, b) {
if(a.type === b.type) {
if (a.type === b.type) {
return b.originalSize - a.originalSize;
}
if(a.type === gettext('file')) {
if (a.type === gettext('file')) {
return 1;
}
return -1;
......@@ -91,7 +91,7 @@ var cloud = (function(cloud) {
url: '/ajax/store/list',
dataType: 'json',
success: function(data) {
if(!fast) {
if (!fast) {
$('.file-list .real').css({
left: 0,
position: 'relative'
......@@ -147,7 +147,7 @@ var cloud = (function(cloud) {
var added = 0;
self.notInRoot(self.currentPath().lastIndexOf('/') !== 0);
self.files([]);
for(var i in data) {
for (var i in data) {
addFile(data[i]);
}
sortFiles();
......@@ -159,7 +159,7 @@ var cloud = (function(cloud) {
function addFile(d) {
var viewData;
if(d.TYPE === 'D') {
if (d.TYPE === 'D') {
viewData = {
originalName: d.NAME,
originalSize: 0,
......@@ -185,8 +185,8 @@ var cloud = (function(cloud) {
ppt: /\.pptx?/,
music: /\.(wav|mp3)$/
};
for(var i in ext) {
if(d.NAME.match(ext[i])) {
for (var i in ext) {
if (d.NAME.match(ext[i])) {
type = i;
break;
}
......@@ -194,7 +194,7 @@ var cloud = (function(cloud) {
var extension;
try {
extension = d.NAME.match(/\.\w+$/)[0].substr(1);
} catch(ex) {
} catch (ex) {
extension = 'N/A';
}
viewData = {
......@@ -220,7 +220,7 @@ var cloud = (function(cloud) {
//firefox sucks :S
try {
$(e).hide().slideDown(500);
} catch(ex) {
} catch (ex) {
}
}
......@@ -230,7 +230,7 @@ var cloud = (function(cloud) {
$(e).slideUp(500, function() {
e.parentNode.removeChild(e);
});
} catch(ex) {
} catch (ex) {
e.parentNode.removeChild(e);
}
}
......@@ -241,7 +241,7 @@ var cloud = (function(cloud) {
self.download = function(item, ev) {
ev.stopPropagation();
ev.preventDefault();
if(window.navigator.userAgent.indexOf('cloud-gui') > -1) {
if (window.navigator.userAgent.indexOf('cloud-gui') > -1) {
window.location.href = 'cloudfile:' + self.currentPath() + item.originalName;
return;
}
......@@ -264,7 +264,7 @@ var cloud = (function(cloud) {
ev.preventDefault();
$('#modal').show();
s = "";
if(item.type == gettext('file')) {
if (item.type == gettext('file')) {
s = gettext("You are removing the file <strong>%s</strong>.");
} else {
s = gettext("You are removing the folder <strong>%s</strong> (and its content).");
......@@ -372,9 +372,10 @@ var cloud = (function(cloud) {
/**
* Uploads the specified file(s)
*/
var readfiles = cloud.delayUntil(function(file) {
var readfiles = cloud.delayUntil(function(file, next) {
console.log('read', next)
//1 GB file limit
if(file.size > 1024 * 1024 * 1024) {
if (file.size > 1024 * 1024 * 1024) {
$('#upload-zone').hide();
$('#upload-error').show();
$('#upload-error-size').show();
......@@ -388,7 +389,7 @@ var cloud = (function(cloud) {
var formData = tests.formdata ? new FormData() : null;
formData.append('data', file);
// now post a new XHR request
if(tests.formdata) {
if (tests.formdata) {
var xhr = new XMLHttpRequest();
var start = new Date().getTime();
xhr.open('POST', self.uploadURL());
......@@ -401,12 +402,12 @@ var cloud = (function(cloud) {
self.uploadURL('/');
loadFolder(self.currentPath());
}
if(tests.progress) {
if (tests.progress) {
$('#upload-zone').hide();
$('#upload-progress-text').show();
var originalUsedQuota = self.quota.rawUsed();
xhr.upload.onprogress = function(event) {
if(event.lengthComputable) {
if (event.lengthComputable) {
self.quota.rawUsed(originalUsedQuota + parseInt(event.loaded / 1024));
var complete = (event.loaded / event.total * 100 | 0);
//progress.value = progress.innerHTML = complete;
......@@ -414,16 +415,16 @@ var cloud = (function(cloud) {
var suffix = 'B KB MB GB'.split(' ');
var l = event.loaded;
var t = event.total;
for(var i = 0; l > 1024; i++) {
for (var i = 0; l > 1024; i++) {
l /= 1024;
}
l = l.toFixed(1) + ' ' + suffix[i];
for(var i = 0; t > 1024; i++) {
for (var i = 0; t > 1024; i++) {
t /= 1024;
}
t = t.toFixed(1) + ' ' + suffix[i];
var diff = new Date().getTime() - start;
if(complete < 100) {
if (complete < 100) {
$('#upload-progress-text').html(gettext('Upload') + ': ' + cloud.convert(event.loaded / diff * 1000) + '/s (' + (event.loaded / event.total * 100).toFixed(2) + '%)');
} else {
$('#upload-progress-text').html(gettext('Upload') + ': ' + gettext('done, processing...'));
......@@ -447,7 +448,7 @@ var cloud = (function(cloud) {
return false;
});
document.addEventListener('dragover', function(e) {
if(!uploadURLRequestInProgress && self.uploadURL() == '/') {
if (!uploadURLRequestInProgress && self.uploadURL() == '/') {
$('.file-upload .summary').click();
}
e.stopPropagation();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment