From 98bb20abcd356cf80363e2488314587cab3503f6 Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Sat, 6 Oct 2018 18:54:05 -0500 Subject: [PATCH] Add option to switch between YouTube and Reddit comments --- src/invidious/views/watch.ecr | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr index 4fdbbb56..4f842c4c 100644 --- a/src/invidious/views/watch.ecr +++ b/src/invidious/views/watch.ecr @@ -217,6 +217,13 @@ function get_reddit_comments() { [ - ] \ {title} \ \ +

\ + \ + \ + View YouTube comments \ + \ + \ +

\ \ View more comments on Reddit \ \ @@ -263,6 +270,11 @@ function get_youtube_comments() { [ - ] \ View {commentCount} comments \ \ + \ + \ + View Reddit comments \ + \ + \ \
{contentHtml}
\
'.supplant({ @@ -292,6 +304,19 @@ function get_youtube_comments() { }; } +function swap_comments(source) { + comments = document.getElementById("comments"); + var fallback = comments.innerHTML; + comments.innerHTML = + '

'; + + if (source == "youtube") { + get_youtube_comments(); + } else if (source == "reddit") { + get_reddit_comments(); + } +} + function commaSeparateNumber(val){ while (/(\d+)(\d{3})/.test(val.toString())){ val = val.toString().replace(/(\d+)(\d{3})/, '$1'+','+'$2');