diff options
| -rw-r--r-- | src/invidious/views/watch.ecr | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr index 223af75f..55005ca8 100644 --- a/src/invidious/views/watch.ecr +++ b/src/invidious/views/watch.ecr @@ -248,18 +248,22 @@ function get_youtube_comments() { if (xhr.readyState == 4) if (xhr.status == 200) { comments = document.getElementById("comments"); - comments.innerHTML = ` - <div> - <h3> - <a href="javascript:void(0)" onclick="toggle_comments(this)">[ - ]</a> - View {commentCount} comments - </h3> - </div> - <div>{contentHtml}</div> - <hr>`.supplant({ - contentHtml: xhr.response.contentHtml, - commentCount: commaSeparateNumber(xhr.response.commentCount) - }); + if (xhr.response.commentCount > 0) { + comments.innerHTML = ` + <div> + <h3> + <a href="javascript:void(0)" onclick="toggle_comments(this)">[ - ]</a> + View {commentCount} comments + </h3> + </div> + <div>{contentHtml}</div> + <hr>`.supplant({ + contentHtml: xhr.response.contentHtml, + commentCount: commaSeparateNumber(xhr.response.commentCount) + }); + } else { + comments.innerHTML = ""; + } } else { <% if preferences && preferences.comments[1] == "youtube" %> get_youtube_comments(); |
