Skip to content

Instantly share code, notes, and snippets.

@nachtien
Created July 19, 2023 15:57
Show Gist options
  • Save nachtien/e5b6f17ab19dab71e80fae2844cc149c to your computer and use it in GitHub Desktop.
Save nachtien/e5b6f17ab19dab71e80fae2844cc149c to your computer and use it in GitHub Desktop.
Javascript to apply all chase offers
/**
APPLY CHASE BANK CC OFFERS
This script helps you apply all the Chase bank credit cards automatically.
- Login to Chase and go to https://secure03b.chase.com/web/auth/dashboard#/dashboard/offers/index.
- Open 'Inspect Element'
- Paste this in the console and hit enter
*/
const BUTTON_CLASSNAME = 'iconAddToCard';
const ALREADY_APPLIED_OFFER_CLASSNAME = 'confirmation';
function timeout(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
const getButtons = () => {
const allButtons = document.getElementsByClassName(BUTTON_CLASSNAME);
let validButtons = [];
for (let j=0; j < allButtons.length; j++) {
if (allButtons[j].getElementsByClassName(ALREADY_APPLIED_OFFER_CLASSNAME).length <= 0) {
validButtons.push(allButtons[j])
}
}
return validButtons;
}
const begin = async () => {
let buttons = getButtons();
while (buttons.length > 0) {
let btn = buttons[0];
btn.click();
await timeout(1500);
let close = document.getElementById('flyoutClose');
close.click();
await timeout(1500);
buttons = getButtons();
}
}
begin();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment