Skip to content

Commit

Permalink
waifu show and mute when replace
Browse files Browse the repository at this point in the history
  • Loading branch information
HowcanoeWang committed Sep 16, 2023
1 parent 6ac427e commit f71d47b
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ export default class PluginSample extends Plugin {
spara = '&&'
}

replaceBtnElement.addEventListener("click", async () => {
replaceBtnElement.addEventListener("click", () => {
const backupCmdStr = this.backupCMD(spara);
const replaceCmdStr = this.replaceCMD(spara);

Expand Down Expand Up @@ -488,9 +488,6 @@ export default class PluginSample extends Plugin {
finCmdStr += winChangeExeStr + ` ${spara} ` + clearCacheStr;
}


await waifu.setWaifuHide(false);

debug(`[index.ts][openSetting] final execude cmd ${finCmdStr}`);

confirm(this.i18n.batchTitle, this.i18n.batchDes + `<pre style="font-size: 12px;">${
Expand All @@ -500,7 +497,7 @@ export default class PluginSample extends Plugin {
/\s*;\s*/g, // 无视;前后的空格,并添加回车
';\n')
}</pre>`,
()=>
async ()=>
{
this.execudeCMD(finCmdStr);
dialog.destroy();
Expand All @@ -517,11 +514,17 @@ export default class PluginSample extends Plugin {
}
),
1000);

// mute the sound of waifu
window.waifuMute = true;
configs.set('waifuMute', true);
// show waifu
await waifu.setWaifuHide(false);
})

})

recoverBtnElement.addEventListener("click", async () => {
recoverBtnElement.addEventListener("click", () => {
const restoreCmdStr = this.restoreCMD(spara);
var finCmdStr: string = restoreCmdStr;

Expand All @@ -531,9 +534,6 @@ export default class PluginSample extends Plugin {
finCmdStr += clearCacheStr;
}

// close waifu
await waifu.setWaifuHide(true);

info(`[index.ts][openSetting] click recover btn, execute the following command: ${finCmdStr}`);

confirm(this.i18n.batchTitle, this.i18n.batchDes + `<pre style="font-size: 12px;">${
Expand All @@ -543,7 +543,7 @@ export default class PluginSample extends Plugin {
/\s*;\s*/g, // 无视;前后的空格,并添加回车
';\n')
}</pre>`,
()=>
async ()=>
{
this.execudeCMD(finCmdStr);
dialog.destroy();
Expand All @@ -560,6 +560,9 @@ export default class PluginSample extends Plugin {
}
),
1000);

// close waifu
await waifu.setWaifuHide(true);
})

})
Expand Down

0 comments on commit f71d47b

Please sign in to comment.