diff --git a/public/script.js b/public/script.js index 1f32255cf..3fd5ca030 100644 --- a/public/script.js +++ b/public/script.js @@ -4087,10 +4087,23 @@ function setRightTabSelectedClass(selectedButtonId) { }); } -function select_rm_info(text, charId = null) { - $("#rm_info_text").html("

" + text + "

"); +function select_rm_info(type, charId) { - selectRightMenuWithAnimation('rm_info_block'); + if (!type) { + toastr.error(`Invalid process (no 'type')`); + return; + } + if (type === 'char_delete') { + toastr.warning(`Character Deleted: ${charId}`); + } + if (type === 'char_create') { + toastr.success(`Character Created: ${charId}`); + } + if (type === 'char_import') { + toastr.success(`Character Imported: ${charId}`); + } + + selectRightMenuWithAnimation('rm_characters_block'); setRightTabSelectedClass(); prev_selected_char = charId; @@ -5155,7 +5168,7 @@ $(document).ready(function () { method: "POST", url: "/deletecharacter", beforeSend: function () { - select_rm_info("Character deleted"); + select_rm_info("char_delete", characters[this_chid].name); //$('#create_button').attr('value','Deleting...'); }, data: msg, @@ -5337,7 +5350,7 @@ $(document).ready(function () { $("#rm_info_block").transition({ opacity: 0, duration: 0 }); var $prev_img = $("#avatar_div_div").clone(); $("#rm_info_avatar").append($prev_img); - select_rm_info(`Character created

${DOMPurify.sanitize(save_name)}

`, oldSelectedChar); + select_rm_info(`char_create`, save_name); $("#rm_info_block").transition({ opacity: 1.0, duration: 2000 }); crop_data = undefined; @@ -6204,7 +6217,7 @@ $(document).ready(function () { names.push(data.file_name); let nameString = DOMPurify.sanitize(names.join(', ')); await getCharacters(); - select_rm_info(`Character imported

${nameString}

`, oldSelectedChar); + select_rm_info(`char_import`, data.file_name); $("#rm_info_block").transition({ opacity: 1, duration: 1000 }); } },