diff --git a/ui/media/js/auto-save.js b/ui/media/js/auto-save.js index 29e5298a..5ea786d5 100644 --- a/ui/media/js/auto-save.js +++ b/ui/media/js/auto-save.js @@ -35,6 +35,7 @@ const SETTINGS_IDS_LIST = [ "sound_toggle", "turbo", "use_full_precision", + "confirm_dangerous_actions", "auto_save_settings" ] diff --git a/ui/media/js/main.js b/ui/media/js/main.js index f6510257..e46c530d 100644 --- a/ui/media/js/main.js +++ b/ui/media/js/main.js @@ -144,16 +144,18 @@ function isServerAvailable() { // fn : function to be called if the user confirms the dialog or has the shift key pressed // // If the user had the shift key pressed while clicking, the function fn will be executed. +// If the setting "confirm_dangerous_actions" in the system settings is disabled, the function +// fn will be executed. // Otherwise, a confirmation dialog is shown. If the user confirms, the function fn will also // be executed. function shiftOrConfirm(e, prompt, fn) { e.stopPropagation() - if (e.shiftKey) { + if (e.shiftKey || !confirmDangerousActionsField.checked) { fn(e) } else { $.confirm({ theme: 'supervan', title: prompt, - content: 'Tip: Use shift-click to skip this dialog.', + content: 'Tip: To skip this dialog, use shift-click or disable the setting "Confirm dangerous actions" in the systems setting.', buttons: { yes: () => { fn(e) }, cancel: () => {} diff --git a/ui/media/js/parameters.js b/ui/media/js/parameters.js index 2e5bc75c..dfa33246 100644 --- a/ui/media/js/parameters.js +++ b/ui/media/js/parameters.js @@ -114,6 +114,14 @@ var PARAMETERS = [ icon: "fa-gear", default: true, }, + { + id: "confirm_dangerous_actions", + type: ParameterType.checkbox, + label: "Confirm dangerous actions", + note: "Actions that might lead to data loss must either be clicked with the shift key pressed, or confirmed in an 'are you sure?' dialog", + icon: "fa-check-double", + default: true, + }, { id: "listen_to_network", type: ParameterType.checkbox, @@ -198,6 +206,7 @@ let listenToNetworkField = document.querySelector("#listen_to_network") let listenPortField = document.querySelector("#listen_port") let useBetaChannelField = document.querySelector("#use_beta_channel") let uiOpenBrowserOnStartField = document.querySelector("#ui_open_browser_on_start") +let confirmDangerousActionsField = document.querySelector("#confirm_dangerous_actions") let saveSettingsBtn = document.querySelector('#save-system-settings-btn')