diff --git a/app/static/js/ascroll.js b/app/static/js/ascroll.js index bbeae73..845f12b 100755 --- a/app/static/js/ascroll.js +++ b/app/static/js/ascroll.js @@ -352,7 +352,14 @@ function loadAnnotations(config) { return } annotation.title = clip.title - 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 { + annotations.push(annotation) + } }) }) loadClips(annotations).then(annotations => { diff --git a/app/text/models.py b/app/text/models.py index c28d7ea..c633c36 100644 --- a/app/text/models.py +++ b/app/text/models.py @@ -86,7 +86,10 @@ class Text(models.Model): 'id': self.data['edit'], 'keys': [] } - clips = api.getEdit(**query)['data']['clips'] + r = api.getEdit(**query) + if 'data' not in r: + return [] + clips = r['data']['clips'] annotations = [] layer = self.data.get('layer', None) or DEFAULT_LAYER for clip in clips: @@ -94,7 +97,12 @@ class Text(models.Model): if 'user' in self.data and annotation['user'] == self.data['user']: continue annotation['title'] = clip['title'] - annotations.append(annotation) + if self.data.get('only_e'): + if annotation['value'].startswith('E:'): + annotation['value'] = annotation['value'][2:].strip() + annotations.append(annotation) + else: + annotations.append(annotation) return self.get_clips(api, annotations) def get_clips(self, api, annotations):