const Component: VideoJSComponentInterface = videojsUntyped.getComponent('Component')
class SettingsButton extends Button {
+ playerComponent = videojs.Player
+ dialog: any
+ dialogEl: any
+ menu: any
+ panel: any
+ panelChild: any
+
+ addSettingsItemHandler: Function
+ disposeSettingsItemHandler: Function
+ playerClickHandler: Function
+ userInactiveHandler: Function
+
constructor (player: videojs.Player, options: any) {
super(player, options)
onDisposeSettingsItem (event: any, name: string) {
if (name === undefined) {
- let children = this.menu.children()
+ const children = this.menu.children()
while (children.length > 0) {
children[0].dispose()
this.addClass('vjs-hidden')
} else {
- let item = this.menu.getChild(name)
+ const item = this.menu.getChild(name)
if (item) {
item.dispose()
}
showDialog () {
+ this.player_.peertube().onMenuOpen()
+
this.menu.el_.style.opacity = '1'
this.dialog.show()
}
hideDialog () {
+ this.player_.peertube().onMenuClosed()
+
this.dialog.hide()
this.setDialogSize(this.getComponentSize(this.menu))
this.menu.el_.style.opacity = '1'
return
}
- let offset = this.options_.setup.maxHeightOffset
- let maxHeight = this.playerComponent.el_.offsetHeight - offset
+ const offset = this.options_.setup.maxHeightOffset
+ const maxHeight = this.playerComponent.el_.offsetHeight - offset
if (height > maxHeight) {
height = maxHeight
buildMenu () {
this.menu = new Menu(this.player())
this.menu.addClass('vjs-main-menu')
- let entries = this.options_.entries
+ const entries = this.options_.entries
if (entries.length === 0) {
this.addClass('vjs-hidden')
return
}
- for (let entry of entries) {
+ for (const entry of entries) {
this.addMenuItem(entry, this.options_)
}
}
options.name = toTitleCase(entry)
- let settingsMenuItem = new SettingsMenuItem(this.player(), options, entry, this as any)
+ const settingsMenuItem = new SettingsMenuItem(this.player(), options, entry, this as any)
this.menu.addChild(settingsMenuItem)
}
resetChildren () {
- for (let menuChild of this.menu.children()) {
+ for (const menuChild of this.menu.children()) {
menuChild.reset()
}
}
* Hide all the sub menus
*/
hideChildren () {
- for (let menuChild of this.menu.children()) {
+ for (const menuChild of this.menu.children()) {
menuChild.hideSubMenu()
}
}