From dd7e1d0ba0bebb28e34fd65127d21d3d7c423d29 Mon Sep 17 00:00:00 2001 From: j Date: Wed, 13 Nov 2019 12:41:38 +0000 Subject: [PATCH] select subtitles layer by default if selecting an srt file --- static/js/importAnnotationsDialog.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/static/js/importAnnotationsDialog.js b/static/js/importAnnotationsDialog.js index 7f2f6174..87593f15 100644 --- a/static/js/importAnnotationsDialog.js +++ b/static/js/importAnnotationsDialog.js @@ -68,7 +68,14 @@ pandora.ui.importAnnotationsDialog = function(options) { .bindEvent({ change: function(data) { $status.empty(); - data.value.length && $formatSelect.options({value: Ox.last(data.value[0].name.split('.'))}); + if (data.value.length) { + var format = Ox.last(data.value[0].name.split('.')); + $formatSelect.options({value: format}); + var subtitlesLayer = pandora.getSubtitlesLayer() + if (subtitlesLayer && format == 'srt' && Ox.getObjectById(layers, subtitlesLayer)) { + $layerSelect.options({value: subtitlesLayer}) + } + } that[ data.value.length ? 'enableButton' : 'disableButton' ]('import');