From 1d640a2cbf2a4d72deccd2d7f82821b2e51712cc Mon Sep 17 00:00:00 2001 From: phiharri Date: Thu, 6 Jul 2023 01:43:57 +0100 Subject: [PATCH 1/2] Optional delete message confirmation --- public/index.html | 5 ++++- public/script.js | 8 +++++--- public/scripts/power-user.js | 6 ++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/public/index.html b/public/index.html index 06878afbd..51601ad5c 100644 --- a/public/index.html +++ b/public/index.html @@ -2344,6 +2344,9 @@ +
@@ -3561,4 +3564,4 @@ - \ No newline at end of file + diff --git a/public/script.js b/public/script.js index f22757020..b30c2c997 100644 --- a/public/script.js +++ b/public/script.js @@ -7672,9 +7672,11 @@ $(document).ready(function () { $(document).on("click", ".mes_edit_delete", async function () { - const confirmation = await callPopup("Are you sure you want to delete this message?", 'confirm'); - if (!confirmation) { - return; + if (power_user.confirm_message_delete) { + const confirmation = await callPopup("Are you sure you want to delete this message?", 'confirm'); + if (!confirmation) { + return; + } } const mes = $(this).closest(".mes"); diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js index c1a548a22..4700a4817 100644 --- a/public/scripts/power-user.js +++ b/public/scripts/power-user.js @@ -632,6 +632,7 @@ function loadPowerUserSettings(settings, data) { $(`#pygmalion_formatting option[value=${power_user.pygmalion_formatting}]`).attr("selected", true); $(`#send_on_enter option[value=${power_user.send_on_enter}]`).attr("selected", true); $("#import_card_tags").prop("checked", power_user.import_card_tags); + $("#confirm_message_delete").prop("checked", power_user.confirm_message_delete !== undefined ? !!power_user.confirm_message_delete : true); $("#collapse-newlines-checkbox").prop("checked", power_user.collapse_newlines); $("#pin-examples-checkbox").prop("checked", power_user.pin_examples); $("#disable-description-formatting-checkbox").prop("checked", power_user.disable_description_formatting); @@ -1697,6 +1698,11 @@ $(document).ready(() => { saveSettingsDebounced(); }); + $("#confirm_message_delete").on('input', function () { + power_user.confirm_message_delete = !!$(this).prop('checked'); + saveSettingsDebounced(); + }); + $("#render_formulas").on("input", function () { power_user.render_formulas = !!$(this).prop('checked'); reloadMarkdownProcessor(power_user.render_formulas); From a2fc3ec1153a6285784e4e4a3fe3d74c8a62275b Mon Sep 17 00:00:00 2001 From: phiharri Date: Thu, 6 Jul 2023 20:56:08 +0100 Subject: [PATCH 2/2] set default value for confirm_message_delete --- public/scripts/power-user.js | 1 + 1 file changed, 1 insertion(+) diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js index 4700a4817..0c18458b5 100644 --- a/public/scripts/power-user.js +++ b/public/scripts/power-user.js @@ -121,6 +121,7 @@ let power_user = { play_message_sound: false, play_sound_unfocused: true, auto_save_msg_edits: false, + confirm_message_delete: true, sort_field: 'name', sort_order: 'asc',