summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamantaz Fox <coding@samantaz.fr>2023-09-14 20:39:46 +0200
committerSamantaz Fox <coding@samantaz.fr>2023-09-14 22:26:36 +0200
commit792a999386f9147233d26300856a5802da5fc8c1 (patch)
tree97b62a088387652a6bb6646899cedfe2b68eee09 /src
parentac0c0609bb8b652e630c3603cd9dbb1c87fbdf44 (diff)
downloadinvidious-792a999386f9147233d26300856a5802da5fc8c1.tar.gz
invidious-792a999386f9147233d26300856a5802da5fc8c1.tar.bz2
invidious-792a999386f9147233d26300856a5802da5fc8c1.zip
Frontend: Add timestamp on youtube+embed links
Diffstat (limited to 'src')
-rw-r--r--src/invidious/views/watch.ecr14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr
index 498d57a1..ac3fee65 100644
--- a/src/invidious/views/watch.ecr
+++ b/src/invidious/views/watch.ecr
@@ -112,8 +112,18 @@ we're going to need to do it here in order to allow for translations.
<div class="pure-u-1 pure-u-lg-1-5">
<div class="h-box">
<span id="watch-on-youtube">
- <a href="https://www.youtube.com/watch?v=<%= video.id %>"><%= translate(locale, "videoinfo_watch_on_youTube") %></a>
- (<a href="https://www.youtube.com/embed/<%= video.id %>"><%= translate(locale, "videoinfo_youTube_embed_link") %></a>)
+ <%-
+ link_yt_watch = URI.new(scheme: "https", host: "www.youtube.com", path: "/watch", query: "v=#{video.id}")
+ link_yt_embed = URI.new(scheme: "https", host: "www.youtube.com", path: "/embed/#{video.id}")
+
+ if !plid.nil? && !continuation.nil?
+ link_yt_param = URI::Params{"plid" => [plid], "index" => [continuation.to_s]}
+ link_yt_watch = IV::HttpServer::Utils.add_params_to_url(link_yt_watch, link_yt_param)
+ link_yt_embed = IV::HttpServer::Utils.add_params_to_url(link_yt_embed, link_yt_param)
+ end
+ -%>
+ <a id="link-yt-watch" data-base-url="<%= link_yt_watch %>" href="<%= link_yt_watch %>"><%= translate(locale, "videoinfo_watch_on_youTube") %></a>
+ (<a id="link-yt-embed" data-base-url="<%= link_yt_embed %>" href="<%= link_yt_embed %>"><%= translate(locale, "videoinfo_youTube_embed_link") %></a>)
</span>
<p id="watch-on-another-invidious-instance">
<% if env.get("preferences").as(Preferences).automatic_instance_redirect%>