diff options
author | Chocobozzz <me@florianbigard.com> | 2021-08-17 14:42:53 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-08-18 08:35:06 +0200 |
commit | 9df52d660feb722404be00a50f3c8a612bec1c15 (patch) | |
tree | dde52880fa012874d24c60f64eb596b0a789cc8b /client/src/assets/player/videojs-components/settings-menu-item.ts | |
parent | adb8809d43648ea0a64d6845bb39aa3bd0e005a6 (diff) | |
download | PeerTube-9df52d660feb722404be00a50f3c8a612bec1c15.tar.gz PeerTube-9df52d660feb722404be00a50f3c8a612bec1c15.tar.zst PeerTube-9df52d660feb722404be00a50f3c8a612bec1c15.zip |
Migrate client to eslint
Diffstat (limited to 'client/src/assets/player/videojs-components/settings-menu-item.ts')
-rw-r--r-- | client/src/assets/player/videojs-components/settings-menu-item.ts | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/client/src/assets/player/videojs-components/settings-menu-item.ts b/client/src/assets/player/videojs-components/settings-menu-item.ts index f1342f179..1871d41f8 100644 --- a/client/src/assets/player/videojs-components/settings-menu-item.ts +++ b/client/src/assets/player/videojs-components/settings-menu-item.ts | |||
@@ -1,8 +1,8 @@ | |||
1 | import videojs from 'video.js' | ||
1 | // Thanks to Yanko Shterev: https://github.com/yshterev/videojs-settings-menu | 2 | // Thanks to Yanko Shterev: https://github.com/yshterev/videojs-settings-menu |
2 | import { toTitleCase } from '../utils' | 3 | import { toTitleCase } from '../utils' |
3 | import videojs from 'video.js' | ||
4 | import { SettingsButton } from './settings-menu-button' | ||
5 | import { SettingsDialog } from './settings-dialog' | 4 | import { SettingsDialog } from './settings-dialog' |
5 | import { SettingsButton } from './settings-menu-button' | ||
6 | import { SettingsPanel } from './settings-panel' | 6 | import { SettingsPanel } from './settings-panel' |
7 | import { SettingsPanelChild } from './settings-panel-child' | 7 | import { SettingsPanelChild } from './settings-panel-child' |
8 | 8 | ||
@@ -57,7 +57,7 @@ class SettingsMenuItem extends MenuItem { | |||
57 | const newOptions = Object.assign({}, options, { entry: options.menuButton, menuButton: this }) | 57 | const newOptions = Object.assign({}, options, { entry: options.menuButton, menuButton: this }) |
58 | 58 | ||
59 | this.subMenu = new SubMenuComponent(this.player(), newOptions) as any // FIXME: typings | 59 | this.subMenu = new SubMenuComponent(this.player(), newOptions) as any // FIXME: typings |
60 | const subMenuClass = this.subMenu.buildCSSClass().split(' ')[ 0 ] | 60 | const subMenuClass = this.subMenu.buildCSSClass().split(' ')[0] |
61 | this.settingsSubMenuEl_.className += ' ' + subMenuClass | 61 | this.settingsSubMenuEl_.className += ' ' + subMenuClass |
62 | 62 | ||
63 | this.eventHandlers() | 63 | this.eventHandlers() |
@@ -104,7 +104,7 @@ class SettingsMenuItem extends MenuItem { | |||
104 | target = event.currentTarget | 104 | target = event.currentTarget |
105 | } | 105 | } |
106 | 106 | ||
107 | if (target && target.classList.contains('vjs-back-button')) { | 107 | if (target?.classList.contains('vjs-back-button')) { |
108 | this.loadMainMenu() | 108 | this.loadMainMenu() |
109 | return | 109 | return |
110 | } | 110 | } |
@@ -121,8 +121,6 @@ class SettingsMenuItem extends MenuItem { | |||
121 | /** | 121 | /** |
122 | * Create the component's DOM element | 122 | * Create the component's DOM element |
123 | * | 123 | * |
124 | * @return {Element} | ||
125 | * @method createEl | ||
126 | */ | 124 | */ |
127 | createEl () { | 125 | createEl () { |
128 | const el = videojs.dom.createEl('li', { | 126 | const el = videojs.dom.createEl('li', { |
@@ -198,14 +196,14 @@ class SettingsMenuItem extends MenuItem { | |||
198 | const prefix = [ 'webkit', 'moz', 'MS', 'o', '' ] | 196 | const prefix = [ 'webkit', 'moz', 'MS', 'o', '' ] |
199 | 197 | ||
200 | for (let p = 0; p < prefix.length; p++) { | 198 | for (let p = 0; p < prefix.length; p++) { |
201 | if (!prefix[ p ]) { | 199 | if (!prefix[p]) { |
202 | type = type.toLowerCase() | 200 | type = type.toLowerCase() |
203 | } | 201 | } |
204 | 202 | ||
205 | if (action === 'addEvent') { | 203 | if (action === 'addEvent') { |
206 | element.addEventListener(prefix[ p ] + type, callback, false) | 204 | element.addEventListener(prefix[p] + type, callback, false) |
207 | } else if (action === 'removeEvent') { | 205 | } else if (action === 'removeEvent') { |
208 | element.removeEventListener(prefix[ p ] + type, callback, false) | 206 | element.removeEventListener(prefix[p] + type, callback, false) |
209 | } | 207 | } |
210 | } | 208 | } |
211 | } | 209 | } |
@@ -292,7 +290,10 @@ class SettingsMenuItem extends MenuItem { | |||
292 | // Thus we get the submenu value based on the labelEl of playbackRateMenuButton | 290 | // Thus we get the submenu value based on the labelEl of playbackRateMenuButton |
293 | if (subMenu === 'PlaybackRateMenuButton') { | 291 | if (subMenu === 'PlaybackRateMenuButton') { |
294 | const html = (this.subMenu as any).labelEl_.innerHTML | 292 | const html = (this.subMenu as any).labelEl_.innerHTML |
295 | setTimeout(() => this.settingsSubMenuValueEl_.innerHTML = html, 250) | 293 | |
294 | setTimeout(() => { | ||
295 | this.settingsSubMenuValueEl_.innerHTML = html | ||
296 | }, 250) | ||
296 | } else { | 297 | } else { |
297 | // Loop trough the submenu items to find the selected child | 298 | // Loop trough the submenu items to find the selected child |
298 | for (const subMenuItem of this.subMenu.menu.children_) { | 299 | for (const subMenuItem of this.subMenu.menu.children_) { |