use single quotes
This commit is contained in:
parent
574e128f16
commit
bac207bddd
1 changed files with 10 additions and 10 deletions
|
@ -28,14 +28,14 @@ pandora.ui.upload = function(oshash, file) {
|
||||||
that.status = 'requesting chunk upload';
|
that.status = 'requesting chunk upload';
|
||||||
that.progress = 0;
|
that.progress = 0;
|
||||||
self.req = new XMLHttpRequest();
|
self.req = new XMLHttpRequest();
|
||||||
self.req.addEventListener("load", function (evt) {
|
self.req.addEventListener('load', function (evt) {
|
||||||
var response = {};
|
var response = {};
|
||||||
that.responseText = evt.target.responseText;
|
that.responseText = evt.target.responseText;
|
||||||
try {
|
try {
|
||||||
response = JSON.parse(evt.target.responseText);
|
response = JSON.parse(evt.target.responseText);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
response = {};
|
response = {};
|
||||||
that.status = "failed to parse response";
|
that.status = 'failed to parse response';
|
||||||
that.progress = -1;
|
that.progress = -1;
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
|
@ -57,13 +57,13 @@ pandora.ui.upload = function(oshash, file) {
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
}, false);
|
}, false);
|
||||||
self.req.addEventListener("error", function (evt) {
|
self.req.addEventListener('error', function (evt) {
|
||||||
that.status = 'uplaod failed';
|
that.status = 'uplaod failed';
|
||||||
that.progress = -1;
|
that.progress = -1;
|
||||||
that.responseText = evt.target.responseText;
|
that.responseText = evt.target.responseText;
|
||||||
that.triggerEvent('done', tat);
|
that.triggerEvent('done', tat);
|
||||||
}, false);
|
}, false);
|
||||||
self.req.addEventListener("abort", function (evt) {
|
self.req.addEventListener('abort', function (evt) {
|
||||||
that.status = 'aborted';
|
that.status = 'aborted';
|
||||||
that.progress = -1;
|
that.progress = -1;
|
||||||
that.triggerEvent('done', tat);
|
that.triggerEvent('done', tat);
|
||||||
|
@ -72,7 +72,7 @@ pandora.ui.upload = function(oshash, file) {
|
||||||
Ox.forEach(uploadData, function(value, key) {
|
Ox.forEach(uploadData, function(value, key) {
|
||||||
formData.append(key, value);
|
formData.append(key, value);
|
||||||
});
|
});
|
||||||
self.req.open("POST", uploadUrl);
|
self.req.open('POST', uploadUrl);
|
||||||
self.req.send(formData);
|
self.req.send(formData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ pandora.ui.upload = function(oshash, file) {
|
||||||
progress(parseFloat(chunkOffset)/bytesAvailable);
|
progress(parseFloat(chunkOffset)/bytesAvailable);
|
||||||
|
|
||||||
self.req = new XMLHttpRequest();
|
self.req = new XMLHttpRequest();
|
||||||
self.req.addEventListener("load", function (evt) {
|
self.req.addEventListener('load', function (evt) {
|
||||||
var response;
|
var response;
|
||||||
that.responseText = evt.target.responseText;
|
that.responseText = evt.target.responseText;
|
||||||
try {
|
try {
|
||||||
|
@ -130,7 +130,7 @@ pandora.ui.upload = function(oshash, file) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, false);
|
}, false);
|
||||||
self.req.addEventListener("error", function (evt) {
|
self.req.addEventListener('error', function (evt) {
|
||||||
//failed to upload, try again in 3 second
|
//failed to upload, try again in 3 second
|
||||||
retries++;
|
retries++;
|
||||||
if (maxRetry > 0 && retries > maxRetry) {
|
if (maxRetry > 0 && retries > maxRetry) {
|
||||||
|
@ -143,12 +143,12 @@ pandora.ui.upload = function(oshash, file) {
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
}
|
||||||
}, false);
|
}, false);
|
||||||
self.req.upload.addEventListener("progress", function (evt) {
|
self.req.upload.addEventListener('progress', function (evt) {
|
||||||
if (evt.lengthComputable) {
|
if (evt.lengthComputable) {
|
||||||
progress(parseFloat(chunkOffset + evt.loaded) / bytesAvailable);
|
progress(parseFloat(chunkOffset + evt.loaded) / bytesAvailable);
|
||||||
}
|
}
|
||||||
}, false);
|
}, false);
|
||||||
self.req.addEventListener("abort", function (evt) {
|
self.req.addEventListener('abort', function (evt) {
|
||||||
that.status = 'aborted';
|
that.status = 'aborted';
|
||||||
that.progress = -1;
|
that.progress = -1;
|
||||||
done();
|
done();
|
||||||
|
@ -160,7 +160,7 @@ pandora.ui.upload = function(oshash, file) {
|
||||||
formData.append('done', 1);
|
formData.append('done', 1);
|
||||||
}
|
}
|
||||||
formData.append('chunk', chunk);
|
formData.append('chunk', chunk);
|
||||||
self.req.open("POST", chunkUrl, true);
|
self.req.open('POST', chunkUrl, true);
|
||||||
self.req.send(formData);
|
self.req.send(formData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue