diff options
Diffstat (limited to 'juick-www/src/main')
-rw-r--r-- | juick-www/src/main/static/scripts.js | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/juick-www/src/main/static/scripts.js b/juick-www/src/main/static/scripts.js index 4cd1bc82..08c02a9e 100644 --- a/juick-www/src/main/static/scripts.js +++ b/juick-www/src/main/static/scripts.js @@ -659,22 +659,21 @@ ready(function () { autosize(ta); }); - var insertButtons = function (e) { - var textarea = e.target; - textarea.classList.add('narrow'); - var att = document.createElement('div'); + let insertButtons = function (e) { + let textarea = e.target; + let att = document.createElement('div'); att.classList.add('attach-photo'); att.addEventListener('click', function (e) { attachCommentPhoto(e.target); }); textarea.parentNode.insertBefore(att, textarea.nextSibling); textarea.parentNode.insertAdjacentHTML('afterend', '<input type="submit" value="OK"/>'); - textarea.removeEventListener('click', insertButtons); + textarea.removeEventListener('focus', insertButtons); e.preventDefault(); }; - document.querySelectorAll('textarea.reply').forEach(function (e) { - e.addEventListener('click', insertButtons); - e.addEventListener('keypress', function (e) { + document.querySelectorAll('textarea.reply').forEach(function (ta) { + ta.addEventListener('focus', insertButtons); + ta.addEventListener('keypress', function (e) { postformListener(e.target, e); }); }); @@ -724,7 +723,7 @@ ready(function () { }); }); let threadTextarea = document.querySelector('.msgthread .ta-wrapper textarea'); - if (threadTextarea) { + if (threadTextarea && !window.location.hash) { threadTextarea.focus(); } document.querySelectorAll('.l .a-privacy').forEach(function (e) { |