aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/main
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-10-02 22:09:09 +0300
committerGravatar Vitaly Takmazov2017-10-02 22:09:09 +0300
commit81936b6dee3bd70827bdd8887f76264c854e5aca (patch)
tree2ccb3b28098306116930ac0be2eba4eafbb7fb41 /juick-www/src/main
parenta62e5672628c5daca0763e6bc2f949c082bb0d62 (diff)
www: clean js warnings
Diffstat (limited to 'juick-www/src/main')
-rw-r--r--juick-www/src/main/static/scripts.js52
1 files changed, 27 insertions, 25 deletions
diff --git a/juick-www/src/main/static/scripts.js b/juick-www/src/main/static/scripts.js
index 8cee5b87..72dbce8b 100644
--- a/juick-www/src/main/static/scripts.js
+++ b/juick-www/src/main/static/scripts.js
@@ -822,32 +822,34 @@ ready(function () {
}
var post = document.getElementById('post');
- if (post) post.addEventListener('click', (e) => {
- openPostDialog();
- getTags();
- var newMessageBlock = document.getElementById('newmessage');
- if (newMessageBlock) {
- newMessageBlock.addEventListener('submit', newMessage);
- let ta = newMessageBlock.querySelector('textarea');
- if (window.draft) {
- ta.innerHTML = window.draft;
- }
- 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) {
+ if (post) {
+ post.addEventListener('click', (e) => {
+ openPostDialog();
+ getTags();
+ var newMessageBlock = document.getElementById('newmessage');
+ if (newMessageBlock) {
+ newMessageBlock.addEventListener('submit', newMessage);
+ let ta = newMessageBlock.querySelector('textarea');
+ if (window.draft) {
+ ta.innerHTML = window.draft;
+ }
+ ta.addEventListener('keypress', function (e) {
postformListener(e.target, e);
- });
- newMessageBlock.querySelector('a').addEventListener('click', function (e) {
- attachMessagePhoto(e.target);
- });
- }
- e.preventDefault();
- });
+ });
+ 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);
+ });
+ }
+ e.preventDefault();
+ });
+ }
document.querySelectorAll('article').forEach(function (article) {
if (Array.prototype.some.call(
article.querySelectorAll('.msg-tags a'),