CC直播自动领取宝箱

CC直播自动领取宝箱,需要自己进入直播间挂机,每天可领取15次!

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         CC直播自动领取宝箱
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  CC直播自动领取宝箱,需要自己进入直播间挂机,每天可领取15次!
// @author       Ayou
// @match        http://cc.163.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var isDraw = false;
    setInterval(() => {
        var time = document.getElementsByClassName("lottery-red js-lottery-cd")[0];
        if(time !== undefined){
            //console.log("Time: "+time.innerText);
            if(isDraw === false && equals(time.innerText,"")){
                document.getElementsByClassName("lottery-entrance-mask js-lottery-entrance-mask js-need-log-now")[0].click();
                document.getElementsByClassName("lottery-footer js-lottery-footer")[0].getElementsByTagName("a")[0].click();
                isDraw = true;
                console.log("draw lottery!"+isDraw);
                setTimeout(() => {
                    isDraw = false;
                    console.log("Draw: "+isDraw);
                    document.getElementsByClassName("lottery-close-btn win_shut")[0].click();
                }, 12000);
            }
        }
}, 1100);
})();

function equals(str1, str2)
{
    if(str1 == str2)
    {
        return true;
    }
    return false;
}