From e6d882c5752691c13035150344cc23734c1467f7 Mon Sep 17 00:00:00 2001 From: j Date: Wed, 24 Nov 2021 11:47:47 +0100 Subject: [PATCH] support multiple layers --- app/static/js/ascroll.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/app/static/js/ascroll.js b/app/static/js/ascroll.js index 859b9fe..ed4dcdb 100755 --- a/app/static/js/ascroll.js +++ b/app/static/js/ascroll.js @@ -304,9 +304,20 @@ function loadAnnotations(config) { pandoraAPI('get', {id: config.item, keys: [ 'layers' ]}).then(response => { - var annotations = response.data.layers[config.layer].filter(annotation => { - return !(config.user && annotation.user != config.user) - }) + var annotations = [] + 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 => { config.annotations = annotations.filter(annotation => { if (config.only_e) {