diff --git a/app/static/css/partials/_ascroll.scss b/app/static/css/partials/_ascroll.scss
index dbeed51..5223961 100755
--- a/app/static/css/partials/_ascroll.scss
+++ b/app/static/css/partials/_ascroll.scss
@@ -33,7 +33,7 @@
width: 100%;
height: auto;
max-width: var(--container-width);
- max-height: 80vh;
+ max-height: 88vh;
margin: auto;
//transition: opacity 0.4s;
@@ -49,7 +49,7 @@
img {
width: 100%;
height: auto;
- max-height: 80vh;
+ max-height: 88vh;
margin: auto;
object-fit: contain;
}
diff --git a/app/static/js/ascroll.js b/app/static/js/ascroll.js
index cf610ac..475c805 100755
--- a/app/static/js/ascroll.js
+++ b/app/static/js/ascroll.js
@@ -225,7 +225,15 @@ function renderAnnotation(config, video, ascroll, annotation) {
div.style.background = `linear-gradient(to bottom, ${color1}, ${color2})`;
var figcaption = ''
if (annotation.title) {
- figcaption = `${annotation.title}`
+ if (config.language == 'zh') {
+ var title = annotation.title.split('/')[1] || annotation.title
+ var director = annotation.director[1]
+ } else {
+ var title = annotation.title.split('/')[0]
+ var director = annotation.director[0]
+ }
+ var txt = `${title} (${director})`
+ figcaption = `${txt}`
}
annotation.value = annotation.value.replace(/src="\//g, `src="${baseURL}/`).replace(/href="\//g, `href="${baseURL}/`)
div.innerHTML = `
@@ -287,16 +295,43 @@ function renderAnnotations(config) {
updatePlayer(video, frame, config.first['in'], config.first['out'], src)
}
}
- if (config.item_url) {
- var box= document.createElement('div')
+ if (config.item_url || config.cited) {
+ var box = document.createElement('div')
var color = config.annotations[config.annotations.length - 1].color2
box.style.background = `hsl(${color.hue}, 70%, 75%)`
var div = document.createElement('div')
div.classList.add('related-film')
- div.innerHTML = `
- Film cited: ${config.item_title} - ${config.item_director[0]}
- 引用影片: ${config.item_title_zh} - ${config.item_director[1]}
- `
+ if (config.item_url) {
+ if (config.language == 'zh') {
+ div.innerHTML = `
+ 引用影片: ${config.item_title_zh} - ${config.item_director[1]}
+ `
+ } else {
+ div.innerHTML = `
+ Film cited: ${config.item_title} - ${config.item_director[0]}
+ `
+ }
+ } else {
+ var html = []
+ config.cited.forEach(film => {
+ var title_en = film.title.split(' / ')[0]
+ var title_zh = film.title.split(' / ')[1] || title_en
+ if (config.language == 'en') {
+ var director = film.director ? ` (${film.director[0]})` : ''
+ html.push(`${title_en}${director}`)
+ } else {
+ var director = film.director ? ` (${film.director[1]})` : ''
+ html.push(`${title_zh}${director}`)
+ }
+ })
+ var films = html.length == 1 ? 'Film' : 'Films'
+ html= html.join(', ')
+ if (config.language == 'zh') {
+ div.innerHTML = ` 引用影片: ${html}`
+ } else {
+ div.innerHTML = `${films} cited: ${html}`
+ }
+ }
box.appendChild(div)
ascroll.appendChild(box)
}
@@ -355,14 +390,22 @@ function loadAnnotations(config) {
})
})
} else {
+ var cited = {}
pandoraAPI('getEdit', {id: config.edit, keys: []}).then(response => {
var annotations = []
response.data.clips.forEach(clip => {
+ cited[clip.item] = {
+ title: clip.title,
+ director: clip.director,
+ id: clip.item
+ }
clip.layers[config.layer].forEach(annotation => {
if (config.user && annotation.user != config.user) {
return
}
- annotation.title = clip.title
+ ;['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()
@@ -377,6 +420,7 @@ function loadAnnotations(config) {
})
loadClips(annotations).then(annotations => {
config.annotations = annotations
+ config.cited = Object.values(cited)
renderAnnotations(config)
})
})
diff --git a/app/text/models.py b/app/text/models.py
index 51faf99..c611c69 100644
--- a/app/text/models.py
+++ b/app/text/models.py
@@ -97,18 +97,28 @@ class Text(models.Model):
return []
clips = r['data']['clips']
annotations = []
+ cited = {}
layer = self.data.get('layer', None) or DEFAULT_LAYER
for clip in clips:
+ item_id = clip['item']
+ cited[item_id] = {
+ 'title': clip['title'],
+ 'director': clip['director'],
+ 'id': item_id,
+ }
for annotation in clip['layers'][layer]:
if 'user' in self.data and annotation['user'] == self.data['user']:
continue
- annotation['title'] = clip['title']
+ for key in ('title', 'director', 'date'):
+ if key in clip:
+ annotation[key] = clip[key]
if self.data.get('only_e'):
if annotation['value'].startswith('E:'):
annotation['value'] = annotation['value'][2:].strip()
annotations.append(annotation)
elif not annotation['value'].startswith('E:'):
annotations.append(annotation)
+ self.data['cited'] = list(cited.values())
return self.get_clips(api, annotations)
def get_clips(self, api, annotations):
@@ -158,6 +168,7 @@ class Text(models.Model):
data['title'] = self.title
data['byline'] = self.byline
data['body'] = self.body
+ data['language'] = self.language
item_id = self.data.get('related')
if not item_id:
item_id = self.data.get('item')