NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name BJ's Wholesale Club Coupon Clicker // @namespace bjs-wholesale-coupon // @version 1.2.6 // @description Click all the coupons on BJ's Wholesale Club website // @author sleevetrick // @esversion 6 // @match https://www.bjs.com/myCoupons // @match https://www.bjs.com/myCoupons?source=header // @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=abl34@cornell.edu&item_name=Greasy+Fork+Donation // @copyright 2021, Eversake (https://openuserjs.org/users/Eversake) // @license MIT // ==/UserScript== /* jshint esversion: 6 */ var couponAttribute = ""; var totalCoupon = 0; function clipCoupons(index, elements, limit, count){ if (elements == "undefined") { elements = document.querySelectorAll("button["+couponAttribute+"]"); 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); }, 750); } else { if(document.querySelectorAll("span[class='next']").length >= 1) { document.querySelectorAll("span[class='next']")[0].click(); setTimeout(()=>{ clipCoupons(0, "undefined", 1000, 0); }, 3000); } else { printEnd(); } } } function loadFrame() { totalCoupon = 0; console.log('Beginning Coupon Clipping...!'); couponAttribute = document.getElementsByClassName("availableCouponBox")[0].getElementsByTagName("button")[1].getAttributeNames()[0]; clipCoupons(0, "undefined", 1000, 0); } window.onload = setTimeout(loadFrame, 5000); function printEnd(){ console.log('Finished'); }