mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 10:49:28 +02:00
Customize select
This commit is contained in:
parent
a4b8a4ddcc
commit
15a7387da8
13 changed files with 190 additions and 82 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue