const component: VideoJSComponentInterface = videojsUntyped.getComponent('Component')
class SettingsMenuItem extends MenuItem {
+ settingsButton: any
+ dialog: any
+ mainMenu: any
+ panel: any
+ panelChild: any
+ panelChildEl: any
+ size: any
+ menuToLoad: string
+ subMenu: any
+
+ submenuClickHandler: Function
+ transitionEndHandler: Function
+
+ settingsSubMenuTitleEl_: any
+ settingsSubMenuValueEl_: any
+ settingsSubMenuEl_: any
constructor (player: videojs.Player, options: any, entry: string, menuButton: VideoJSComponentInterface) {
super(player, options)
player.ready(() => {
// Voodoo magic for IOS
setTimeout(() => {
+ // Player was destroyed
+ if (!this.player_) return
+
this.build()
// Update on rate change
this.settingsSubMenuEl_.appendChild(this.subMenu.menu.el_)
this.update()
this.bindClickEvents()
-
}, 0)
})
}
// To update the sub menu value on click, setTimeout is needed because
// updating the value is not instant
setTimeout(() => this.update(event), 0)
+
+ // Seems like videojs adds a vjs-hidden class on the caption menu after a click
+ // We don't need it
+ this.subMenu.menu.removeClass('vjs-hidden')
}
/**
* @method PrefixedEvent
*/
PrefixedEvent (element: any, type: any, callback: any, action = 'addEvent') {
- let prefix = ['webkit', 'moz', 'MS', 'o', '']
+ const prefix = ['webkit', 'moz', 'MS', 'o', '']
for (let p = 0; p < prefix.length; p++) {
if (!prefix[p]) {
update (event?: any) {
let target: HTMLElement = null
- let subMenu = this.subMenu.name()
+ const subMenu = this.subMenu.name()
if (event && event.type === 'tap') {
target = event.target
setTimeout(() => this.settingsSubMenuValueEl_.innerHTML = this.subMenu.labelEl_.innerHTML, 250)
} else {
// Loop trough the submenu items to find the selected child
- for (let subMenuItem of this.subMenu.menu.children_) {
+ for (const subMenuItem of this.subMenu.menu.children_) {
if (!(subMenuItem instanceof component)) {
continue
}
}
bindClickEvents () {
- for (let item of this.subMenu.menu.children()) {
+ for (const item of this.subMenu.menu.children()) {
if (!(item instanceof component)) {
continue
}
}
setMargin () {
- let [width] = this.size
+ const [ width ] = this.size
this.settingsSubMenuEl_.style.marginRight = `-${width}px`
}