From b9d956d0723e37655c69a8e7ec0646b0f9055a87 Mon Sep 17 00:00:00 2001 From: j Date: Thu, 21 Oct 2021 16:39:49 +0100 Subject: [PATCH] fix annotation filter --- app/static/js/ascroll.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/static/js/ascroll.js b/app/static/js/ascroll.js index 87bc4f2..7dc4aa5 100644 --- a/app/static/js/ascroll.js +++ b/app/static/js/ascroll.js @@ -205,8 +205,9 @@ async function loadClips(annotations) { } previous = annotation }) - annotations[annotations.length - 1].color2 = annotations[0].color1 - console.log(annotations) + if (annotations.length) { + annotations[annotations.length - 1].color2 = annotations[0].color1 + } return annotations }) } @@ -236,11 +237,8 @@ function loadItem(config) { var first var info = formatInfo(config, ascroll) var annotations = response.data.layers[config.layer].filter(annotation => { - if (config.user && annotation.user != config.user) { - return true - } + return !(config.user && annotation.user != config.user) }) - loadClips(annotations).then(annotations => { annotations.forEach(annotation => { var div = document.createElement('div')