aboutsummaryrefslogtreecommitdiff
path: root/juick-www
diff options
context:
space:
mode:
authorGravatar Killy2017-10-24 02:37:14 +0300
committerGravatar Killy2017-10-24 02:37:14 +0300
commit65cd5489a296b98eb2be839d1c7dafee7dd2d03b (patch)
tree3fc5c514eb0347c951ef07cb8895a911a9196676 /juick-www
parent99c83acf6295d2d40b228be2bcff41689a0d5d5b (diff)
www: comment form fixes
show form buttons on focus; only focus if there is no hash (reply anchor) in url
Diffstat (limited to 'juick-www')
-rw-r--r--juick-www/src/main/static/scripts.js17
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) {