From a1fbc0b436e7632dbabc1de8729732ba2b02a10e Mon Sep 17 00:00:00 2001 From: simon Date: Mon, 21 Nov 2022 10:05:28 +0700 Subject: [PATCH] fix linter --- tubearchivist/static/script.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/tubearchivist/static/script.js b/tubearchivist/static/script.js index e15bdd2..6395b09 100644 --- a/tubearchivist/static/script.js +++ b/tubearchivist/static/script.js @@ -1147,23 +1147,20 @@ function createReplyButton(replyId, totalReplies) { replyButton.innerHTML = `+ ${totalReplies} replies`; replyButton.setAttribute('data-id', replyId); replyButton.setAttribute('onclick', 'toggleCommentReplies(this)'); - return replyButton + return replyButton; } function toggleCommentReplies(button) { - - let commentReplyId = button.getAttribute("data-id"); - console.log('toggle comment reply for ' + commentReplyId); + let commentReplyId = button.getAttribute('data-id'); let state = document.getElementById(commentReplyId).style.display; - if (state == "none" || state == false) { - document.getElementById(commentReplyId).style.display = "block"; - button.querySelector("#toggle-icon").innerHTML = "-"; + if (state === 'none' || state === "") { + document.getElementById(commentReplyId).style.display = 'block'; + button.querySelector('#toggle-icon').innerHTML = '-'; } else { - document.getElementById(commentReplyId).style.display = "none"; - button.querySelector("#toggle-icon").innerHTML = "+"; + document.getElementById(commentReplyId).style.display = 'none'; + button.querySelector('#toggle-icon').innerHTML = '+'; } - } function createCommentBox(comment, isRoot) { @@ -1197,7 +1194,7 @@ function createCommentBox(comment, isRoot) { commentMeta.innerHTML = `${comment.comment_time_text}`; if (comment.comment_likecount > 0) { - let numberFormatted = formatNumbers(comment.comment_likecount) + let numberFormatted = formatNumbers(comment.comment_likecount); commentMeta.innerHTML += `${spacer} ${numberFormatted}`; }