diff options
author | Vitaly Takmazov | 2022-12-08 07:27:51 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2022-12-08 07:27:51 +0300 |
commit | 3a10067e6590699f2ee6e0dbbd24c66e40505833 (patch) | |
tree | 88111a0ea2cf2450b66ea09387f1f124a51cedbc /src/main/assets/scripts.js | |
parent | e3c4cd8414ee75f17305a29b4ec091aadcf1832e (diff) |
scripts: JSDoc cleanup
Diffstat (limited to 'src/main/assets/scripts.js')
-rw-r--r-- | src/main/assets/scripts.js | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/main/assets/scripts.js b/src/main/assets/scripts.js index 8d201438..95ca913d 100644 --- a/src/main/assets/scripts.js +++ b/src/main/assets/scripts.js @@ -260,8 +260,13 @@ function handleErrors(response) { return response; } +/** + * + * @param {number} mid message id + * @param {string} rid reply id + */ function showCommentForm(mid, rid) { - let reply = document.getElementById(rid); + let reply = /** @type { HTMLElement } */ (document.getElementById(rid)); let formTarget = reply.querySelector('div.msg-cont .msg-comment-target'); if (formTarget) { let formHtml = ` @@ -279,10 +284,10 @@ function showCommentForm(mid, rid) { formTarget.insertAdjacentHTML('afterend', formHtml); formTarget.remove(); - let form = reply.querySelector('form'); + let form = /** @type {HTMLFormElement} */ (reply.querySelector('form')); let submitButton = /** @type {HTMLInputElement} */ (form.querySelector('input[type="submit"]')); - let attachButton = form.querySelector('.msg-comment .attach-photo'); + let attachButton = /** @type {HTMLInputElement} */ (form.querySelector('.msg-comment .attach-photo')); attachButton.addEventListener('click', e => attachCommentPhoto(/** @type {HTMLDivElement} */(e.target))); let textarea = /** @type {HTMLTextAreaElement} */ (form.querySelector('.msg-comment textarea')); @@ -340,7 +345,7 @@ function attachInput() { /** * "Attach" button * - * @param {HTMLDivElement} div + * @param {HTMLDivElement} div element attach to */ function attachCommentPhoto(div) { let input = div.querySelector('input'); @@ -383,11 +388,11 @@ function openDialog(html, image) { ${html} </div> </div>`; - let body = document.querySelector('body'); + let body = /** @type {HTMLElement} */ (document.querySelector('body')); body.classList.add('dialog-opened'); body.insertAdjacentHTML('afterbegin', dialogHtml); if (image) { - let header = document.querySelector('#dialog_header'); + let header = /** @type {HTMLElement} */ (document.querySelector('#dialog_header')); header.classList.add('header_image'); } document.addEventListener('keydown', closeDialogListener); @@ -650,9 +655,10 @@ ready(() => { Array.from(document.querySelectorAll('.l .a-privacy')).forEach(function(e) { e.addEventListener('click', function(e) { + const article = /** @type {HTMLElement} */((e.target).closest('article')); setPrivacy( e.target, - /** @type {HTMLElement} */(e.target).closest('article').getAttribute('data-mid')); + article.getAttribute('data-mid')); e.preventDefault(); }); }); |