forked from extern/easydiffusion
System settings to disable the 'Are you sure?'-dialogs
This commit is contained in:
parent
a486f20892
commit
6eff591df7
@ -35,6 +35,7 @@ const SETTINGS_IDS_LIST = [
|
|||||||
"sound_toggle",
|
"sound_toggle",
|
||||||
"turbo",
|
"turbo",
|
||||||
"use_full_precision",
|
"use_full_precision",
|
||||||
|
"confirm_dangerous_actions",
|
||||||
"auto_save_settings"
|
"auto_save_settings"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -144,16 +144,18 @@ function isServerAvailable() {
|
|||||||
// fn : function to be called if the user confirms the dialog or has the shift key pressed
|
// 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 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
|
// Otherwise, a confirmation dialog is shown. If the user confirms, the function fn will also
|
||||||
// be executed.
|
// be executed.
|
||||||
function shiftOrConfirm(e, prompt, fn) {
|
function shiftOrConfirm(e, prompt, fn) {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
if (e.shiftKey) {
|
if (e.shiftKey || !confirmDangerousActionsField.checked) {
|
||||||
fn(e)
|
fn(e)
|
||||||
} else {
|
} else {
|
||||||
$.confirm({ theme: 'supervan',
|
$.confirm({ theme: 'supervan',
|
||||||
title: prompt,
|
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: {
|
buttons: {
|
||||||
yes: () => { fn(e) },
|
yes: () => { fn(e) },
|
||||||
cancel: () => {}
|
cancel: () => {}
|
||||||
|
@ -114,6 +114,14 @@ var PARAMETERS = [
|
|||||||
icon: "fa-gear",
|
icon: "fa-gear",
|
||||||
default: true,
|
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",
|
id: "listen_to_network",
|
||||||
type: ParameterType.checkbox,
|
type: ParameterType.checkbox,
|
||||||
@ -198,6 +206,7 @@ let listenToNetworkField = document.querySelector("#listen_to_network")
|
|||||||
let listenPortField = document.querySelector("#listen_port")
|
let listenPortField = document.querySelector("#listen_port")
|
||||||
let useBetaChannelField = document.querySelector("#use_beta_channel")
|
let useBetaChannelField = document.querySelector("#use_beta_channel")
|
||||||
let uiOpenBrowserOnStartField = document.querySelector("#ui_open_browser_on_start")
|
let uiOpenBrowserOnStartField = document.querySelector("#ui_open_browser_on_start")
|
||||||
|
let confirmDangerousActionsField = document.querySelector("#confirm_dangerous_actions")
|
||||||
|
|
||||||
let saveSettingsBtn = document.querySelector('#save-system-settings-btn')
|
let saveSettingsBtn = document.querySelector('#save-system-settings-btn')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user