aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/videojs-components/peertube-link-button.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-03-14 10:27:05 +0100
committerChocobozzz <me@florianbigard.com>2022-03-14 10:27:05 +0100
commit9af2accee68082e4e1160a4e4a7036451262be02 (patch)
tree50d74a901068c00cf16d65133bc0ddb842293b79 /client/src/assets/player/videojs-components/peertube-link-button.ts
parent637a10afb5d539b04a653abbe9b0309eb4cbf7c6 (diff)
downloadPeerTube-9af2accee68082e4e1160a4e4a7036451262be02.tar.gz
PeerTube-9af2accee68082e4e1160a4e4a7036451262be02.tar.zst
PeerTube-9af2accee68082e4e1160a4e4a7036451262be02.zip
Reorganize videojs components
Diffstat (limited to 'client/src/assets/player/videojs-components/peertube-link-button.ts')
-rw-r--r--client/src/assets/player/videojs-components/peertube-link-button.ts45
1 files changed, 0 insertions, 45 deletions
diff --git a/client/src/assets/player/videojs-components/peertube-link-button.ts b/client/src/assets/player/videojs-components/peertube-link-button.ts
deleted file mode 100644
index c49cee566..000000000
--- a/client/src/assets/player/videojs-components/peertube-link-button.ts
+++ /dev/null
@@ -1,45 +0,0 @@
1import videojs from 'video.js'
2import { buildVideoLink, decorateVideoLink } from '@shared/core-utils'
3import { PeerTubeLinkButtonOptions } from '../peertube-videojs-typings'
4
5const Button = videojs.getComponent('Button')
6class PeerTubeLinkButton extends Button {
7
8 constructor (player: videojs.Player, options?: PeerTubeLinkButtonOptions) {
9 super(player, options as any)
10 }
11
12 createEl () {
13 return this.buildElement()
14 }
15
16 updateHref () {
17 this.el().setAttribute('href', this.buildLink())
18 }
19
20 handleClick () {
21 this.player().pause()
22 }
23
24 private buildElement () {
25 const el = videojs.dom.createEl('a', {
26 href: this.buildLink(),
27 innerHTML: 'PeerTube',
28 title: this.player().localize('Video page (new window)'),
29 className: 'vjs-peertube-link',
30 target: '_blank'
31 })
32
33 el.addEventListener('mouseenter', () => this.updateHref())
34
35 return el as HTMLButtonElement
36 }
37
38 private buildLink () {
39 const url = buildVideoLink({ shortUUID: (this.options_ as PeerTubeLinkButtonOptions).shortUUID })
40
41 return decorateVideoLink({ url, startTime: this.player().currentTime() })
42 }
43}
44
45videojs.registerComponent('PeerTubeLinkButton', PeerTubeLinkButton)