// ==UserScript== // @name 自动领取任务 // @version 0.9.0 // @include https://www.mcbbs.net/* // @author xmdhs // @description 自动领取任务。 // @namespace https://greasyfork.org/users/166541 // @downloadURL none // ==/UserScript== (function () { let times = localStorage.getItem("autoapply") if (Math.round(new Date().getTime() / 1000) - times >= 60) { localStorage.setItem("autoapply", Math.round(new Date().getTime() / 1000)) } else { return } sign() async function sign() { let f = await fetch("/api/mobile/index.php?version=4&module=profile", { credentials: "same-origin" }); let j = await f.json(); let key = j.Variables.formhash; await sleep(1000); run(key, "39", "draw"); run(key, "22", "draw"); run(key, "40", "draw"); run(key, "24", "draw"); await sleep(2000); run(key, "24", "apply"); run(key, "39", "apply"); run(key, "22", "apply"); run(key, "40", "apply"); } async function sleep(t) { return new Promise((rs, rj) => { setTimeout(() => { rs() }, t) }) } function run(key, a, type) { return fetch("home.php?mod=task&do=" + type + "&id=" + a + "&hash=" + key, { credentials: "same-origin" }) } } )();