player.ready(() => {
// Voodoo magic for IOS
setTimeout(() => {
+ // Player was destroyed
+ if (!this.player_) return
+
this.build()
// Update on rate change
* @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]) {
this.subMenu.on('updateLabel', () => {
this.update()
})
+ this.subMenu.on('menuChanged', () => {
+ this.bindClickEvents()
+ this.setSize()
+ this.update()
+ })
this.settingsSubMenuTitleEl_.innerHTML = this.player_.localize(this.subMenu.controlText_)
this.settingsSubMenuEl_.appendChild(this.subMenu.menu.el_)
this.update()
this.createBackButton()
- this.getSize()
+ this.setSize()
this.bindClickEvents()
// prefixed event listeners for CSS TransitionEnd
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
}
// save size of submenus on first init
// if number of submenu items change dynamically more logic will be needed
- getSize () {
+ setSize () {
this.dialog.removeClass('vjs-hidden')
+ videojsUntyped.dom.removeClass(this.settingsSubMenuEl_, 'vjs-hidden')
this.size = this.settingsButton.getComponentSize(this.settingsSubMenuEl_)
this.setMargin()
this.dialog.addClass('vjs-hidden')
}
setMargin () {
- let [width] = this.size
+ const [ width ] = this.size
this.settingsSubMenuEl_.style.marginRight = `-${width}px`
}