mirror of
https://github.com/iv-org/invidious.git
synced 2024-11-29 18:22:11 +05:30
JS: Fix missing domain in URL constructor
This commit is contained in:
parent
700c57559b
commit
47cc9dc169
@ -98,11 +98,13 @@ if (video_data.params.quality === 'dash') {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Function for add time argument to url
|
* Function for add time argument to url
|
||||||
|
*
|
||||||
* @param {String} url
|
* @param {String} url
|
||||||
|
* @param {String} [base]
|
||||||
* @returns {URL} urlWithTimeArg
|
* @returns {URL} urlWithTimeArg
|
||||||
*/
|
*/
|
||||||
function addCurrentTimeToURL(url) {
|
function addCurrentTimeToURL(url, base) {
|
||||||
var urlUsed = new URL(url);
|
var urlUsed = new URL(url, base);
|
||||||
urlUsed.searchParams.delete('start');
|
urlUsed.searchParams.delete('start');
|
||||||
var currentTime = Math.ceil(player.currentTime());
|
var currentTime = Math.ceil(player.currentTime());
|
||||||
if (currentTime > 0)
|
if (currentTime > 0)
|
||||||
@ -132,14 +134,16 @@ player.on('timeupdate', function () {
|
|||||||
|
|
||||||
// Invidious links
|
// Invidious links
|
||||||
|
|
||||||
|
let domain = window.location.origin;
|
||||||
|
|
||||||
let elem_iv_embed = document.getElementById('link-iv-embed');
|
let elem_iv_embed = document.getElementById('link-iv-embed');
|
||||||
let elem_iv_other = document.getElementById('link-iv-other');
|
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_embed = elem_iv_embed.getAttribute('data-base-url');
|
||||||
let base_url_iv_other = elem_iv_other.getAttribute('data-base-url');
|
let base_url_iv_other = elem_iv_other.getAttribute('data-base-url');
|
||||||
|
|
||||||
elem_iv_embed.href = addCurrentTimeToURL(base_url_iv_embed);
|
elem_iv_embed.href = addCurrentTimeToURL(base_url_iv_embed, domain);
|
||||||
elem_iv_other.href = addCurrentTimeToURL(base_url_iv_other);
|
elem_iv_other.href = addCurrentTimeToURL(base_url_iv_other, domain);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user