diff --git a/files/assets/js/core.js b/files/assets/js/core.js index 8175cbb56..b30a6b667 100644 --- a/files/assets/js/core.js +++ b/files/assets/js/core.js @@ -66,6 +66,18 @@ function postToast(t, url, data, extraActionsOnSuccess, extraActionsOnFailure) { xhr[0].send(xhr[1]); } +function handle_disabled(t) { + btn = t.parentElement.getElementsByClassName('handle_disabled')[0] + if (t.value) { + btn.disabled = false; + btn.classList.remove('disabled') + } + else { + btn.disabled = true; + btn.classList.add('disabled') + } +} + function postToastReload(t, url) { postToast(t, url, {}, reload); } @@ -434,6 +446,8 @@ function insertText(input, text) { input.setSelectionRange(newPos, newPos); input.selectionStart = newPos; + + handle_disabled(input) } diff --git a/files/assets/js/gif_modal.js b/files/assets/js/gif_modal.js index 0a10b45b1..f3c047589 100644 --- a/files/assets/js/gif_modal.js +++ b/files/assets/js/gif_modal.js @@ -11,6 +11,7 @@ function insertGIF(url) { if (old) commentBox.value = `${old}\n${url}`; else commentBox.value = url + handle_disabled(commentBox) if (typeof checkForRequired === "function") checkForRequired(); } diff --git a/files/templates/comments.html b/files/templates/comments.html index c592bf131..f2643a50a 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -249,7 +249,7 @@ {% if v and (v.id == c.author_id or v.admin_level >= PERMS['POST_COMMENT_EDITING']) %}
- + {{macros.file_input('file-upload-macro', 'input-message', not get_setting('dm_media'))}}
- +
@@ -491,12 +491,12 @@ {% if v and v.id != u.id %}
- + {{macros.file_input('file-upload-mobile', 'input-message-mobile')}}
- +
diff --git a/files/templates/util/macros.html b/files/templates/util/macros.html index 5fb040608..a7ba0e3ab 100644 --- a/files/templates/util/macros.html +++ b/files/templates/util/macros.html @@ -122,13 +122,13 @@
- +
{{file_input('file-upload-reply-' ~ target_fullname, 'reply-form-body-' ~ target_fullname, False)}} - + {% if enable_cancel_button %}