Created
December 23, 2015 23:17
-
-
Save zetx/983c8ade328e55ba15fb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Auto Remove Bad-Region Apps | |
// @namespace http://steamcommunity.com/id/zetx/ | |
// @description If app in queue is not allowed in region, automatically remove an app from the queue. | |
// @include http://store.steampowered.com/app/* | |
// @version 1.1 | |
// @run-at document-end | |
// @grant none | |
// ==/UserScript== | |
/* | |
Thanks | |
* http://stackoverflow.com/a/13734859 | |
*/ | |
function GM_main() { | |
window.onload = function () { | |
if ( $J('.error:contains("This item is currently unavailable in your region")').length ) { | |
var unavailable_app = window.location.pathname.split('/')[2]; | |
$J.post("/app/7", { sessionid: g_sessionID, appid_to_clear_from_queue: unavailable_app }) | |
.done( function ( data ) { | |
window.location = 'http://store.steampowered.com/explore/next'; | |
$J('.error').html( $J('.error').html() + '<br />(Removing from queue)' ); | |
}).fail( function() { | |
$J('.error').html( $J('.error').html() + '<br />(Could not remove from queue. Reload or try <a href="https://www.reddit.com/r/Steam/comments/3r2k4y/how_do_i_complete_discovery_queue_if_every_queue/cwkrrzf">removing manually.</a>)' ); | |
} ); | |
} | |
} | |
} | |
addJS_Node(null, null, GM_main); | |
//-- This is a standard-ish utility function: | |
function addJS_Node(text, s_URL, funcToRun, runOnLoad) { | |
var D = document; | |
var scriptNode = D.createElement ('script'); | |
if (runOnLoad) { | |
scriptNode.addEventListener ("load", runOnLoad, false); | |
} | |
scriptNode.type = "text/javascript"; | |
if (text) scriptNode.textContent = text; | |
if (s_URL) scriptNode.src = s_URL; | |
if (funcToRun) scriptNode.textContent = '(' + funcToRun.toString() + ')()'; | |
var targ = D.getElementsByTagName ('head')[0] || D.body || D.documentElement; | |
targ.appendChild (scriptNode); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment