#2482 Fix embedded content confirmation
| @@ -1,13 +1,13 @@ | |||
| 1 | import { callPopup, characters, eventSource, event_types, getCurrentChatId, reloadCurrentChat, saveSettingsDebounced, this_chid } from '../../../script.js'; | 1 | import { callPopup, characters, eventSource, event_types, getCurrentChatId, reloadCurrentChat, saveSettingsDebounced, this_chid } from '../../../script.js'; |
| 2 | import { extension_settings, renderExtensionTemplateAsync, writeExtensionField } from '../../extensions.js'; | 2 | import { extension_settings, renderExtensionTemplateAsync, writeExtensionField } from '../../extensions.js'; |
| 3 | import { selected_group } from '../../group-chats.js'; | 3 | import { selected_group } from '../../group-chats.js'; |
| 4 | import { callGenericPopup, POPUP_TYPE } from '../../popup.js'; | ||
| 4 | import { SlashCommand } from '../../slash-commands/SlashCommand.js'; | 5 | import { SlashCommand } from '../../slash-commands/SlashCommand.js'; |
| 5 | import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from '../../slash-commands/SlashCommandArgument.js'; | 6 | import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from '../../slash-commands/SlashCommandArgument.js'; |
| 6 | import { enumIcons } from '../../slash-commands/SlashCommandCommonEnumsProvider.js'; | 7 | import { enumIcons } from '../../slash-commands/SlashCommandCommonEnumsProvider.js'; |
| 7 | import { SlashCommandEnumValue, enumTypes } from '../../slash-commands/SlashCommandEnumValue.js'; | 8 | import { SlashCommandEnumValue, enumTypes } from '../../slash-commands/SlashCommandEnumValue.js'; |
| 8 | import { SlashCommandParser } from '../../slash-commands/SlashCommandParser.js'; | 9 | import { SlashCommandParser } from '../../slash-commands/SlashCommandParser.js'; |
| 9 | import { download, getFileText, getSortableDelay, uuidv4 } from '../../utils.js'; | 10 | import { download, getFileText, getSortableDelay, uuidv4 } from '../../utils.js'; |
| 10 | import { resolveVariable } from '../../variables.js'; | ||
| 11 | import { regex_placement, runRegexScript } from './engine.js'; | 11 | import { regex_placement, runRegexScript } from './engine.js'; |
| 12 | 12 | ||
| 13 | /** | 13 | /** |
| @@ -141,7 +141,7 @@ async function loadRegexScripts() { | |||
| 141 | await onRegexEditorOpenClick(scriptHtml.attr('id'), isScoped); | 141 | await onRegexEditorOpenClick(scriptHtml.attr('id'), isScoped); |
| 142 | }); | 142 | }); |
| 143 | scriptHtml.find('.move_to_global').on('click', async function () { | 143 | scriptHtml.find('.move_to_global').on('click', async function () { |
| 144 | const confirm = await callPopup('Are you sure you want to move this regex script to global?', 'confirm'); | 144 | const confirm = await callGenericPopup('Are you sure you want to move this regex script to global?', POPUP_TYPE.CONFIRM); |
| 145 | 145 | ||
| 146 | if (!confirm) { | 146 | if (!confirm) { |
| 147 | return; | 147 | return; |
| @@ -161,7 +161,7 @@ async function loadRegexScripts() { | |||
| 161 | return; | 161 | return; |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | const confirm = await callPopup('Are you sure you want to move this regex script to scoped?', 'confirm'); | 164 | const confirm = await callGenericPopup('Are you sure you want to move this regex script to scoped?', POPUP_TYPE.CONFIRM); |
| 165 | 165 | ||
| 166 | if (!confirm) { | 166 | if (!confirm) { |
| 167 | return; | 167 | return; |
| @@ -176,7 +176,7 @@ async function loadRegexScripts() { | |||
| 176 | download(fileData, fileName, 'application/json'); | 176 | download(fileData, fileName, 'application/json'); |
| 177 | }); | 177 | }); |
| 178 | scriptHtml.find('.delete_regex').on('click', async function () { | 178 | scriptHtml.find('.delete_regex').on('click', async function () { |
| 179 | const confirm = await callPopup('Are you sure you want to delete this regex script?', 'confirm'); | 179 | const confirm = await callGenericPopup('Are you sure you want to delete this regex script?', POPUP_TYPE.CONFIRM); |
| 180 | 180 | ||
| 181 | if (!confirm) { | 181 | if (!confirm) { |
| 182 | return; | 182 | return; |
| @@ -442,7 +442,7 @@ async function checkEmbeddedRegexScripts() { | |||
| 442 | if (!localStorage.getItem(checkKey)) { | 442 | if (!localStorage.getItem(checkKey)) { |
| 443 | localStorage.setItem(checkKey, 'true'); | 443 | localStorage.setItem(checkKey, 'true'); |
| 444 | const template = await renderExtensionTemplateAsync('regex', 'embeddedScripts', {}); | 444 | const template = await renderExtensionTemplateAsync('regex', 'embeddedScripts', {}); |
| 445 | const result = await callPopup(template, 'confirm', '', { okButton: 'Yes' }); | 445 | const result = await callGenericPopup(template, POPUP_TYPE.CONFIRM, '', { okButton: 'Yes' }); |
| 446 | 446 | ||
| 447 | if (result) { | 447 | if (result) { |
| 448 | extension_settings.character_allowed_regex.push(avatar); | 448 | extension_settings.character_allowed_regex.push(avatar); |
| @@ -493,7 +493,7 @@ jQuery(async () => { | |||
| 493 | template.find('#regex_import_target_global').on('input', () => target = 'global'); | 493 | template.find('#regex_import_target_global').on('input', () => target = 'global'); |
| 494 | template.find('#regex_import_target_scoped').on('input', () => target = 'scoped'); | 494 | template.find('#regex_import_target_scoped').on('input', () => target = 'scoped'); |
| 495 | 495 | ||
| 496 | await callPopup(template, 'text'); | 496 | await callGenericPopup(template, POPUP_TYPE.TEXT); |
| 497 | 497 | ||
| 498 | const inputElement = this instanceof HTMLInputElement && this; | 498 | const inputElement = this instanceof HTMLInputElement && this; |
| 499 | for (const file of inputElement.files) { | 499 | for (const file of inputElement.files) { |
| @@ -16,7 +16,7 @@ import { SlashCommandEnumValue, enumTypes } from './slash-commands/SlashCommandE | |||
| 16 | import { commonEnumProviders, enumIcons } from './slash-commands/SlashCommandCommonEnumsProvider.js'; | 16 | import { commonEnumProviders, enumIcons } from './slash-commands/SlashCommandCommonEnumsProvider.js'; |
| 17 | import { SlashCommandExecutor } from './slash-commands/SlashCommandExecutor.js'; | 17 | import { SlashCommandExecutor } from './slash-commands/SlashCommandExecutor.js'; |
| 18 | import { SlashCommandClosure } from './slash-commands/SlashCommandClosure.js'; | 18 | import { SlashCommandClosure } from './slash-commands/SlashCommandClosure.js'; |
| 19 | import { Popup } from './popup.js'; | 19 | import { callGenericPopup, Popup, POPUP_TYPE } from './popup.js'; |
| 20 | 20 | ||
| 21 | export { | 21 | export { |
| 22 | world_info, | 22 | world_info, |
| @@ -4224,7 +4224,7 @@ export function checkEmbeddedWorld(chid) { | |||
| 4224 | importEmbeddedWorldInfo(true); | 4224 | importEmbeddedWorldInfo(true); |
| 4225 | } | 4225 | } |
| 4226 | }; | 4226 | }; |
| 4227 | callPopup(html, 'confirm', '', { okButton: 'Yes' }).then(checkResult); | 4227 | callGenericPopup(html, POPUP_TYPE.CONFIRM, '', { okButton: 'Yes' }).then(checkResult); |
| 4228 | } | 4228 | } |
| 4229 | else { | 4229 | else { |
| 4230 | toastr.info( | 4230 | toastr.info( |