(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);

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

相关文章:

  • 2022-12-23
  • 2021-12-06
  • 2022-02-11
  • 2022-02-13
  • 2022-01-26
  • 2022-12-23
  • 2021-09-10
  • 2021-09-12
猜你喜欢
  • 2022-12-23
  • 2022-02-03
  • 2022-12-23
  • 2022-01-14
  • 2021-12-15
  • 2022-12-23
  • 2021-12-29
相关资源
相似解决方案