更新 'mcbbs/vending-machine.user.js'

This commit is contained in:
502647092 2020-12-28 03:12:37 +00:00
parent e0fa26231a
commit 8419d556fb

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @name MCBBS自动售卖机
// @namespace https://miaowoo.cc/
// @version 0.6.1
// @version 0.6.2
// @description 自动售卖道具
// @author MiaoWoo
// @match https://www.mcbbs.net/home.php?mod=magic**
@ -19,7 +19,23 @@
async function sleep(time) {
return new Promise((resolve, reject) => setTimeout(resolve, time))
}
function createMenu() {
let master = document.createElement('a')
master.href = "/home.php?mod=magic&action=mybox&nodeType=master"
master.innerText = "售卖机主节点"
let slave = document.createElement('a')
slave.href = "/home.php?mod=magic&action=mybox&nodeType=slave"
slave.innerText = "售卖机子节点"
let masterLi = document.createElement('li')
masterLi.append(master)
let slaveLi = document.createElement('li')
slaveLi.append(slave)
let tbn = document.getElementsByClassName('tbn')[0].children[1]
tbn.append(masterLi)
tbn.append(slaveLi)
}
async function main() {
createMenu()
params = location.href.split('?')[1].split('&').map(s => s.split('=')).reduce((pre, cur, index) => { pre[cur[0]] = cur[1]; return pre }, {})
if (!params.nodeType) { return console.log('nodeType is undefined skip...') }
if (!params.action) { return refresh() }