diff options
| author | ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com> | 2023-09-27 18:40:50 -0400 |
|---|---|---|
| committer | ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com> | 2023-09-28 18:09:45 -0400 |
| commit | f77e4378fe1ee69d0cf8adced1c8eef8140896ee (patch) | |
| tree | 1345761020ba32f178423dd199651ad6456d4b9d /src | |
| parent | 4f25069f55b5ee87bb214a975d97522155bffc2c (diff) | |
| download | invidious-f77e4378fe1ee69d0cf8adced1c8eef8140896ee.tar.gz invidious-f77e4378fe1ee69d0cf8adced1c8eef8140896ee.tar.bz2 invidious-f77e4378fe1ee69d0cf8adced1c8eef8140896ee.zip | |
Add support for viewing comments without js
Improve stylings
Diffstat (limited to 'src')
| -rw-r--r-- | src/invidious/routes/channels.cr | 11 | ||||
| -rw-r--r-- | src/invidious/views/post.ecr | 25 |
2 files changed, 31 insertions, 5 deletions
diff --git a/src/invidious/routes/channels.cr b/src/invidious/routes/channels.cr index 29995bf6..62b3884e 100644 --- a/src/invidious/routes/channels.cr +++ b/src/invidious/routes/channels.cr @@ -200,11 +200,15 @@ module Invidious::Routes::Channels prefs = env.get("preferences").as(Preferences) locale = prefs.locale - region = env.params.query["region"]? || prefs.region thin_mode = env.params.query["thin_mode"]? || prefs.thin_mode thin_mode = thin_mode == "true" + nojs = env.params.query["nojs"]? + + nojs ||= "0" + nojs = nojs == "1" + if !ucid.nil? ucid = ucid.to_s post_response = fetch_channel_community_post(ucid, id, locale, "json", thin_mode) @@ -218,6 +222,11 @@ module Invidious::Routes::Channels end post_response = JSON.parse(post_response) + + if nojs + comments = Comments.fetch_community_post_comments(ucid, id) + comment_html = JSON.parse(Comments.parse_youtube(id, comments, "html", locale, thin_mode, isPost: true))["contentHtml"] + end templated "post" end diff --git a/src/invidious/views/post.ecr b/src/invidious/views/post.ecr index 071d1c88..fb03a44c 100644 --- a/src/invidious/views/post.ecr +++ b/src/invidious/views/post.ecr @@ -2,10 +2,27 @@ <title>Invidious</title> <% end %> -<div id="post" class="comments"> - <%= IV::Frontend::Comments.template_youtube(post_response.not_nil!, locale, thin_mode) %> -</div> -<div id="comments" class="comments"> +<div> + <div id="post" class="comments post-comments"> + <%= IV::Frontend::Comments.template_youtube(post_response.not_nil!, locale, thin_mode) %> + </div> + + <% if nojs %> + <hr> + <% end %> + <br /> + + <div id="comments" class="comments post-comments"> + <% if nojs %> + <%= comment_html %> + <% else %> + <noscript> + <a href="/post/<%= id %>?ucid=<%= ucid %>&nojs=1"> + <%= translate(locale, "Hi! Looks like you have JavaScript turned off. Click here to view comments, keep in mind they may take a bit longer to load.") %> + </a> + </noscript> + <% end %> + </div> </div> <script id="video_data" type="application/json"> |
