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.js24
1 files changed, 13 insertions, 11 deletions
diff --git a/juick-www/src/main/static/scripts.js b/juick-www/src/main/static/scripts.js
index 6b4d3f08..48c99287 100644
--- a/juick-www/src/main/static/scripts.js
+++ b/juick-www/src/main/static/scripts.js
@@ -288,12 +288,14 @@ function closeDialogListener(ev) {
}
}
-function newMessage() {
+function newMessage(evt) {
+ document.querySelectorAll('#newmessage .dialogtxt').forEach(t => {
+ t.remove();
+ });
if (document.querySelector('#newmessage textarea').value.length == 0) {
- openDialog('<p class="dialogtxt">' + i18n('postForm.pleaseInputMessageText') + '</p>');
- return false;
+ document.querySelector('#newmessage').insertAdjacentHTML('afterbegin', `<p class="dialogtxt">${i18n('postForm.pleaseInputMessageText')}</p>`);
+ evt.preventDefault();
}
- return true;
}
function showMoreReplies(el, id) {
@@ -818,18 +820,18 @@ ready(function () {
getTags();
var newMessageBlock = document.getElementById('newmessage');
if (newMessageBlock) {
- var form = newMessageBlock.parentNode;
- form.addEventListener('submit', newMessage);
+ newMessageBlock.addEventListener('submit', newMessage);
let ta = newMessageBlock.querySelector('textarea');
- ta.addEventListener('click', function (e) {
- var parent = e.target.parentNode;
- e.target.addEventListener('keypress', function (e) {
- postformListener(e.target, e);
- });
+ ta.addEventListener('keypress', function (e) {
+ postformListener(e.target, e);
});
ta.style.minHeight = '70px';
autosize(ta);
ta.focus();
+ newMessageBlock.querySelector('#tags_input')
+ .addEventListener('keypress', function (e) {
+ postformListener(e.target, e);
+ });
newMessageBlock.querySelector('a').addEventListener('click', function (e) {
attachMessagePhoto(e.target);
});