Skip to content

Instantly share code, notes, and snippets.

@UltraNurd
Created April 12, 2013 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save UltraNurd/5372576 to your computer and use it in GitHub Desktop.
Save UltraNurd/5372576 to your computer and use it in GitHub Desktop.
This JavaScript one-liner iterates through all of the paging and "add to cart" buttons at promo.comixology.com to add each of 723 Marvel #1s to your Comixology cart. Checkout and login etc. are still handled manually. I just pasted this into my Chrome console.
pagers = document.getElementsByClassName('adHocPager');
for (i = 0; i < 18; i++) {
add_buttons = document.getElementsByClassName('addComicLink');
for (a = 0; a < add_buttons.length; a++) {
if (add_buttons[a].text != 'In Cart') {
add_buttons[a].click();
}
}
for (p = 0; p < pagers.length; p++) {
next_buttons = pagers[p].getElementsByTagName('a');
next_button = next_buttons[next_buttons.length - 1];
next_button.click();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment