aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Killy2017-10-26 23:32:38 +0300
committerGravatar Killy2017-10-26 23:32:38 +0300
commit530f7af25aa4f8261d580d6c0ba7b666bf3f1442 (patch)
treeab61c0979f2749982c5723048cfc171ff19d8449
parent8d11b5e2c030d75afb1d144423ec37c7945f9b5d (diff)
www: photo remove and reattach fix
-rw-r--r--juick-www/src/main/static/scripts.js17
1 files changed, 9 insertions, 8 deletions
diff --git a/juick-www/src/main/static/scripts.js b/juick-www/src/main/static/scripts.js
index e08d8351..06fd78c7 100644
--- a/juick-www/src/main/static/scripts.js
+++ b/juick-www/src/main/static/scripts.js
@@ -379,16 +379,17 @@ function attachInput() {
}
function attachCommentPhoto(div) {
- if (div.children.length === 1) {
- let inp = attachInput();
- inp.addEventListener('change', function () {
+ let input = div.querySelector('input');
+ if (input) {
+ input.remove();
+ div.classList.remove('attach-photo-active');
+ } else {
+ let newInput = attachInput();
+ newInput.addEventListener('change', function () {
div.classList.add('attach-photo-active');
});
- inp.click();
- div.appendChild(inp);
- } else {
- div.innerHTML = null;
- div.classList.remove('attach-photo-active');
+ newInput.click();
+ div.appendChild(newInput);
}
}