aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/shared/settings/settings-dialog.ts
blob: ba39d0f45760ada5cb42c5169878179da106b358 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import videojs from 'video.js'

const Component = videojs.getComponent('Component')

class SettingsDialog extends Component {
  constructor (player: videojs.Player) {
    super(player)

    this.hide()
  }

  /**
   * Create the component's DOM element
   *
   */
  createEl () {
    const uniqueId = this.id()
    const dialogLabelId = 'TTsettingsDialogLabel-' + uniqueId
    const dialogDescriptionId = 'TTsettingsDialogDescription-' + uniqueId

    return super.createEl('div', {
      className: 'vjs-settings-dialog vjs-modal-overlay',
      innerHTML: '',
      tabIndex: -1
    }, {
      'role': 'dialog',
      'aria-labelledby': dialogLabelId,
      'aria-describedby': dialogDescriptionId
    })
  }

  show () {
    this.player().addClass('vjs-settings-dialog-opened')

    super.show()
  }

  hide () {
    this.player().removeClass('vjs-settings-dialog-opened')

    super.hide()
  }
}

Component.registerComponent('SettingsDialog', SettingsDialog)

export { SettingsDialog }