熊猫TV自动领取竹子

try to take over the world!

As of 2018-06-29. See the latest version.

// ==UserScript==
// @name         熊猫TV自动领取竹子
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       Onsxsen
// @match        https://www.panda.tv/*
// @grant        none
// ==/UserScript==
//仅支持领取竹子不需要验证码的用户
(function() {
    'use strict';
    //声明检测程序
    window.GetText = function (){
        var p = $('p.room-task-timer');
        if(p){
            //检测当前标题
            if(p.text() === '可领取'){
                Click();
            } else if (p.text() === '已领完'){
                window.clearInterval(Time1);
                 console.log("清除定时器");
            }

        }

    }
    //声明领取程序
    function Click () {
        //获取领取的元素
        var li = $('li.room-task-item-2');
        if(li){
            //点击第一个元素
            li[0].click();
        }

    }
    //设置一个定时器,一秒执行一次
    var Time1 =  window.setInterval('GetText()',"1000");//每隔6000毫秒执行一次testFunction()函数,执行无数次。

    // Your code here...
})();