1
0
Fork 0

feat: 完善网络异常时 刷新逻辑

master
502647092 2021-03-13 06:09:54 +00:00
parent 3997dafb60
commit 7535550630
1 changed files with 7 additions and 2 deletions

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @name MCBBS自动售卖机
// @namespace https://miaowoo.cc/
// @version 0.6.3
// @version 0.7.0
// @description 自动售卖道具
// @author MiaoWoo
// @match https://www.mcbbs.net/home.php?mod=magic**
@ -101,7 +101,12 @@
sendItem(() => window.showWindow('magics', 'home.php?mod=magic&action=mybox&operation=give&magicid=32', 'get', 0), masterInfo.username, masterInfo.amount || stock)
}
async function refresh() {
location.href = '/home.php?mod=magic&action=mybox&nodeType=' + params.nodeType
try {
await fetch('/api/mobile/index.php?version=4&module=credit')
location.href = '/home.php?mod=magic&action=mybox&nodeType=' + params.nodeType
} catch (error) {
setTimeout(refresh, 5000)
}
}
async function shopAction() {
await sendOrderAction(() => window.showWindow('magics', 'home.php?mod=magic&action=shop&operation=give&mid=mcbbs_mcserver_plus:serverBump'), true)