Add WI title backfill button

This commit is contained in:
Cohee
2023-10-05 23:56:31 +03:00
parent b49f234185
commit 0dfe46a162
3 changed files with 19 additions and 1 deletions

View File

@ -400,6 +400,23 @@ function displayWorldEntries(name, data, navigation = navigation_option.none) {
await renameWorldInfo(name, data);
});
$("#world_backfill_memos").off('click').on('click', async () => {
let counter = 0;
for (const entry of Object.values(data.entries)) {
if (!entry.comment && Array.isArray(entry.key) && entry.key.length > 0) {
entry.comment = entry.key[0];
setOriginalDataValue(data, entry.uid, "comment", entry.comment);
counter++;
}
}
if (counter > 0) {
toastr.info(`Backfilled ${counter} titles`);
await saveWorldInfo(name, data, true);
updateEditor(navigation_option.previous);
}
});
$("#world_popup_export").off('click').on('click', () => {
if (name && data) {
const jsonValue = JSON.stringify(data);