summaryrefslogtreecommitdiffstats
path: root/assets
diff options
context:
space:
mode:
authorOmar Roth <omarroth@protonmail.com>2019-05-29 14:24:30 -0500
committerOmar Roth <omarroth@protonmail.com>2019-05-29 14:24:30 -0500
commitefd54b752337f980484e12b03286cccc164deaa4 (patch)
treedc74902165df65215e7d9e950f3c742c95e63218 /assets
parent2aca57cb82010a417622c41341947e9b2b708f99 (diff)
downloadinvidious-efd54b752337f980484e12b03286cccc164deaa4.tar.gz
invidious-efd54b752337f980484e12b03286cccc164deaa4.tar.bz2
invidious-efd54b752337f980484e12b03286cccc164deaa4.zip
Add 'comments' as URL parameter
Diffstat (limited to 'assets')
-rw-r--r--assets/js/watch.js60
1 files changed, 28 insertions, 32 deletions
diff --git a/assets/js/watch.js b/assets/js/watch.js
index 9b843920..c9cac43b 100644
--- a/assets/js/watch.js
+++ b/assets/js/watch.js
@@ -237,7 +237,7 @@ function get_reddit_comments(timeouts = 0) {
comments.children[0].children[0].children[0].onclick = toggle_comments;
comments.children[0].children[1].children[0].onclick = swap_comments;
} else {
- if (video_data.preferences.comments[1] === 'youtube') {
+ if (video_data.params.comments[1] === 'youtube') {
get_youtube_comments(timeouts + 1);
} else {
comments.innerHTML = fallback;
@@ -278,35 +278,31 @@ function get_youtube_comments(timeouts = 0) {
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
if (xhr.status == 200) {
- if (xhr.response.commentCount > 0) {
- comments.innerHTML = ' \
- <div> \
- <h3> \
- <a href="javascript:void(0)">[ - ]</a> \
- {commentsText} \
- </h3> \
- <b> \
- <a href="javascript:void(0)" data-comments="reddit"> \
- {redditComments} \
- </a> \
- </b> \
- </div> \
- <div>{contentHtml}</div> \
- <hr>'.supplant({
- contentHtml: xhr.response.contentHtml,
- redditComments: video_data.reddit_comments_text,
- commentsText: video_data.comments_text.supplant(
- { commentCount: number_with_separator(xhr.response.commentCount) }
- )
- });
+ comments.innerHTML = ' \
+ <div> \
+ <h3> \
+ <a href="javascript:void(0)">[ - ]</a> \
+ {commentsText} \
+ </h3> \
+ <b> \
+ <a href="javascript:void(0)" data-comments="reddit"> \
+ {redditComments} \
+ </a> \
+ </b> \
+ </div> \
+ <div>{contentHtml}</div> \
+ <hr>'.supplant({
+ contentHtml: xhr.response.contentHtml,
+ redditComments: video_data.reddit_comments_text,
+ commentsText: video_data.comments_text.supplant(
+ { commentCount: number_with_separator(xhr.response.commentCount) }
+ )
+ });
- comments.children[0].children[0].children[0].onclick = toggle_comments;
- comments.children[0].children[1].children[0].onclick = swap_comments;
- } else {
- comments.innerHTML = '';
- }
+ comments.children[0].children[0].children[0].onclick = toggle_comments;
+ comments.children[0].children[1].children[0].onclick = swap_comments;
} else {
- if (video_data.preferences[1] === 'youtube') {
+ if (video_data.params.comments[1] === 'youtube') {
get_youtube_comments(timeouts + 1);
} else {
comments.innerHTML = '';
@@ -409,13 +405,13 @@ if (video_data.plid) {
get_playlist(video_data.plid);
}
-if (video_data.preferences.comments[0] === 'youtube') {
+if (video_data.params.comments[0] === 'youtube') {
get_youtube_comments();
-} else if (video_data.preferences.comments[0] === 'reddit') {
+} else if (video_data.params.comments[0] === 'reddit') {
get_reddit_comments();
-} else if (video_data.preferences.comments[1] === 'youtube') {
+} else if (video_data.params.comments[1] === 'youtube') {
get_youtube_comments();
-} else if (video_data.preferences.comments[1] === 'reddit') {
+} else if (video_data.params.comments[1] === 'reddit') {
get_reddit_comments();
} else {
comments = document.getElementById('comments');