From a380b325a3cb473af603ceaa67356e3ecc3985e2 Mon Sep 17 00:00:00 2001 From: JannisX11 Date: Sun, 25 Jul 2021 18:41:58 +0200 Subject: [PATCH] Add close button to messages boxes Add cancel button for private settings message box Change text in private settings message box --- js/api.js | 6 +++++- js/interface/settings.js | 9 +++++---- lang/en.json | 4 ++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/js/api.js b/js/api.js index f633a86..2a0bb30 100644 --- a/js/api.js +++ b/js/api.js @@ -211,7 +211,11 @@ const Blockbench = { if (!options.message) options.message = tl('message.'+options.translateKey+'.message') } - var jq_dialog = $('
'+tl(options.title)+'
') + var jq_dialog = $(` + +
${tl(options.title)}
+
clear
+
`) jq_dialog.append('
'+ marked(tl(options.message))+'
' diff --git a/js/interface/settings.js b/js/interface/settings.js index 78b8819..e811de3 100644 --- a/js/interface/settings.js +++ b/js/interface/settings.js @@ -500,20 +500,21 @@ BARS.defineActions(() => { } } if (private_data.length) { - await new Promise((resolve, reject) => { + let go_on = await new Promise((resolve, reject) => { Blockbench.showMessageBox({ title: 'dialog.export_private_settings.title', message: tl('dialog.export_private_settings.message', [private_data.map(key => settings[key].name).join(', ')]), - buttons: ['dialog.export_private_settings.keep', 'dialog.export_private_settings.remove'] + buttons: ['dialog.export_private_settings.keep', 'dialog.export_private_settings.omit', 'dialog.cancel'] }, result => { if (result == 1) { private_data.forEach(key => { delete settings_copy[key]; }) } - resolve() + resolve(result !== 2); }) - }) + }); + if (!go_on) return; } Blockbench.export({ resource_id: 'config', diff --git a/lang/en.json b/lang/en.json index 1b4285b..3ed8f24 100644 --- a/lang/en.json +++ b/lang/en.json @@ -427,9 +427,9 @@ "dialog.flip_animation.offset": "Offset by half the animation length", "dialog.export_private_settings.title": "Private Settings", - "dialog.export_private_settings.message": "Your file contains the following private informations: **%0**. Remove these values if you plan to share the file with someone else.", + "dialog.export_private_settings.message": "Your file contains the following private informations: **%0**. Leave these values out if you plan to share the file with someone else.", "dialog.export_private_settings.keep": "Keep", - "dialog.export_private_settings.remove": "Remove", + "dialog.export_private_settings.omit": "Leave Out", "dialog.settings.title": "Preferences", "dialog.settings.settings": "Settings",