Contains the Concourse pipeline definition for building a line-server container
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
3.1 KiB

  1. Dropzone.options.dropzone = {
  2. addedfile: function(file) {
  3. var upload = document.createElement("div");
  4. upload.className = "upload";
  5. var left = document.createElement("span");
  6. left.innerHTML = file.name;
  7. file.leftElement = left;
  8. upload.appendChild(left);
  9. var right = document.createElement("div");
  10. right.className = "right";
  11. var rightleft = document.createElement("span");
  12. rightleft.className = "cancel";
  13. rightleft.innerHTML = "Cancel";
  14. rightleft.onclick = function(ev) {
  15. this.removeFile(file);
  16. }.bind(this);
  17. var rightright = document.createElement("span");
  18. right.appendChild(rightleft);
  19. file.rightLeftElement = rightleft;
  20. right.appendChild(rightright);
  21. file.rightRightElement = rightright;
  22. file.rightElement = right;
  23. upload.appendChild(right);
  24. file.uploadElement = upload;
  25. document.getElementById("uploads").appendChild(upload);
  26. },
  27. uploadprogress: function(file, p, bytesSent) {
  28. p = parseInt(p);
  29. file.rightRightElement.innerHTML = p + "%";
  30. file.uploadElement.setAttribute("style", 'background-image: -webkit-linear-gradient(left, #F2F4F7 ' + p + '%, #E2E2E2 ' + p + '%); background-image: -moz-linear-gradient(left, #F2F4F7 ' + p + '%, #E2E2E2 ' + p + '%); background-image: -ms-linear-gradient(left, #F2F4F7 ' + p + '%, #E2E2E2 ' + p + '%); background-image: -o-linear-gradient(left, #F2F4F7 ' + p + '%, #E2E2E2 ' + p + '%); background-image: linear-gradient(left, #F2F4F7 ' + p + '%, #E2E2E2 ' + p + '%)');
  31. },
  32. sending: function(file, xhr, formData) {
  33. formData.append("randomize", document.getElementById("randomize").checked);
  34. formData.append("expires", document.getElementById("expires").selectedOptions[0].value);
  35. },
  36. success: function(file, resp) {
  37. file.rightLeftElement.innerHTML = "";
  38. file.leftElement.innerHTML = '<a target="_blank" href="' + resp.url + '">' + resp.url + '</a>';
  39. file.rightRightElement.innerHTML = "Delete";
  40. file.rightRightElement.className = "cancel";
  41. file.rightRightElement.style.color = "#E68181";
  42. file.rightRightElement.onclick = function(ev) {
  43. xhr = new XMLHttpRequest();
  44. xhr.open("DELETE", resp.url, true);
  45. xhr.setRequestHeader("X-Delete-Key", resp.delete_key);
  46. xhr.onreadystatechange = function(file) {
  47. if (xhr.status === 404) {
  48. file.leftElement.innerHTML = 'Deleted <a target="_blank" href="' + resp.url + '">' + resp.url + '</a>';
  49. file.leftElement.style.color = "#E68181";
  50. file.rightRightElement.onclick = null;
  51. file.rightRightElement.innerHTML = "";
  52. }
  53. }.bind(this, file);
  54. xhr.send();
  55. }.bind(this);
  56. },
  57. error: function(file, errMsg, xhrO) {
  58. file.rightLeftElement.onclick = null;
  59. file.rightLeftElement.innerHTML = "";
  60. file.rightRightElement.innerHTML = "";
  61. if (file.status === "canceled") {
  62. file.leftElement.innerHTML = "Canceled " + file.name;
  63. }
  64. else {
  65. file.leftElement.innerHTML = "Could not upload " + file.name;
  66. }
  67. file.leftElement.style.color = "#E68181";
  68. },
  69. maxFilesize: 4096,
  70. previewsContainer: "#uploads",
  71. parallelUploads: 5,
  72. headers: {"Accept": "application/json"},
  73. dictDefaultMessage: "Click or Drop file(s)",
  74. dictFallbackMessage: ""
  75. };