Skip to content

Commit 7995fd3

Browse files
author
prima
committed
fix: Waiting toast ordering
1 parent 4c018a0 commit 7995fd3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

embd_res/js/characterManager.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ let putAllCharacterManagerData = () => {
4848
password = password.trim()
4949
isEncrypted = true
5050
}
51-
waitingToast.show()
5251
let allTasks = await Promise.all(allCharacterNames.map(async c => {
5352
let { name, type, thumbnail } = c, data = await getCharacterData(name);
5453
waitingToast.setText(`Sending data ${name}`)
54+
waitingToast.show()
5555
if (thumbnail !== undefined) {
5656
data.thumbnail = thumbnail
5757
}
@@ -117,10 +117,10 @@ let loadAllCharacterManagerData = () => {
117117
return value.typeName === "Manager"
118118
})
119119

120-
waitingToast.show()
121120
await Promise.all(managerSaves.map(async entry => {
122121
let [key, value] = entry
123122
waitingToast.setText(`Receiving data ${value.name}`)
123+
waitingToast.show()
124124
await fetch(`${custom_kobold_endpoint}/api/data/get`, {
125125
method: "POST",
126126
headers: getAuthHeaders(),
@@ -260,8 +260,8 @@ let showCharacterList = async () => {
260260

261261
let uploadFileHandler = function (result) {
262262
let { file, fileName, ext, content, plaintext, dataArr } = result;
263-
waitingToast.show()
264263
waitingToast.setText(`Loading data ${fileName}`)
264+
waitingToast.show()
265265
if (ext === ".png") {
266266
let arr = new Uint8Array(dataArr)
267267
let res = convertTavernPng(arr)
@@ -652,8 +652,8 @@ let showCharacterList = async () => {
652652
kai_json_load(charData.data, false);
653653
}).button("Overwrite save", async () => {
654654
popupUtils.reset()
655-
waitingToast.show()
656655
waitingToast.setText(`Overwriting data ${name}`)
656+
waitingToast.show()
657657
let data = generate_savefile(true, true, true);
658658
saveKLiteSaveToIndexDB(name, data);
659659
}).button("Download save", async () => {
@@ -691,8 +691,8 @@ let showCharacterList = async () => {
691691

692692
popupUtils.reset().title("Document Options").content(contents).button("Back", showCharacterList).button("Add to TextDB", async () => {
693693
popupUtils.reset()
694-
waitingToast.show()
695694
waitingToast.setText(`Extracting text to add to TextDB`)
695+
waitingToast.show()
696696
let charData = await getCharacterData(name), {extractedText} = charData;
697697
if (extractedText !== undefined)
698698
{
@@ -756,8 +756,8 @@ let showCharacterList = async () => {
756756
inputBox("Enter a Filename", "Save File", "", "Input Filename", () => {
757757
let userinput = getInputBoxValue();
758758
if (userinput != null && userinput.trim() != "") {
759-
waitingToast.show()
760759
waitingToast.setText(`Saving data ${userinput}`)
760+
waitingToast.show()
761761
let data = generate_savefile(true, true, true);
762762
saveKLiteSaveToIndexDB(userinput, data);
763763
}
@@ -775,8 +775,8 @@ let showCharacterList = async () => {
775775

776776
popupUtils.buttonGroup("Bulk").button("Migrate old data", async () => {
777777
popupUtils.reset()
778-
waitingToast.show()
779778
waitingToast.setText(`Migrating old data`)
779+
waitingToast.show()
780780
await migrateOldData()
781781
waitingToast.setText(`Migration complete`)
782782
setTimeout(() => {
@@ -785,8 +785,8 @@ let showCharacterList = async () => {
785785
}).button("Delete all", async () => {
786786
popupUtils.reset()
787787
msgboxYesNo("Are you sure you wish to delete all data?", "Character manager", async () => {
788-
waitingToast.show()
789788
waitingToast.setText(`Deleting all data`)
789+
waitingToast.show()
790790
await Promise.all(allCharacterNames.map(elem => indexeddb_save(`character_${elem.name}`)))
791791
allCharacterNames = []
792792
await updateCharacterListFromAll()

0 commit comments

Comments
 (0)