jnaskali / Auto-Claim Itch.io Bundles

This could potentially be switched over to send a POST request for each claim button rather than clicking each button (this also avoids opening a bunch of tabs).
Historically, itch has asked to avoid hammering their servers, so the timeout/ratelimit should stay in place.

var $ = window.jQuery;

var clicked = 0;
var csrfToken = $('input[name="csrf_token"]')[0].value;
$('input[name="game_id"]').each(function() {
  setTimeout(function() {
      var gameId = $(this).val();
      $.post(window.location.href, { action: 'claim', csrf_token: csrfToken, game_id: gameId });
  }.bind(this), 400*clicked);

  clicked++;
});
console.log("Auto-claimed " + clicked + " buttons.");