aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'juick-www/src/main')
-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);
}
}