mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-10 07:22:37 -07:00
Alert if leaving settings without saving changes
This commit is contained in:
parent
663b9a610a
commit
363d1b07ca
1 changed files with 14 additions and 0 deletions
|
@ -2059,12 +2059,21 @@ $(document).ready(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Global Variables
|
// Global Variables
|
||||||
|
settingsChanged = false;
|
||||||
serverChanged = false;
|
serverChanged = false;
|
||||||
authChanged = false;
|
authChanged = false;
|
||||||
httpChanged = false;
|
httpChanged = false;
|
||||||
monitorChanged = false;
|
monitorChanged = false;
|
||||||
directoryChanged = false;
|
directoryChanged = false;
|
||||||
|
|
||||||
|
// Alert if leaving the page without saving changes to settings
|
||||||
|
window.onbeforeunload = confirmExit;
|
||||||
|
function confirmExit() {
|
||||||
|
if (settingsChanged) {
|
||||||
|
return "Settings were changed without saving!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Alert the user that their changes require a restart.
|
// Alert the user that their changes require a restart.
|
||||||
function postSaveChecks() {
|
function postSaveChecks() {
|
||||||
if ((serverChanged && $('#monitoring_use_websocket').is(":checked")) || authChanged || httpChanged || monitorChanged || directoryChanged) {
|
if ((serverChanged && $('#monitoring_use_websocket').is(":checked")) || authChanged || httpChanged || monitorChanged || directoryChanged) {
|
||||||
|
@ -2072,9 +2081,14 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
$("#http_hashed_password").val($("#http_hash_password").is(":checked") ? 1 : 0)
|
$("#http_hashed_password").val($("#http_hash_password").is(":checked") ? 1 : 0)
|
||||||
getSchedulerTable();
|
getSchedulerTable();
|
||||||
|
settingsChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var configForm = $("#configUpdate");
|
var configForm = $("#configUpdate");
|
||||||
|
configForm.change(function () {
|
||||||
|
settingsChanged = true;
|
||||||
|
});
|
||||||
|
|
||||||
function saveSettings() {
|
function saveSettings() {
|
||||||
if (configForm.parsley().validate()) {
|
if (configForm.parsley().validate()) {
|
||||||
doAjaxCall('configUpdate', $(this), 'tabs', true, postSaveChecks);
|
doAjaxCall('configUpdate', $(this), 'tabs', true, postSaveChecks);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue