]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/assets/player/videojs-components/settings-menu-button.ts
Fix For GitPod
[github/Chocobozzz/PeerTube.git] / client / src / assets / player / videojs-components / settings-menu-button.ts
index 14cb8ba43367c52c3dc0b4236c10a95d9bc2c7fe..b700f4be6a23a5e20a185784274cec32aedb4042 100644 (file)
@@ -14,6 +14,18 @@ const Menu: VideoJSComponentInterface = videojsUntyped.getComponent('Menu')
 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)
 
@@ -53,7 +65,7 @@ class SettingsButton extends Button {
 
   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()
@@ -62,7 +74,7 @@ class SettingsButton extends Button {
 
       this.addClass('vjs-hidden')
     } else {
-      let item = this.menu.getChild(name)
+      const item = this.menu.getChild(name)
 
       if (item) {
         item.dispose()
@@ -110,6 +122,8 @@ class SettingsButton extends Button {
   }
 
   showDialog () {
+    this.player_.peertube().onMenuOpen()
+
     this.menu.el_.style.opacity = '1'
     this.dialog.show()
 
@@ -117,6 +131,8 @@ class SettingsButton extends Button {
   }
 
   hideDialog () {
+    this.player_.peertube().onMenuClosed()
+
     this.dialog.hide()
     this.setDialogSize(this.getComponentSize(this.menu))
     this.menu.el_.style.opacity = '1'
@@ -148,8 +164,8 @@ class SettingsButton extends Button {
       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
@@ -166,7 +182,7 @@ class SettingsButton extends Button {
   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')
@@ -174,7 +190,7 @@ class SettingsButton extends Button {
       return
     }
 
-    for (let entry of entries) {
+    for (const entry of entries) {
       this.addMenuItem(entry, this.options_)
     }
 
@@ -191,7 +207,7 @@ class SettingsButton extends Button {
     }
 
     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)
 
@@ -204,7 +220,7 @@ class SettingsButton extends Button {
   }
 
   resetChildren () {
-    for (let menuChild of this.menu.children()) {
+    for (const menuChild of this.menu.children()) {
       menuChild.reset()
     }
   }
@@ -213,7 +229,7 @@ class SettingsButton extends Button {
    * Hide all the sub menus
    */
   hideChildren () {
-    for (let menuChild of this.menu.children()) {
+    for (const menuChild of this.menu.children()) {
       menuChild.hideSubMenu()
     }
   }