Browse Source

remove most of CSS from JavaScript

The uploadElement is probably going to have to stay, unfortunately, but
the rest is gone.
pull/25/head
mutantmonkey 9 years ago
parent
commit
f216b06df5
  1. 16
      static/css/dropzone.css
  2. 24
      static/js/upload.js

16
static/css/dropzone.css

@ -1,5 +1,4 @@
#dropzone {
width: 400px;
#dropzone { width: 400px;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
} }
@ -46,6 +45,11 @@ div.upload {
color: #556A7F; color: #556A7F;
} }
.upload .deleted,
.upload .error {
color: #E68181;
}
.upload .right { .upload .right {
float: right; float: right;
padding-left: 5px; padding-left: 5px;
@ -55,4 +59,10 @@ div.upload {
margin-right: 5px; margin-right: 5px;
font-size: 10px; font-size: 10px;
border-bottom: 1px dotted #556A7F; border-bottom: 1px dotted #556A7F;
}
color: #E68181;
cursor: pointer;
}
.dz-drag-hover div.dz-default {
background-color: #2c89f0;
}

24
static/js/upload.js

@ -1,24 +1,5 @@
Dropzone.options.dropzone = { Dropzone.options.dropzone = {
init: function() { init: function() {
this.dzone = document.getElementById("dzone");
this.on("drop", function(ev) {
this.dzone.style.backgroundColor = "#FAFBFC";
});
this.on("dragstart", function(ev) {
this.dzone.style.backgroundColor = "#2c89f0";
});
this.on("dragend", function(ev) {
this.dzone.style.backgroundColor = "#FAFBFC";
});
this.on("dragenter", function(ev) {
this.dzone.style.backgroundColor = "#2c89f0";
});
this.on("dragover", function(ev) {
this.dzone.style.backgroundColor = "#2c89f0";
});
this.on("dragleave", function(ev) {
this.dzone.style.backgroundColor = "#FAFBFC";
});
}, },
addedfile: function(file) { addedfile: function(file) {
var upload = document.createElement("div"); var upload = document.createElement("div");
@ -62,7 +43,6 @@ Dropzone.options.dropzone = {
file.leftElement.innerHTML = '<a target="_blank" href="' + resp.url + '">' + resp.url + '</a>'; file.leftElement.innerHTML = '<a target="_blank" href="' + resp.url + '">' + resp.url + '</a>';
file.rightRightElement.innerHTML = "Delete"; file.rightRightElement.innerHTML = "Delete";
file.rightRightElement.className = "cancel"; file.rightRightElement.className = "cancel";
file.rightRightElement.style.color = "#E68181";
file.rightRightElement.onclick = function(ev) { file.rightRightElement.onclick = function(ev) {
xhr = new XMLHttpRequest(); xhr = new XMLHttpRequest();
xhr.open("DELETE", resp.url, true); xhr.open("DELETE", resp.url, true);
@ -70,7 +50,7 @@ Dropzone.options.dropzone = {
xhr.onreadystatechange = function(file) { xhr.onreadystatechange = function(file) {
if (xhr.status === 404) { if (xhr.status === 404) {
file.leftElement.innerHTML = 'Deleted <a target="_blank" href="' + resp.url + '">' + resp.url + '</a>'; file.leftElement.innerHTML = 'Deleted <a target="_blank" href="' + resp.url + '">' + resp.url + '</a>';
file.leftElement.style.color = "#E68181";
file.leftElement.className = "deleted";
file.rightRightElement.onclick = null; file.rightRightElement.onclick = null;
file.rightRightElement.innerHTML = ""; file.rightRightElement.innerHTML = "";
} }
@ -88,7 +68,7 @@ Dropzone.options.dropzone = {
else { else {
file.leftElement.innerHTML = "Could not upload " + file.name; file.leftElement.innerHTML = "Could not upload " + file.name;
} }
file.leftElement.style.color = "#E68181";
file.leftElement.className = "error";
}, },
maxFilesize: 4096, maxFilesize: 4096,

Loading…
Cancel
Save