Greasy Fork

Greasy Fork is available in English.

淘宝话费充值圣诞活动抽奖脚本

淘宝话费充值圣诞活动,充一笔送一笔抽奖自动点击脚本

目前为 2017-12-24 提交的版本,查看 最新版本

// ==UserScript==
// @name         淘宝话费充值圣诞活动抽奖脚本
// @description  淘宝话费充值圣诞活动,充一笔送一笔抽奖自动点击脚本
// @namespace    com.uestc.rjw
// @version      0.4
// @match        *pages.tmall.com/wow/wt/act/cost20171224*
// @grant        unsafeWindow
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';
    function reward(){
        var group = document.getElementsByClassName('item-cell');
        console.log('group length:'+group.length);
        if(group.length > 0){
            group[4].click();
            setInterval(function(){
                group[0].click();
                var div = document.getElementsByClassName('act-popup');
                if(div.length > 0){
                    var text = div[0].innerText;
                    if(text.indexOf('话费') >= 0){
                        unsafeWindow.location.reload();
                    }
                    if(text.indexOf('先充值再抽奖') >= 0){
                        setTimeout(function(){
                            unsafeWindow.location.reload();
                        }, 60000);
                    }
                }
            }, 4000);
        }else{
            setTimeout(reward, 2000);
        }
    }
    setTimeout(reward, 4000);
    // Your code here...
})();