support multiple layers

This commit is contained in:
j 2021-11-24 11:47:47 +01:00
parent c562f87059
commit e6d882c575

View file

@ -304,9 +304,20 @@ function loadAnnotations(config) {
pandoraAPI('get', {id: config.item, keys: [ pandoraAPI('get', {id: config.item, keys: [
'layers' 'layers'
]}).then(response => { ]}).then(response => {
var annotations = response.data.layers[config.layer].filter(annotation => { var annotations = []
return !(config.user && annotation.user != config.user) if (Array.isArray(config.layer) {
}) config.layer.forEach(layer => {
response.data.layers[layer].forEach(annotation => {
if (!(config.user && annotation.user != config.user)) {
annotations.push(annotation)
}
})
})
} else {
annotations = response.data.layers[config.layer].filter(annotation => {
return !(config.user && annotation.user != config.user)
})
}
loadClips(annotations).then(annotations => { loadClips(annotations).then(annotations => {
config.annotations = annotations.filter(annotation => { config.annotations = annotations.filter(annotation => {
if (config.only_e) { if (config.only_e) {