From 030f7087f4e6734f2899bc2d26798ff317145b26 Mon Sep 17 00:00:00 2001 From: j Date: Sat, 9 Dec 2023 13:12:08 +0000 Subject: [PATCH] keep subtitle until next layer shows up --- app/static/js/item.js | 15 ++++++++++++++- app/static/js/main.js | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/static/js/item.js b/app/static/js/item.js index a9f838b..02c0c50 100644 --- a/app/static/js/item.js +++ b/app/static/js/item.js @@ -113,6 +113,15 @@ async function loadData(id, args) { }) }) 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 => { var html = [] var layerData = getObjectById(pandora.site.layers, layer) @@ -132,7 +141,11 @@ async function loadData(id, args) { `) }) - value.push('
' + html.join('\n') + '
') + var layerClass = "" + if (layerData.isSubtitles) { + layerClass = " is-subtitles" + } + value.push('
' + html.join('\n') + '
') }) data.value = value.join('\n') diff --git a/app/static/js/main.js b/app/static/js/main.js index 56a00b1..344476f 100644 --- a/app/static/js/main.js +++ b/app/static/js/main.js @@ -108,6 +108,7 @@ pandoraAPI("init").then(response => { if (subtitleLayer) { layerKeys.push(subtitleLayer.id) } + pandora.subtitleLayer = subtitleLayer.id pandora.site.layers.map(layer => { return layer.id }).filter(layer => {