multiple layers for edits too
This commit is contained in:
parent
83228a5ead
commit
db6a2f25bd
1 changed files with 29 additions and 29 deletions
|
@ -300,24 +300,22 @@ async function loadClips(annotations) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadAnnotations(config) {
|
function loadAnnotations(config) {
|
||||||
|
var layers = config.layer
|
||||||
|
if (!Array.isArray(layers)) {
|
||||||
|
layers = [layers]
|
||||||
|
}
|
||||||
if (config.item) {
|
if (config.item) {
|
||||||
pandoraAPI('get', {id: config.item, keys: [
|
pandoraAPI('get', {id: config.item, keys: [
|
||||||
'layers'
|
'layers'
|
||||||
]}).then(response => {
|
]}).then(response => {
|
||||||
var annotations = []
|
var annotations = []
|
||||||
if (Array.isArray(config.layer)) {
|
layers.forEach(layer => {
|
||||||
config.layer.forEach(layer => {
|
response.data.layers[layer].forEach(annotation => {
|
||||||
response.data.layers[layer].forEach(annotation => {
|
if (!(config.user && annotation.user != config.user)) {
|
||||||
if (!(config.user && annotation.user != config.user)) {
|
annotations.push(annotation)
|
||||||
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) {
|
||||||
|
@ -344,24 +342,26 @@ function loadAnnotations(config) {
|
||||||
director: clip.director,
|
director: clip.director,
|
||||||
id: clip.item
|
id: clip.item
|
||||||
}
|
}
|
||||||
clip.layers[config.layer].forEach(annotation => {
|
layers.forEach(layer => {
|
||||||
if (config.user && annotation.user != config.user) {
|
clip.layers[layer].forEach(annotation => {
|
||||||
return
|
if (config.user && annotation.user != config.user) {
|
||||||
}
|
return
|
||||||
;['title', 'director', 'date'].forEach(key => {
|
}
|
||||||
annotation[key] = clip[key]
|
;['title', 'director', 'date'].forEach(key => {
|
||||||
|
annotation[key] = clip[key]
|
||||||
|
})
|
||||||
|
if (config.only_e) {
|
||||||
|
if (annotation.value.slice(0, 2) == 'E:') {
|
||||||
|
annotation.value = annotation.value.slice(2).trim()
|
||||||
|
annotations.push(annotation)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (annotation.value.slice(0, 2) != 'E:') {
|
||||||
|
annotations.push(annotation)
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
if (config.only_e) {
|
}
|
||||||
if (annotation.value.slice(0, 2) == 'E:') {
|
|
||||||
annotation.value = annotation.value.slice(2).trim()
|
|
||||||
annotations.push(annotation)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (annotation.value.slice(0, 2) != 'E:') {
|
|
||||||
annotations.push(annotation)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
loadClips(annotations).then(annotations => {
|
loadClips(annotations).then(annotations => {
|
||||||
config.annotations = annotations
|
config.annotations = annotations
|
||||||
|
|
Loading…
Reference in a new issue