Whitejade / ffsSteam

// ==UserScript==
// @name        ffsSteam
// @namespace   whatSpace
// @description quick and very dirty script for clicking through steam's bullshit queue system to get cards
// @include     http://store.steampowered.com/*
// @version     2
// @author      Whitejade
// @grant       none
// @run-at          document-end
// ==/UserScript==

var loc = window.location.pathname.split("/")[1];

switch (loc) {
  case "app":
    if ($J("#error_box").text().contains("This item is currently unavailable in your region")) {
      var appId = window.location.pathname.split("/")[2];
      $J.post("/app/7", { sessionid: g_sessionID, appid_to_clear_from_queue: appId });
      window.location.href = "http://store.steampowered.com/explore";
    } else {
     $J('#next_in_queue_form').submit();   
    }
    break;
  case "agecheck":
    $J("#ageYear").val("1911");
    DoAgeGateSubmit();
    break;
  case "explore":  
    // Script will stop when it reaches the notification that all 3 cards have been claimed
    // Otherwise, generate new queue
    if ($J(".discovery_queue_winter_sale_cards_header > .subtext").text().contains("You can get")) {
      window.location.href = "http://store.steampowered.com/explore/startnew";
    }
    break;
}