mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-24 14:59:22 -05:00
Frontend: Add timestamp on youtube+embed links
This commit is contained in:
parent
ac0c0609bb
commit
792a999386
@ -112,6 +112,21 @@ function addCurrentTimeToURL(url) {
|
||||
return urlUsed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Timer that updates the timestamp on "watch on youtube" and "embed" links
|
||||
*/
|
||||
player.ready(function () {
|
||||
let elem_watch = document.getElementById('link-yt-watch');
|
||||
let elem_embed = document.getElementById('link-yt-embed');
|
||||
|
||||
let base_url_watch = elem_watch.getAttribute('data-base-url');
|
||||
let base_url_embed = elem_embed.getAttribute('data-base-url');
|
||||
|
||||
setTimeout(() => { elem_watch.setAttribute('href') = addCurrentTimeToURL(base_url_watch); }, 5000);
|
||||
setTimeout(() => { elem_embed.setAttribute('href') = addCurrentTimeToURL(base_url_embed); }, 5000);
|
||||
});
|
||||
|
||||
|
||||
var shareOptions = {
|
||||
socials: ['fbFeed', 'tw', 'reddit', 'email'],
|
||||
|
||||
|
@ -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%>
|
||||
|
Loading…
Reference in New Issue
Block a user