Skip to content

Instantly share code, notes, and snippets.

@lamchau
Created July 29, 2019 05:52
Show Gist options
  • Save lamchau/c4ce1c9ff726bba6d6a40d0a8958858c to your computer and use it in GitHub Desktop.
Save lamchau/c4ce1c9ff726bba6d6a40d0a8958858c to your computer and use it in GitHub Desktop.
$asArray = selector => Array.from(document.querySelectorAll(selector));
loadMore = setInterval(() => {
const clickButton = ($x, index) => setTimeout(() => $x.click(), index * 25);
const $more = $asArray('.load-more');
if ($more.length) {
$more.forEach(clickButton);
return;
}
clearInterval(loadMore);
$asArray('.grid-coupon-btn').forEach(clickButton);
}, 500);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment