From 960a11e89da4e4a6ad6fbad61c71625f89e267b6 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 30 May 2018 17:10:00 +0200 Subject: Add context menu to player --- client/src/assets/player/utils.ts | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'client/src/assets/player/utils.ts') diff --git a/client/src/assets/player/utils.ts b/client/src/assets/player/utils.ts index 1df39d4e4..487b3a1be 100644 --- a/client/src/assets/player/utils.ts +++ b/client/src/assets/player/utils.ts @@ -64,14 +64,48 @@ function isMobile () { return /iPhone|iPad|iPod|Android/i.test(navigator.userAgent) } +function buildVideoLink (time?: number) { + let href = window.location.href.replace('/embed/', '/watch/') + if (time) { + const timeInt = Math.floor(time) + + if (window.location.search) href += '&start=' + timeInt + else href += '?start=' + timeInt + } + + return href +} + +function buildVideoEmbed (embedUrl: string) { + return '' +} + +function copyToClipboard (text: string) { + const el = document.createElement('textarea') + el.value = text + el.setAttribute('readonly', '') + el.style.position = 'absolute' + el.style.left = '-9999px' + document.body.appendChild(el) + el.select() + document.execCommand('copy') + document.body.removeChild(el) +} + export { toTitleCase, + buildVideoLink, getStoredVolume, saveVolumeInStore, saveAverageBandwidth, getAverageBandwidth, saveMuteInStore, + buildVideoEmbed, getStoredMute, + copyToClipboard, isMobile, bytes } -- cgit v1.2.3