BJ's Wholesale Club Coupon Clicker

Click all the coupons on BJ's Wholesale Club website

当前为 2023-07-10 提交的版本,查看 最新版本

// ==UserScript==
// @name              BJ's Wholesale Club Coupon Clicker
// @namespace         bjs-wholesale-coupon
// @version           1.3.0
// @description       Click all the coupons on BJ's Wholesale Club website
// @author            sleevetrick
// @match             https://www.bjs.com/myCoupons
// @match             https://www.bjs.com/myCoupons?source=header
// @contributionURL   https://www.paypal.com/cgi-bin/webscr?cmd=_donations&[email protected]&item_name=Greasy+Fork+for+BJs+CC
// ==/UserScript==
 
var couponAttribute = "";
var totalCoupon = 0;
 
// Conduct coupon clipping
function clipCoupons(index, elements, limit, count){
 
   // If there are no coupons to clip get them by the querySelectorAll
   if (elements == "undefined") {
      elements = document.querySelectorAll('[data-auto-data="coupon_ClipToCard"]');
      count = elements.length;
      clipCoupons(0, elements, 1000, count);
      console.log("Next Page...");
   } else if (index < count){
       elements[index].click();
       totalCoupon++;
       index++;
       console.log("Clipping Coupon #" + totalCoupon);
       setTimeout(()=>{
           clipCoupons(index, elements, 1000, count);
       }, 1000)
   } else {
      if(document.querySelectorAll("button.next-prev").length >= 1) {
          var paginationButtons = document.querySelectorAll("button.next-prev");
          for(var i = 0; i < paginationButtons.length; i++) {
             if (paginationButtons[i].innerHTML.includes("Next",1)) {
               paginationButtons[i].click();
               break;
             }
          }
        setTimeout(()=>{
               clipCoupons(0, "undefined", 1000, 0);
       }, 5000)
      } else {
               alert("You saved ["+totalCoupon+"] coupon clicks with BJ's Coupon Clicker")  
      }
   }
}
 
function loadFrame() {
    totalCoupon = 0;
    console.log('Beginning Coupon Clipping...!');
    clipCoupons(0, "undefined", 1000, 0);
};
 
window.onload = setTimeout(loadFrame, 5000);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址