jellyfin-web/dashboard-ui/scripts/metadataadvanced.js

72 lines
2.7 KiB
JavaScript
Raw Normal View History

2013-02-20 18:33:05 -07:00
var AdvancedMetadataConfigurationPage = {
onPageShow: function () {
Dashboard.showLoadingMsg();
var page = this;
2013-12-17 21:39:44 -07:00
ApiClient.getServerConfiguration().done(function (configuration) {
2013-02-20 18:33:05 -07:00
2013-12-17 21:39:44 -07:00
AdvancedMetadataConfigurationPage.load(page, configuration);
2013-02-20 18:33:05 -07:00
});
},
2013-12-17 21:39:44 -07:00
load: function (page, config) {
2013-12-25 23:17:19 -07:00
$('#chkMovies', page).checked(config.EnableMovieChapterImageExtraction).checkboxradio("refresh");
$('#chkEpisodes', page).checked(config.EnableEpisodeChapterImageExtraction).checkboxradio("refresh");
$('#chkOtherVideos', page).checked(config.EnableOtherVideoChapterImageExtraction).checkboxradio("refresh");
2013-12-17 21:39:44 -07:00
$('#chkEnableTmdbPersonUpdates', page).checked(config.EnableTmdbUpdates).checkboxradio("refresh");
$('#chkEnableTvdbUpdates', page).checked(config.EnableTvDbUpdates).checkboxradio("refresh");
2014-01-30 21:50:09 -07:00
$('#chkEnableFanartUpdates', page).checked(config.EnableFanArtUpdates).checkboxradio("refresh");
2013-02-20 18:33:05 -07:00
Dashboard.hideLoadingMsg();
},
loadItemTypes: function (page, configuration, types) {
var html = '<div data-role="controlgroup">';
for (var i = 0, length = types.length; i < length; i++) {
var type = types[i];
var id = "checkbox-" + i + "a";
var checkedAttribute = configuration.InternetProviderExcludeTypes.indexOf(type) != -1 ? ' checked="checked"' : '';
2013-04-16 21:58:32 -07:00
html += '<input' + checkedAttribute + ' class="chkItemType" data-mini="true" data-itemtype="' + type + '" type="checkbox" name="' + id + '" id="' + id + '" />';
2013-02-20 18:33:05 -07:00
html += '<label for="' + id + '">' + type + '</label>';
}
html += "</div>";
$('#divItemTypes', page).html(html).trigger("create");
},
onSubmit: function () {
var form = this;
2013-04-16 21:58:32 -07:00
Dashboard.showLoadingMsg();
2013-02-20 18:33:05 -07:00
ApiClient.getServerConfiguration().done(function (config) {
2013-12-25 23:17:19 -07:00
config.EnableMovieChapterImageExtraction = $('#chkMovies', form).checked();
config.EnableEpisodeChapterImageExtraction = $('#chkEpisodes', form).checked();
config.EnableOtherVideoChapterImageExtraction = $('#chkOtherVideos', form).checked();
2013-12-17 21:39:44 -07:00
config.EnableTvDbUpdates = $('#chkEnableTvdbUpdates', form).checked();
config.EnableTmdbUpdates = $('#chkEnableTmdbPersonUpdates', form).checked();
2014-01-30 21:50:09 -07:00
config.EnableFanArtUpdates = $('#chkEnableFanartUpdates', form).checked();
2013-02-20 18:33:05 -07:00
2013-04-16 21:58:32 -07:00
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
2013-02-20 18:33:05 -07:00
});
// Disable default form submission
return false;
}
};
$(document).on('pageshow', "#advancedMetadataConfigurationPage", AdvancedMetadataConfigurationPage.onPageShow);