Commit 8121804f by Dányi Bence

webui: whitespace fix

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