diff options
-rw-r--r-- | juick-www/src/main/static/scripts.js | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/juick-www/src/main/static/scripts.js b/juick-www/src/main/static/scripts.js index 2daaa8c0..244c83c6 100644 --- a/juick-www/src/main/static/scripts.js +++ b/juick-www/src/main/static/scripts.js @@ -787,26 +787,27 @@ ready(function () { e.preventDefault(); }); } - var newMessageBlock = document.getElementById('newmessage'); - if (newMessageBlock) { - var form = newMessageBlock.parentNode; - form.addEventListener('submit', newMessage); - newMessageBlock.querySelector('textarea').addEventListener('click', function (e) { - var parent = e.target.parentNode; - e.target.addEventListener('keypress', function (e) { - postformListener(e.target, e); - }); - }); - newMessageBlock.querySelector('a').addEventListener('click', function (e) { - attachMessagePhoto(e.target); - }); - } + var post = document.getElementById('post'); post.addEventListener('click', (e) => { openPostDialog(); - var ta = document.querySelector('#newmessage textarea'); - ta.style.minHeight = '70px'; - ta.focus(); + var newMessageBlock = document.getElementById('newmessage'); + if (newMessageBlock) { + var form = newMessageBlock.parentNode; + form.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.style.minHeight = '70px'; + ta.focus(); + newMessageBlock.querySelector('a').addEventListener('click', function (e) { + attachMessagePhoto(e.target); + }); + } e.preventDefault(); }); document.querySelectorAll('article').forEach(function (article) { |