| 2081 | // Prevents the expression from being set | 2081 | // Prevents the expression from being set |
| 2082 | event.stopPropagation(); | 2082 | event.stopPropagation(); |
| 2083 | | 2083 | |
| 2084 | const confirmation = await callPopup('<h3>Are you sure?</h3>Once deleted, it\'s gone forever!', 'confirm'); | 2084 | const expressionListItem = $(this).closest('.expression_list_item'); |
| | 2085 | const expression = expressionListItem.data('expression'); |
| 2085 | | 2086 | |
| | 2087 | const confirmation = await Popup.show.confirm(t`Delete Expression`, t`Are you sure you want to delete this expression? Once deleted, it\'s gone forever!` |
| | 2088 | + '<br /><br />' |
| | 2089 | + t`Expression: ` |
| | 2090 | + expressionListItem.attr('data-filename')); |
| 2086 | if (!confirmation) { | 2091 | if (!confirmation) { |
| 2087 | return; | 2092 | return; |
| 2088 | } | 2093 | } |
| 2089 | | 2094 | |
| 2090 | const expression = $(this).closest('.expression_list_item').data('expression'); | 2095 | const fileName = expressionListItem.attr('data-filename'); |
| 2091 | const name = $('#image_list').data('name'); | 2096 | const name = $('#image_list').data('name'); |
| 2092 | | 2097 | |
| 2093 | try { | 2098 | try { |
| 2094 | await fetch('/api/sprites/delete', { | 2099 | await fetch('/api/sprites/delete', { |
| 2095 | method: 'POST', | 2100 | method: 'POST', |
| 2096 | headers: getRequestHeaders(), | 2101 | headers: getRequestHeaders(), |
| 2097 | body: JSON.stringify({ name, label: expression }), | 2102 | body: JSON.stringify({ name, label: expression, spriteName: fileName }), |
| 2098 | }); | 2103 | }); |
| 2099 | } catch (error) { | 2104 | } catch (error) { |
| 2100 | toastr.error('Failed to delete image. Try again later.'); | 2105 | toastr.error('Failed to delete image. Try again later.'); |