更新 'mcbbs/fetch-emerald.user.js'

This commit is contained in:
502647092 2021-09-03 08:15:23 +00:00
parent b694f0310c
commit 832c4de243

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name 自动抓取用户信息 // @name 自动抓取用户信息
// @namespace https://miaowoo.cc/ // @namespace https://miaowoo.cc/
// @version 0.1.5 // @version 0.1.6
// @description 自动抓取用户信息 // @description 自动抓取用户信息
// @author MiaoWoo // @author MiaoWoo
// @match https://www.mcbbs.net/forum.php?mod=viewthread&tid=** // @match https://www.mcbbs.net/forum.php?mod=viewthread&tid=**
@ -29,6 +29,10 @@
postUserInfo(userline.href.split('uid=')[1].split('&')[0], userline.innerText, scoreInfo.children[1].innerText, scoreInfo.children[3].innerText) postUserInfo(userline.href.split('uid=')[1].split('&')[0], userline.innerText, scoreInfo.children[1].innerText, scoreInfo.children[3].innerText)
} }
function readAllUserInfo() { function readAllUserInfo() {
let errorh1 = document.getElementsByTagName('h1')[0]
if (errorh1 && errorh1.innerText.startsWith(50)) {
return location.href = location.href
}
if (location.href == 'https://www.mcbbs.net/thread-1121423-1-1.html') { if (location.href == 'https://www.mcbbs.net/thread-1121423-1-1.html') {
console.log("已开启自动刷新...") console.log("已开启自动刷新...")
setTimeout(function () { setTimeout(function () {
@ -51,14 +55,8 @@
} }
window.alert = function (...args) { console.log(args) } window.alert = function (...args) { console.log(args) }
setTimeout(location.pathname == "/home.php" ? readSingleUserInfo : readAllUserInfo, 2000) setTimeout(location.pathname == "/home.php" ? readSingleUserInfo : readAllUserInfo, 2000)
function addiFrame(url) {
var body = document.getElementsByTagName("body")
var div = document.createElement("div")
div.innerHTML = '<iframe src="' + url + '" height = "0" width = "0" frameborder="0" scrolling="auto" style = "display:none;visibility:hidden" ></iframe>'
document.body.appendChild(div)
}
function updateOldUserInfo() { function updateOldUserInfo() {
fetch('https://reward.yumc.pw/mcbbs/updateList') fetch('https://reward.yumc.pw/mcbbs/updateList').then(resp => resp.json()).then(json => document.getElementById('scbar_txt').value = json.data)
} }
async function post(method, data) { async function post(method, data) {
return await fetch('https://reward.yumc.pw/mcbbs/' + method, { return await fetch('https://reward.yumc.pw/mcbbs/' + method, {