mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-25 15:29:27 -05:00
Frontend: Add timestamp on switch invidious instance links
This commit is contained in:
parent
2456b62936
commit
58f4a012b7
@ -113,20 +113,34 @@ function addCurrentTimeToURL(url) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Timer that updates the timestamp on "watch on youtube" and "embed" links
|
* Timer that updates the timestamp on all external links
|
||||||
*/
|
*/
|
||||||
player.ready(function () {
|
player.ready(function () {
|
||||||
|
// YouTube links
|
||||||
|
|
||||||
let elem_yt_watch = document.getElementById('link-yt-watch');
|
let elem_yt_watch = document.getElementById('link-yt-watch');
|
||||||
let elem_yt_embed = document.getElementById('link-yt-embed');
|
let elem_yt_embed = document.getElementById('link-yt-embed');
|
||||||
let elem_iv_embed = document.getElementById('link-iv-embed');
|
|
||||||
|
|
||||||
let base_url_yt_watch = elem_yt_watch.getAttribute('data-base-url');
|
let base_url_yt_watch = elem_yt_watch.getAttribute('data-base-url');
|
||||||
let base_url_yt_embed = elem_yt_embed.getAttribute('data-base-url');
|
let base_url_yt_embed = elem_yt_embed.getAttribute('data-base-url');
|
||||||
let base_url_iv_embed = elem_iv_embed.getAttribute('data-base-url');
|
|
||||||
|
|
||||||
setTimeout(() => { elem_yt_watch.setAttribute('href') = addCurrentTimeToURL(base_url_yt_watch); }, 5000);
|
setTimeout(() => {
|
||||||
setTimeout(() => { elem_yt_embed.setAttribute('href') = addCurrentTimeToURL(base_url_yt_embed); }, 5000);
|
elem_yt_watch.setAttribute('href') = addCurrentTimeToURL(base_url_yt_watch);
|
||||||
setTimeout(() => { elem_iv_embed.setAttribute('href') = addCurrentTimeToURL(base_url_iv_embed); }, 5000);
|
elem_yt_embed.setAttribute('href') = addCurrentTimeToURL(base_url_yt_embed);
|
||||||
|
}, 5000);
|
||||||
|
|
||||||
|
// Invidious links
|
||||||
|
|
||||||
|
let elem_iv_embed = document.getElementById('link-iv-embed');
|
||||||
|
let elem_iv_other = document.getElementById('link-iv-other');
|
||||||
|
|
||||||
|
let base_url_iv_embed = elem_iv_embed.getAttribute('data-base-url');
|
||||||
|
let base_url_iv_other = elem_iv_other.getAttribute('data-base-url');
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
elem_iv_embed.setAttribute('href') = addCurrentTimeToURL(base_url_iv_embed);
|
||||||
|
elem_iv_other.setAttribute('href') = addCurrentTimeToURL(base_url_iv_other);
|
||||||
|
}, 5000);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -127,11 +127,8 @@ we're going to need to do it here in order to allow for translations.
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
<p id="watch-on-another-invidious-instance">
|
<p id="watch-on-another-invidious-instance">
|
||||||
<% if env.get("preferences").as(Preferences).automatic_instance_redirect%>
|
<%- link_iv_other = IV::Frontend::Misc.redirect_url(env) -%>
|
||||||
<a href="/redirect?referer=<%= env.get?("current_page") %>"><%= translate(locale, "Switch Invidious Instance") %></a>
|
<a id="link-iv-other" data-base-url="<%= link_iv_other %>" href="<%= link_iv_other %>"><%= translate(locale, "Switch Invidious Instance") %></a>
|
||||||
<% else %>
|
|
||||||
<a href="https://redirect.invidious.io<%= env.request.resource %>"><%= translate(locale, "Switch Invidious Instance") %></a>
|
|
||||||
<% end %>
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p id="embed-link">
|
<p id="embed-link">
|
||||||
|
Loading…
Reference in New Issue
Block a user