更新 'mcbbs/server-bump.user.js'

This commit is contained in:
502647092 2021-06-11 02:42:18 +00:00
parent 8110433f0d
commit a54b7f6f57

View File

@ -1,10 +1,11 @@
// ==UserScript==
// @name 圈云盒子顶帖器
// @namespace https://circlecloud.ltd/
// @version 0.1.5
// @version 0.1.6
// @description 自动顶贴
// @author MiaoWoo
// @match https://www.mcbbs.net/forum-server-1.html**
// @run-at document-start
// @grant none
// ==/UserScript==
/* global jq */
@ -52,10 +53,12 @@
}).then(r => r.json())
}
async function main() {
await sleep(3000)
//feat: auto refresh when mcbbs return 504
if (document.getElementsByTagName('h1')[0].innerText.startsWith(504)) {
return refresh()
}
let taskId = setTimeout(refresh, 60000)
let params = location.href.split('?')[1]?.split('&').map(s => s.split('=')).reduce((pre, cur, index) => { pre[cur[0]] = cur[1]; return pre }, {}) || {}
nextPage = document.getElementById('autopbn')
let servers = await readServers()
@ -75,10 +78,8 @@
ten: servers[10].tid,
twenty_five: servers[25].tid
})
if (!params.autoRefresh) { return }
if (!params.autoRefresh) { return clearTimeout(taskId) }
console.log('已开启自动刷新!')
await sleep(60000)
refresh()
}
async function refresh() {
try {
@ -88,5 +89,6 @@
setTimeout(refresh, 5000)
}
}
window.alert = function (...args) { console.log(args) }
main()
})()