1 import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
2 import { buildVideoLink } from './utils'
4 const Button: VideoJSComponentInterface = videojsUntyped.getComponent('Button')
5 class PeerTubeLinkButton extends Button {
7 constructor (player: any, options: any) {
12 return this.buildElement()
16 this.el().setAttribute('href', buildVideoLink(this.player().currentTime()))
23 private buildElement () {
24 const el = videojsUntyped.dom.createEl('a', {
25 href: buildVideoLink(),
26 innerHTML: 'PeerTube',
27 title: this.player_.localize('Go to the video page'),
28 className: 'vjs-peertube-link',
32 el.addEventListener('mouseenter', () => this.updateHref())
37 Button.registerComponent('PeerTubeLinkButton', PeerTubeLinkButton)