fix: refresh nodeType is undefiend!

This commit is contained in:
502647092 2021-03-14 06:36:32 +00:00
parent ca0351603e
commit 74af5c7dff

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name MCBBS自动售卖机 // @name MCBBS自动售卖机
// @namespace https://miaowoo.cc/ // @namespace https://miaowoo.cc/
// @version 0.7.1 // @version 0.7.2
// @description 自动售卖道具 // @description 自动售卖道具
// @author MiaoWoo // @author MiaoWoo
// @match https://www.mcbbs.net/home.php?mod=magic** // @match https://www.mcbbs.net/home.php?mod=magic**
@ -35,13 +35,13 @@
tbn.append(slaveLi) tbn.append(slaveLi)
} }
async function main() { async function main() {
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() }
if (document.getElementsByTagName('h1')[0].innerText.startsWith(504)) { if (document.getElementsByTagName('h1')[0].innerText.startsWith(504)) {
return refresh() return refresh()
} }
createMenu() 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() }
console.log(params) console.log(params)
try { try {
storeUsername = document.getElementsByClassName('username')[0].innerText storeUsername = document.getElementsByClassName('username')[0].innerText