Move overwrite data confirm to new popup

This commit is contained in:
Wolfsblvt 2024-06-26 05:35:41 +02:00
parent cd9013cf73
commit ff5f89bd5e
1 changed files with 3 additions and 2 deletions

View File

@ -1,8 +1,9 @@
import { getContext } from './extensions.js'; import { getContext } from './extensions.js';
import { callPopup, getRequestHeaders } from '../script.js'; import { getRequestHeaders } from '../script.js';
import { isMobile } from './RossAscends-mods.js'; import { isMobile } from './RossAscends-mods.js';
import { collapseNewlines } from './power-user.js'; import { collapseNewlines } from './power-user.js';
import { debounce_timeout } from './constants.js'; import { debounce_timeout } from './constants.js';
import { Popup } from './popup.js';
/** /**
* Pagination status string template. * Pagination status string template.
@ -1821,7 +1822,7 @@ export async function checkOverwriteExistingData(type, existingNames, name, { in
return true; return true;
} }
const overwrite = interactive ? await callPopup(`<h3>${type} ${actionName}</h3><p>A ${type.toLowerCase()} with the same name already exists:<br />${existing}</p>Do you want to overwrite it?`, 'confirm') : false; const overwrite = interactive && await Popup.show.confirm(`${type} ${actionName}`, `<p>A ${type.toLowerCase()} with the same name already exists:<br />${existing}</p>Do you want to overwrite it?`);
if (!overwrite) { if (!overwrite) {
toastr.warning(`${type} ${actionName.toLowerCase()} cancelled. A ${type.toLowerCase()} with the same name already exists:<br />${existing}`, `${type} ${actionName}`, { escapeHtml: false }); toastr.warning(`${type} ${actionName.toLowerCase()} cancelled. A ${type.toLowerCase()} with the same name already exists:<br />${existing}`, `${type} ${actionName}`, { escapeHtml: false });
return false; return false;