| 598 | 598 | $(document).on('click', '.mes_translate', onMessageTranslateClick); |
| 599 | 599 | $('#translate_key_button').on('click', async () => { |
| 600 | 600 | const optionText = $('#translation_provider option:selected').text(); |
| 601 | 601 | const key = await callGenericPopup(`<h3>${optionText} API Key</h3>`, POPUP_TYPE.INPUT);, '', { |
| 602 | + customButtons: [{ |
| 603 | + text: 'Remove Key', |
| 604 | + appendAtEnd: true, |
| 605 | + result: POPUP_RESULT.NEGATIVE, |
| 606 | + action: async () => { |
| 607 | + await writeSecret(extension_settings.translate.provider, ''); |
| 608 | + toastr.success('API Key removed'); |
| 609 | + $('#translate_key_button').toggleClass('success', !!secret_state[extension_settings.translate.provider]); |
| 610 | + }, |
| 611 | + }], |
| 612 | + }); |
| 602 | 613 | |
| 603 | 614 | if (!key == false) { |
| 604 | 615 | return; |
| 605 | 616 | } |
| 606 | 617 | |