Greasy Fork

自动领取任务

自动领取任务。

目前为 2020-08-25 提交的版本。查看 最新版本

// ==UserScript==
// @name         自动领取任务
// @version      0.6
// @include      https://www.mcbbs.net/*
// @author       xmdhs
// @description  自动领取任务。
// @namespace https://greasyfork.org/users/166541
// ==/UserScript==

(function () {
    var times = localStorage.getItem("autoapply")
    if (Math.round(new Date().getTime()/1000) - times >= 60){
        localStorage.setItem("autoapply",Math.round(new Date().getTime()/1000))
    }else{
        return
    }
    var a = document.getElementsByClassName("user_info_menu_btn");
    var b = a[0].childNodes[7].lastChild.href;
    var c = b.indexOf('&formhash=');
    var key = b.substring(c + 10);
    setTimeout(function () { run(key, "39", "draw"); }, 5000);
    setTimeout(function () { run(key, "22", "draw"); }, 5000);
    setTimeout(function () { run(key, "40", "draw"); }, 3000);
    setTimeout(function () { run(key, "24", "draw"); }, 3000);
    setTimeout(function () { run(key, "24", "apply"); }, 3000);
    setTimeout(function () { run(key, "39", "apply"); }, 1000);
    setTimeout(function () { run(key, "22", "apply"); }, 1000);
    setTimeout(function () { run(key, "40", "apply"); }, 1000);

 }
 )();

 function run(key, a, type) {
    var xmlhttp;
    xmlhttp = new XMLHttpRequest();
    xmlhttp.open("GET", "home.php?mod=task&do=" + type + "&id=" + a + "&hash=" + key, true);
    xmlhttp.send();
 }