Permalink
Browse files

modified button and sent blob

  • Loading branch information...
1 parent 1bd122b commit 61721dc4baf7fdebd2c74e6d6c9010012d184541 @angela-ko angela-ko committed Aug 6, 2016
Showing with 36 additions and 0 deletions.
  1. +36 −0 js/photonic3d.js
View
@@ -42,6 +42,7 @@ function initializeValues() {
$slicerSpeedYes[0].checked = true;
$slicerSpeedNo[0].checked = false;
$slicerSpeedDelay.val(0);
+ makeButton();
// Update global javascript object with slicer settings
settings.set('slicer.speed', $slicerSpeedYes[0].checked);
@@ -61,8 +62,43 @@ function initializeValues() {
// Error handling
}
+
+
// loader.load(/*insert file here*/);
}
+function makeZip() {
+ if (zipFile) {
+ var name = 'SLAcer';
+ if (loadedFile && loadedFile.name) {
+ name = loadedFile.name;
+ }
+ uploadZip(zipFile.generate({type: 'blob'}), name + '.zip');
+ $location.path('/printables');
+ }
+}
+
+function uploadZip(zipFile) {
+ var blob = zipFile,
+ form = new FormData(),
+ request = new XMLHttpRequest();
+ form.append("blob",blob);
+ request.open(
+ "POST",
+ "/services/printerables//uploadPrintableFile",
+ true
+ );
+ request.send(form);
+}
+
+function makeButton() {
+ var btn = document.getElementById("zip-button");
+ btn.onclick = function () {
+ makeZip();
+ };
+ btn.id = "new-zip-button";
+ btn.innerHTML = "New Zip";
+}
+
$(document).ready(initializeValues);

0 comments on commit 61721dc

Please sign in to comment.