summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOmar Roth <omarroth@hotmail.com>2018-10-06 18:54:05 -0500
committerOmar Roth <omarroth@hotmail.com>2018-10-06 18:54:05 -0500
commit98bb20abcd356cf80363e2488314587cab3503f6 (patch)
treeff7faa1966ac1ebca2e04d3cdc1c85cd09378791 /src
parenta4d44d3286bc2d939c575061bb7db9328dce57dd (diff)
downloadinvidious-98bb20abcd356cf80363e2488314587cab3503f6.tar.gz
invidious-98bb20abcd356cf80363e2488314587cab3503f6.tar.bz2
invidious-98bb20abcd356cf80363e2488314587cab3503f6.zip
Add option to switch between YouTube and Reddit comments
Diffstat (limited to 'src')
-rw-r--r--src/invidious/views/watch.ecr25
1 files changed, 25 insertions, 0 deletions
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() {
<a href="javascript:void(0)" onclick="toggle_comments(this)">[ - ]</a> \
{title} \
</h3> \
+ <p> \
+ <b> \
+ <a href="javascript:void(0)" onclick="swap_comments(\'youtube\')"> \
+ View YouTube comments \
+ </a> \
+ </b> \
+ </p> \
<b> \
<a rel="noopener" target="_blank" href="https://reddit.com{permalink}">View more comments on Reddit</a> \
</b> \
@@ -263,6 +270,11 @@ function get_youtube_comments() {
<a href="javascript:void(0)" onclick="toggle_comments(this)">[ - ]</a> \
View {commentCount} comments \
</h3> \
+ <b> \
+ <a href="javascript:void(0)" onclick="swap_comments(\'reddit\')"> \
+ View Reddit comments \
+ </a> \
+ </b> \
</div> \
<div>{contentHtml}</div> \
<hr>'.supplant({
@@ -292,6 +304,19 @@ function get_youtube_comments() {
};
}
+function swap_comments(source) {
+ comments = document.getElementById("comments");
+ var fallback = comments.innerHTML;
+ comments.innerHTML =
+ '<h3><center class="loading"><i class="icon ion-ios-refresh"></i></center></h3>';
+
+ 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');