Skip to content

Instantly share code, notes, and snippets.

@krsntn
Last active December 2, 2023 03:42
Show Gist options
  • Select an option

  • Save krsntn/9dfb64f46b81dd1060f9fd5f9ba5c321 to your computer and use it in GitHub Desktop.

Select an option

Save krsntn/9dfb64f46b81dd1060f9fd5f9ba5c321 to your computer and use it in GitHub Desktop.
const claims = () => {
let clickCount = 1;
const claimButtons = Array.from(document.querySelectorAll('div > span'))
.filter(span => span.textContent.includes('Claim'))
.map(span => span.closest('div'));
const buttonCount = claimButtons.length;
console.log(`Total Claim Button: ${buttonCount}`);
const interval = setInterval(() => {
if (clickCount > buttonCount) {
clearInterval(interval);
console.log('Done!');
} else {
console.log(`Click button: ${clickCount}/${buttonCount}`);
if (claimButtons[clickCount - 1]) claimButtons[clickCount - 1].click();
clickCount++;
}
}, 1000);
};
const divs = document.querySelectorAll('div[style*="absolute"]');
let num = 0;
const intervalScroll = setInterval(() => {
if (num > divs.length - 1) {
clearInterval(intervalScroll);
claims();
}
if (divs[num]) divs[num].scrollIntoView();
num++;
}, 300);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment