keep subtitle until next layer shows up

This commit is contained in:
j 2023-12-09 13:12:08 +00:00
parent ee2be2f6dd
commit 030f7087f4
2 changed files with 15 additions and 1 deletions

View file

@ -113,6 +113,15 @@ async function loadData(id, args) {
}) })
}) })
var value = [] var value = []
if (data.layers[pandora.subtitleLayer]) {
var previous;
data.layers[pandora.subtitleLayer].forEach(annotation => {
if (previous) {
previous.out = annotation['in']
}
previous = annotation
})
}
Object.keys(data.layers).forEach(layer => { Object.keys(data.layers).forEach(layer => {
var html = [] var html = []
var layerData = getObjectById(pandora.site.layers, layer) var layerData = getObjectById(pandora.site.layers, layer)
@ -132,7 +141,11 @@ async function loadData(id, args) {
</div> </div>
`) `)
}) })
value.push('<div class="layer">' + html.join('\n') + '</div>') var layerClass = ""
if (layerData.isSubtitles) {
layerClass = " is-subtitles"
}
value.push('<div class="layer'+layerClass+'">' + html.join('\n') + '</div>')
}) })
data.value = value.join('\n') data.value = value.join('\n')

View file

@ -108,6 +108,7 @@ pandoraAPI("init").then(response => {
if (subtitleLayer) { if (subtitleLayer) {
layerKeys.push(subtitleLayer.id) layerKeys.push(subtitleLayer.id)
} }
pandora.subtitleLayer = subtitleLayer.id
pandora.site.layers.map(layer => { pandora.site.layers.map(layer => {
return layer.id return layer.id
}).filter(layer => { }).filter(layer => {