From 9a625f21791c3d80380433e96f36cfe05f7485df Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 30 Aug 2017 09:37:16 +0300 Subject: www: fix upload button --- juick-www/src/main/static/scripts.js | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'juick-www') 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) { -- cgit v1.2.3