Permalink
Browse files

Fix style of upload zip button and add similar behavior to previous b…

…uttons
  • Loading branch information...
1 parent adc4d64 commit 7acc378bbde12b07ae916d7ace3aab3626e89764 Wilbur Shi committed Aug 10, 2016
Showing with 17 additions and 9 deletions.
  1. +17 −9 js/photonic3d.js
View
@@ -91,28 +91,36 @@ function uploadZip(zipFile, fileName) {
request = new XMLHttpRequest();
request.open("POST", "/services/printables/uploadPrintableFile");
// When the request is successfully sent, load the tab to printablesPage
- // request.onreadystatechange = function () {
- // if (request.readyState == 4 && request.status == 200) {
- // window.open('/printablesPage', '_self');
- // }
- // }
+ request.onreadystatechange = function () {
+ if (request.readyState == 4 && request.status == 200) {
+ // window.open('/printablesPage', '_self');
+ alert("Upload successful! Refresh printables page on Photonic3D to see the file.");
+ }
+ }
request.send(form);
}
function makeButton() {
//rename original zip button
var btn = document.getElementById("zip-button");
- btn.innerHTML = '<span class="glyphicon glyphicon-compressed"></span> Download ZIP'
+ btn.innerHTML = '<span class="glyphicon glyphicon-compressed"></span> ZIP'
//create new zip button
var newbtn = document.createElement("BUTTON");
+ btn.parentNode.insertBefore(newbtn, btn.nextSibling);
newbtn.onclick = function () {
makeZip();
}
newbtn.id = "new-zip-button";
newbtn.className = "btn btn-primary";
- // $('#new-zip-button').prop('disabled', 'disabled');
- newbtn.innerHTML = '<span class="glyphicon glyphicon-upload"></span> Upload ZIP To Printables'
- btn.parentNode.insertBefore(newbtn, btn);
+ newbtn.disabled = true;
+ newbtn.innerHTML = '<span class="glyphicon glyphicon-upload"></span> Upload ZIP To Photonic3D';
+}
+
+var oldEndSlicing = endSlicing;
+
+endSlicing = function() {
+ oldEndSlicing();
+ $('#new-zip-button').prop('disabled', false);
}
$(document).ready(initializeValues);

0 comments on commit 7acc378

Please sign in to comment.