diff --git a/views/episodes.html b/views/episodes.html index 9a3ff5ee2..9d6995ae1 100644 --- a/views/episodes.html +++ b/views/episodes.html @@ -442,6 +442,55 @@ + + {% endblock body %} {% block tail %} @@ -1135,6 +1184,7 @@ tools += ' '; tools += ' '; tools += ' '; + tools += ' '; return tools; } @@ -1281,6 +1331,55 @@ $('#subtitles_mod_fps_save_button_span').html(''); }); + $('#episode_tools_result').on('click', '.subtitles_mod_offset', function (e) { + e.preventDefault(); + + $('#subzero_offset_data_language').val($(this).attr("data-language")) + $('#subzero_offset_data_path').val($(this).attr("data-path")) + + $('#episodeToolsModal').modal('hide'); + $('#episodeSubtitleModOffsetModal') + .modal({ + focus: false + }); + }); + + $('#subtitles_mod_offset_form').on('submit', function (e) { + e.preventDefault(); + + let times = $('#subzero_offset_time').val().match(/(\d\d):(\d\d):(\d\d)[\.,:](\d\d\d)/); + if (times == null || times.length != 5) return false; + + let sign = ''; + if ($('input[name="subzero_offset_dir"]:checked').val() == "0") { + sign = '-'; + } + + const values = { + language: $('#subzero_offset_data_language').val(), + subtitlesPath: $('#subzero_offset_data_path').val(), + mod: 'shift_offset(h='+sign+times[1]+',m='+sign+times[2]+',s='+sign+times[3]+',ms='+sign+times[4]+')', + }; + + $.ajax({ + url: "{{ url_for('api.submods') }}", + type: "POST", + dataType: "json", + data: values, + + beforeSend: function () { + $('#subtitles_mod_offset_save_button').html('
Loading...
'); + }, + complete: function () { + $('#episodeSubtitleModOffsetModal').modal('hide'); + } + }); + }); + + $('#episodeSubtitleModOffsetModal').on('hidden.bs.modal', function (e) { + $('#subtitles_mod_offset_save_button_span').html(''); + }); + }); function seriesDetailsRefresh() { diff --git a/views/movie.html b/views/movie.html index 4c2af3a31..26b53612c 100644 --- a/views/movie.html +++ b/views/movie.html @@ -445,6 +445,55 @@ + + {% endblock body %} {% block tail %} @@ -943,6 +992,7 @@ tools += ' '; tools += ' '; tools += ' '; + tools += ' '; return tools; } @@ -1088,6 +1138,55 @@ $('#subtitles_mod_fps_save_button_span').html(''); }); + $('#movie_tools_result').on('click', '.subtitles_mod_offset', function (e) { + e.preventDefault(); + + $('#subzero_offset_data_language').val($(this).attr("data-language")) + $('#subzero_offset_data_path').val($(this).attr("data-path")) + + $('#movieToolsModal').modal('hide'); + $('#movieSubtitleModOffsetModal') + .modal({ + focus: false + }); + }); + + $('#subtitles_mod_offset_form').on('submit', function (e) { + e.preventDefault(); + + let times = $('#subzero_offset_time').val().match(/(\d\d):(\d\d):(\d\d)[\.,:](\d\d\d)/); + if (times == null || times.length != 5) return false; + + let sign = ''; + if ($('input[name="subzero_offset_dir"]:checked').val() == "0") { + sign = '-'; + } + + const values = { + language: $('#subzero_offset_data_language').val(), + subtitlesPath: $('#subzero_offset_data_path').val(), + mod: 'shift_offset(h='+sign+times[1]+',m='+sign+times[2]+',s='+sign+times[3]+',ms='+sign+times[4]+')', + }; + + $.ajax({ + url: "{{ url_for('api.submods') }}", + type: "POST", + dataType: "json", + data: values, + + beforeSend: function () { + $('#subtitles_mod_offset_save_button').html('
Loading...
'); + }, + complete: function () { + $('#movieSubtitleModOffsetModal').modal('hide'); + } + }); + }); + + $('#movieSubtitleModOffsetModal').on('hidden.bs.modal', function (e) { + $('#subtitles_mod_offset_save_button_span').html(''); + }); + }); function movieDetailsRefresh() {