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/notificationsettings.js

60 lines
2.3 KiB
JavaScript
Raw Normal View History

2014-04-25 16:47:56 -04:00
(function () {
function reload(page) {
ApiClient.getServerConfiguration().done(function (config) {
var notificationOptions = config.NotificationOptions;
$('#chkNewLibraryContent', page).checked(notificationOptions.SendOnNewLibraryContent).checkboxradio('refresh');
$('#chkFailedTasks', page).checked(notificationOptions.SendOnFailedTasks).checkboxradio('refresh');
$('#chkUpdates', page).checked(notificationOptions.SendOnUpdates).checkboxradio('refresh');
2014-04-25 22:55:07 -04:00
$('#chkServerRestartRequired', page).checked(notificationOptions.SendOnServerRestartRequired).checkboxradio('refresh');
$('#chkVideoPlayback', page).checked(notificationOptions.SendOnVideoPlayback).checkboxradio('refresh');
$('#chkAudioPlayback', page).checked(notificationOptions.SendOnAudioPlayback).checkboxradio('refresh');
$('#chkGamePlayback', page).checked(notificationOptions.SendOnGamePlayback).checkboxradio('refresh');
2014-04-25 16:47:56 -04:00
});
}
function save(page) {
ApiClient.getServerConfiguration().done(function (config) {
var notificationOptions = config.NotificationOptions;
notificationOptions.SendOnNewLibraryContent = $('#chkNewLibraryContent', page).checked();
notificationOptions.SendOnFailedTasks = $('#chkFailedTasks', page).checked();
notificationOptions.SendOnUpdates = $('#chkUpdates', page).checked();
2014-04-25 22:55:07 -04:00
notificationOptions.SendOnServerRestartRequired = $('#chkServerRestartRequired', page).checked();
notificationOptions.SendOnVideoPlayback = $('#chkVideoPlayback', page).checked();
notificationOptions.SendOnAudioPlayback = $('#chkAudioPlayback', page).checked();
notificationOptions.SendOnGamePlayback = $('#chkGamePlayback', page).checked();
2014-04-25 16:47:56 -04:00
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
});
}
$(document).on('pageshow', "#notificationSettingsPage", function () {
var page = this;
reload(page);
});
window.NotificationSettingsPage = {
onSubmit: function () {
var page = $(this).parents('.page');
save(page);
return false;
}
};
})(jQuery, window);