From 11b8762f9c815930982599f4ff90c0db60eaf0ca Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 27 Aug 2018 15:59:00 +0200 Subject: Add start at checkbox in share modal --- client/src/assets/player/utils.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'client/src/assets/player') diff --git a/client/src/assets/player/utils.ts b/client/src/assets/player/utils.ts index c02e19929..cf4f60f55 100644 --- a/client/src/assets/player/utils.ts +++ b/client/src/assets/player/utils.ts @@ -23,9 +23,8 @@ function isMobile () { return /iPhone|iPad|iPod|Android/i.test(navigator.userAgent) } -function buildVideoLink (time?: number) { - const baseEmbedPath = window.location.pathname.replace('/embed/', '/watch/') - const baseEmbedURL = window.location.origin + baseEmbedPath +function buildVideoLink (time?: number, url?: string) { + if (!url) url = window.location.origin + window.location.pathname.replace('/embed/', '/watch/') if (time) { const timeInt = Math.floor(time) @@ -33,10 +32,10 @@ function buildVideoLink (time?: number) { const params = new URLSearchParams(window.location.search) params.set('start', secondsToTime(timeInt)) - return baseEmbedURL + '?' + params.toString() + return url + '?' + params.toString() } - return baseEmbedURL + return url } function timeToInt (time: number | string) { -- cgit v1.2.3