zoukankan      html  css  js  c++  java
  • 抢券代码

    (function(window, document, undefined) {
        var interval = 800;
        var closeDelay = 200;
        var index = 0;
        var couponLinks;
        var getCoupon = function() {
            if (index >= couponLinks.length) {
                console.log("领取完毕");
                return;
            }
            var coponLink = couponLinks[index];
            coponLink.click(); index++;
            console.log("领取 第" + index + "");
            setTimeout(getCoupon, interval);
            setTimeout(function() {
                var close = document.querySelector('.mui-dialog-close');
                if (close != null) close.click();
            }, closeDelay);
        };
        var _scrollTop = 0;
        var _scrollStep = document.documentElement.clientHeight;
        var _maxScrollTop = document.body.clientHeight - document.documentElement.clientHeight;
        var autoScrollDown = setInterval(function() {
            _scrollTop += _scrollStep;
            if (_scrollTop > _maxScrollTop) {
                clearInterval(autoScrollDown);
                couponLinks = document.querySelectorAll('.mui-act-item-yhqbtn');
                console.log("总共:" + couponLinks.length + "条张优惠券待领取...");
                getCoupon();
            } else {
                document.body.scrollTop = _scrollTop;
            }
        }, 500);
    }) (window, document);

    //直接粘贴到控制台 运行

  • 相关阅读:
    mac 终端常见指令
    git常见指令
    iOS8的autolayout和size class
    UIWindow详解
    操作系统Unix、Windows、Mac OS、Linux的故事
    iOS引用当前显示的UIAlertView
    Unexpected CFBundleExecutable Key
    《CODE》讲了什么?
    exit和return的区别
    php 登录注册api接口代码
  • 原文地址:https://www.cnblogs.com/vali/p/6217313.html
Copyright © 2011-2022 走看看