Languages
-
+
-
Hearing-Impaired
@@ -91,6 +90,7 @@
+
Movies Default Settings
@@ -103,9 +103,10 @@
Languages
-
+
+
+
-
Hearing-Impaired
@@ -133,21 +134,57 @@
// Hide checkmark over save button
$('#save_button_checkmark').hide();
- // Hide *_div on Select input changed to None
+ // Listen to selection change on enabled_languages select and keep series and movies default language select synced
+ $('#enabled_languages').on('changed.bs.select', function(event, clickedIndex, isSelected, previousValue) {
+ actual = $("#enabled_languages option:selected").map(function() {
+ return $(this).val();
+ }).get();
+ if (previousValue) {
+ var added = actual.filter(x => !previousValue.includes(x));
+ var removed = previousValue.filter(x => !actual.includes(x));
- $('#enabled_languages').on('change', function() {
- //$('#settings-general-serie_default_language').selectpicker('val', $('#enabled_languages').val());
- console.log($('#enabled_languages').val());
- console.log($('#enabled_languages option:selected').text());
+ if (added.length > 0) {
+ $('#settings-general-serie_default_language').append('');
+ $('#settings-general-movie_default_language').append('');
+ }
+ if (removed.length > 0) {
+ $("#settings-general-serie_default_language option[value="+removed[0]+"]").remove();
+ $("#settings-general-movie_default_language option[value="+removed[0]+"]").remove();
+ }
+ } else {
+ $(actual).each( function(i, item) {
+ if ($('#settings-general-serie_default_language option[value='+item+']').length < 1) {
+ $('#settings-general-serie_default_language').append('');
+ $('#settings-general-movie_default_language').append('');
+ }
+ });
+ }
+
+ $('#settings-general-serie_default_language').selectpicker('val', {{settings.general.serie_default_language|safe}});
+ $('#settings-general-movie_default_language').selectpicker('val', {{settings.general.movie_default_language|safe}});
+ $("#settings-general-serie_default_language").selectpicker("refresh");
+ $("#settings-general-movie_default_language").selectpicker("refresh");
})
// Set Select input values
$('#settings-general-subfolder').val('{{settings.general.subfolder}}').trigger('change');
$('#settings-general-anti_captcha_provider').val('{{settings.general.anti_captcha_provider}}').trigger('change');
- $('#settings-general-serie_default_language').val('{{settings.general.serie_default_language}}').trigger('change');
$('.selectpicker').selectpicker('refresh')
+ // Listen to single language checkbox change to adapt languages menus
+ $('#settings-general-single_language').on('change', function() {
+ if ($(this).prop('checked')) {
+ $('#settings-general-serie_default_language').selectpicker({maxOptions:1}).selectpicker('refresh');
+ $('#settings-general-movie_default_language').selectpicker({maxOptions:1}).selectpicker('refresh');
+ $('#settings-general-serie_default_language').selectpicker('val', $('#settings-general-serie_default_language').val()[0]);
+ $('#settings-general-movie_default_language').selectpicker('val', $('#settings-general-movie_default_language').val()[0]);
+ } else {
+ $('#settings-general-serie_default_language').selectpicker({maxOptions:false}).selectpicker('refresh');
+ $('#settings-general-movie_default_language').selectpicker({maxOptions:false}).selectpicker('refresh');
+ }
+ });
+
// Set Checkbox input values
$('#settings-general-single_language').prop('checked', {{'true' if settings.general.getboolean('single_language') else 'false'}}).trigger('change');