CSDN论坛自动签到抽奖

try to take over the world!

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         CSDN论坛自动签到抽奖
// @namespace    http://tampermonkey.net/
// @version      0.4
// @description  try to take over the world!
// @description:ZH-CN   打开自动签到的页面,然后让脚本在后台自动处理所有工作!
// @author       大西瓜一块五一斤
// @match        https://i.csdn.net*/*
// @grant        none
// @requrie      https://code.jquery.com/jquery-3.4.1.min.js
// ==/UserScript==
(function() {
    'use strict';

    function clicker() {
        setTimeout(function() {
            var has_sign = $(".has_sign");
            console.log(has_sign);
            if (has_sign.length == 0) {
                var sign = $(".to_sign");
                console.log(sign[0]);
                sign[0].click();
                setTimeout(function() {
                    var close = $(".close");
                    console.log(close[0]);
                    close[0].click();
                },
                2000);
            }
        },
        2000);
        setTimeout(function() {
            var reward = $(".to_reward");
            console.log(reward);
            if (reward.length > 0) {
                console.log(reward[0]);
                reward[0].click();
                setTimeout(function() {
                    var group = $(".btn_group");
                    console.log(group[0].children[0]);
                    group[0].children[0].click();
                    setTimeout(function() {
                        var close1 = $(".close");
                        console.log(close1[0]);
                        close1[0].click();
                    },
                    8000);
                },
                2000);
            }
        },
        5000);
    }
    function refresher() {
       window.location.href="https://i.csdn.net/#/uc/reward";
       window.location.reload(true);
    }

    window.addEventListener("load", clicker);
    setInterval(refresher, 60*30*1000);
})();