1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
jellyfin-web/dashboard-ui/scripts/livetvsettings.js

64 lines
1.6 KiB
JavaScript
Raw Normal View History

2014-01-12 11:55:38 -05:00
(function ($, document, window) {
2014-01-14 15:03:35 -05:00
function loadPage(page, config, liveTvInfo) {
2014-01-12 11:55:38 -05:00
2014-01-17 13:23:00 -05:00
if (liveTvInfo.IsEnabled) {
2014-01-12 11:55:38 -05:00
$('.liveTvSettingsForm', page).show();
$('.noLiveTvServices', page).hide();
} else {
$('.liveTvSettingsForm', page).hide();
$('.noLiveTvServices', page).show();
}
2014-07-27 18:01:29 -04:00
$('#selectGuideDays', page).val(config.GuideDays || '').selectmenu('refresh');
2014-01-16 17:49:31 -05:00
var serviceOptions = liveTvInfo.Services.map(function (s) {
return '<option value="' + s.Name + '">' + s.Name + '</option>';
});
2014-01-12 11:55:38 -05:00
Dashboard.hideLoadingMsg();
}
$(document).on('pageshow', "#liveTvSettingsPage", function () {
Dashboard.showLoadingMsg();
var page = this;
2014-07-27 18:01:29 -04:00
var promise1 = ApiClient.getNamedConfiguration("livetv");
2014-01-12 11:55:38 -05:00
2014-01-14 15:03:35 -05:00
var promise2 = ApiClient.getLiveTvInfo();
2014-01-12 11:55:38 -05:00
$.when(promise1, promise2).done(function (response1, response2) {
loadPage(page, response1[0], response2[0]);
});
});
2014-01-16 17:49:31 -05:00
window.LiveTvSettingsPage = {
onSubmit: function () {
2014-01-12 11:55:38 -05:00
Dashboard.showLoadingMsg();
var form = this;
2014-07-27 18:01:29 -04:00
ApiClient.getNamedConfiguration("livetv").done(function (config) {
2014-01-12 11:55:38 -05:00
2014-07-27 18:01:29 -04:00
config.GuideDays = $('#selectGuideDays', form).val() || null;
2014-01-12 11:55:38 -05:00
2014-07-27 18:01:29 -04:00
ApiClient.updateNamedConfiguration("livetv", config).done(Dashboard.processServerConfigurationUpdateResult);
2014-01-12 11:55:38 -05:00
});
// Disable default form submission
return false;
}
};
})(jQuery, document, window);