From f1785170f0dca796ca213a42aea69f8780411fda Mon Sep 17 00:00:00 2001 From: syeopite Date: Sun, 17 Sep 2023 12:41:37 -0700 Subject: [PATCH] Request Reddit comm when yt disabled during nojs=1 --- locales/en-US.json | 1 + src/invidious/routes/watch.cr | 3 ++- src/invidious/views/watch.ecr | 27 +++++++++++++++++---------- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/locales/en-US.json b/locales/en-US.json index aa64c452..8183fcb3 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -222,6 +222,7 @@ "comments_youtube_disabled_text": "Youtube comments are disabled on this video", "comments_youtube_disabled_try_reddit": "Try reddit comments?", "comments_invidious_disabled_text": "Comments are hidden as per user preferences", + "comments_youtube_disabled_try_reddit_no_js": "Hi! Looks like you have JavaScript turned off. Although the uploader has disabled YouTube comments you can still click here to try and view Reddit comments, keep in mind they may take a bit longer to load.", "Incorrect password": "Incorrect password", "Wrong answer": "Wrong answer", "Erroneous CAPTCHA": "Erroneous CAPTCHA", diff --git a/src/invidious/routes/watch.cr b/src/invidious/routes/watch.cr index aabe8dfc..e60a2d18 100644 --- a/src/invidious/routes/watch.cr +++ b/src/invidious/routes/watch.cr @@ -80,7 +80,8 @@ module Invidious::Routes::Watch if nojs if preferences - source = preferences.comments[0] + source = video.comments? ? preferences.comments[0] : "reddit" + if source.empty? source = preferences.comments[1] end diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr index 78b2af02..8f788301 100644 --- a/src/invidious/views/watch.ecr +++ b/src/invidious/views/watch.ecr @@ -314,17 +314,24 @@ we're going to need to do it here in order to allow for translations. <% end %> <% else %> -
-

<%=HTML.escape(translate(locale, "comments_youtube_disabled_text"))%>

+ <% if !nojs %> +
+

<%=HTML.escape(translate(locale, "comments_youtube_disabled_text"))%>

+

+
+ <% end %> -

- - - -

-
+ <% end %> <% end %>