]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/standalone/videos/test-embed.ts
Speed up client lint
[github/Chocobozzz/PeerTube.git] / client / src / standalone / videos / test-embed.ts
index 5f8e97562534589e7a75410228fe4c6a7e123455..a051f1f89d75974fbd6320b15e081738f73b4edb 100644 (file)
@@ -4,28 +4,28 @@ import { PeerTubePlayer } from '../player/player'
 
 window.addEventListener('load', async () => {
   const urlParts = window.location.href.split('/')
-  const lastPart = urlParts[ urlParts.length - 1 ]
+  const lastPart = urlParts[urlParts.length - 1]
 
   const isPlaylist = window.location.pathname.startsWith('/video-playlists/')
 
-  const elementId = lastPart.indexOf('?') === -1 ? lastPart : lastPart.split('?')[ 0 ]
+  const elementId = !lastPart.includes('?') ? lastPart : lastPart.split('?')[0]
 
   const iframe = document.createElement('iframe')
   iframe.src = isPlaylist
-    ? `/videos/embed/${elementId}?api=1`
-    : `/video-playlists/embed/${elementId}?api=1`
+    ? `/video-playlists/embed/${elementId}?api=1`
+    : `/videos/embed/${elementId}?api=1`
 
   const mainElement = document.querySelector('#host')
   mainElement.appendChild(iframe)
 
-  console.log(`Document finished loading.`)
+  console.log('Document finished loading.')
   const player = new PeerTubePlayer(document.querySelector('iframe'))
 
-  window[ 'player' ] = player
+  window['player'] = player
 
-  console.log(`Awaiting player ready...`)
+  console.log('Awaiting player ready...')
   await player.ready
-  console.log(`Player is ready.`)
+  console.log('Player is ready.')
 
   const monitoredEvents = [
     'pause',
@@ -39,7 +39,9 @@ window.addEventListener('load', async () => {
     console.log(`PLAYER: now listening for event '${e}'`)
 
     player.getCurrentPosition()
-      .then(position => document.getElementById('playlist-position').innerHTML = position + '')
+      .then(position => {
+        document.getElementById('playlist-position').innerHTML = position + ''
+      })
   })
 
   let playbackRates: number[] = []
@@ -105,7 +107,7 @@ window.addEventListener('load', async () => {
 
   updateCaptions()
 
-  const updateResolutions = ((resolutions: PeerTubeResolution[]) => {
+  const updateResolutions = (resolutions: PeerTubeResolution[]) => {
     const resolutionListEl = document.querySelector('#resolution-list')
     resolutionListEl.innerHTML = ''
 
@@ -126,7 +128,7 @@ window.addEventListener('load', async () => {
         resolutionListEl.appendChild(itemEl)
       }
     })
-  })
+  }
 
   player.getResolutions().then(
     resolutions => updateResolutions(resolutions))