diff --git a/src/invidious/views/components/description_toggle_transcripts_widget.ecr b/src/invidious/views/components/description_toggle_transcripts_widget.ecr new file mode 100644 index 00000000..0a80178a --- /dev/null +++ b/src/invidious/views/components/description_toggle_transcripts_widget.ecr @@ -0,0 +1,13 @@ +<% if captions %> +
+

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

+ <% if transcript %> + <% hide_transcripts_param = env.params.query.dup %> + <% hide_transcripts_param.delete_all("show_transcripts") %> + + <%=HTML.escape(translate(locale, "video_description_show_transcript_section_button_hide"))%> + <% else %> + <%=HTML.escape(translate(locale, "video_description_show_transcript_section_button"))%> + <% end %> +
+<% end %> diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr index 3e90c4f5..cd4526aa 100644 --- a/src/invidious/views/watch.ecr +++ b/src/invidious/views/watch.ecr @@ -253,23 +253,13 @@ we're going to need to do it here in order to allow for translations.
<% if video.description.size < 200 || params.extend_desc %> -
<%= video.description_html %>
+
<%= video.description_html %> + <%= rendered "components/description_toggle_transcripts_widget" %> +
<% else %>
<%-= video.description_html %> - <% if captions %> -
-

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

- <% if transcript %> - <% hide_transcripts_param = env.params.query.dup %> - <% hide_transcripts_param.delete_all("show_transcripts") %> - - <%=HTML.escape(translate(locale, "video_description_show_transcript_section_button_hide"))%> - <% else %> - <%=HTML.escape(translate(locale, "video_description_show_transcript_section_button"))%> - <% end %> -
- <% end %> + <%= rendered "components/description_toggle_transcripts_widget" %>