Additional fix to be inline with what APP Engine expects

This commit is contained in:
jdescottes 2013-08-05 23:57:51 +02:00
parent b42f896584
commit 2deaf00911

View File

@ -178,34 +178,33 @@
formData.append('name', $('#piskel-name').val()); formData.append('name', $('#piskel-name').val());
formData.append('frames', frameSheet.getFrameCount()); formData.append('frames', frameSheet.getFrameCount());
// Get image/png data for first frame // Get image/png data for first frame
formData.append('preview', this.getFirstFrameAsPNGData_()); formData.append('preview', this.getFirstFrameAsPNGData_());
var imageData = (new pskl.rendering.SpritesheetRenderer(frameSheet)).renderAsImageDataSpritesheetPNG();
formData.append('framesheet', imageData);
xhr.open('POST', "save", true); xhr.open('POST', "save", true);
} }
xhr.onload = function (e) { xhr.onload = function(e) {
if (this.status == 200) { if (this.status == 200) {
if (pskl.app.isStaticVersion) { if (pskl.app.isStaticVersion) {
var baseUrl = window.location.href.replace(window.location.search, ""); var baseUrl = window.location.href.replace(window.location.search, "");
window.location.href = baseUrl + "?frameId=" + this.responseText; window.location.href = baseUrl + "?frameId=" + this.responseText;
} else { } else {
$.publish(Events.SHOW_NOTIFICATION, [{ $.publish(Events.SHOW_NOTIFICATION, [{"content": "Successfully saved !"}]);
"content" : "Successfully saved !"
}]);
} }
} else { } else {
this.onerror(e); this.onerror(e);
} }
}; };
xhr.onerror = function (e) { xhr.onerror = function(e) {
$.publish(Events.SHOW_NOTIFICATION, [{ $.publish(Events.SHOW_NOTIFICATION, [{"content": "Saving failed ("+this.status+")"}]);
"content" : "Saving failed (" + this.status + ")"
}]);
}; };
xhr.send(formData); xhr.send(formData);
if (event) { if(event) {
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();
} }