1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 10:49:28 +02:00

Customize select

This commit is contained in:
Chocobozzz 2017-12-20 14:29:55 +01:00
parent a4b8a4ddcc
commit 15a7387da8
No known key found for this signature in database
GPG key ID: 583A612D890159BE
13 changed files with 190 additions and 82 deletions

View file

@ -1,5 +1,7 @@
// Thanks: https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript
import { AuthService } from '../../core/auth'
function getParameterByName (name: string, url: string) {
if (!url) url = window.location.href
name = name.replace(/[\[\]]/g, '\\$&')
@ -17,7 +19,27 @@ function viewportHeight () {
return Math.max(document.documentElement.clientHeight, window.innerHeight || 0)
}
function populateAsyncUserVideoChannels (authService: AuthService, channel: any[]) {
return new Promise(res => {
authService.userInformationLoaded
.subscribe(
() => {
const user = authService.getUser()
if (!user) return
const videoChannels = user.videoChannels
if (Array.isArray(videoChannels) === false) return
videoChannels.forEach(c => channel.push({ id: c.id, label: c.name }))
return res()
}
)
})
}
export {
viewportHeight,
getParameterByName
getParameterByName,
populateAsyncUserVideoChannels
}