1 // Thanks: https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript
3 import { AuthService } from '../../core/auth'
5 function getParameterByName (name: string, url: string) {
6 if (!url) url = window.location.href
7 name = name.replace(/[\[\]]/g, '\\$&')
9 const regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)')
10 const results = regex.exec(url)
12 if (!results) return null
13 if (!results[2]) return ''
15 return decodeURIComponent(results[2].replace(/\+/g, ' '))
18 function viewportHeight () {
19 return Math.max(document.documentElement.clientHeight, window.innerHeight || 0)
22 function populateAsyncUserVideoChannels (authService: AuthService, channel: any[]) {
23 return new Promise(res => {
24 authService.userInformationLoaded
27 const user = authService.getUser()
30 const videoChannels = user.videoChannels
31 if (Array.isArray(videoChannels) === false) return
33 videoChannels.forEach(c => channel.push({ id: c.id, label: c.name }))
44 populateAsyncUserVideoChannels