Last active
January 19, 2017 10:50
-
-
Save DragRedSim/df68ca1f3c8494388b86eaffcd855148 to your computer and use it in GitHub Desktop.
Disable IndieGala warning on viewing keys
This file contains hidden or 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 Disable IndieGala warning on viewing keys | |
// @namespace *://www.indiegala.com/profile* | |
// @version 0.3 | |
// @description Disable that annoying message warning you can't share a key you've viewed. Also lets you load multiple keys at once. | |
// @author redion1992 | |
// @match *://www.indiegala.com/profile* | |
// @grant none | |
// @run-at document-idle | |
// @downloadURL https://gist.github.com/redion1992/df68ca1f3c8494388b86eaffcd855148/raw/indiegala_warning.user.js | |
// @updateURL https://gist.github.com/redion1992/df68ca1f3c8494388b86eaffcd855148/raw/indiegala_warning.user.js | |
// ==/UserScript== | |
function fn_fetchserial(code, steam_url, target){ | |
'use strict'; | |
/* | |
if (globalAjaxSemaphore === true) { return; } | |
if (!confirm("Are you sure you want to discover the serial? You won't be able to create a permalink of it or trade it!")) { return; } | |
*/ | |
var gameId = get_game_id_from_steam_url(steam_url); | |
$.ajax({ | |
type: "GET", | |
url: '/myserials/syncget', | |
dataType: "json", | |
data: { | |
code: code, | |
cache: false, | |
productId: gameId, | |
}, | |
beforeSend: function (jqXHR, settings){ | |
$("#permbutton_"+code).hide(); | |
$("#fetchlink_"+code).hide(); | |
$("#info_key_"+code).hide(); | |
$("#fetching_"+code).fadeIn(); | |
start_steam_req(code); | |
}, | |
success: function(data,textStatus){ | |
end_steam_req(code); | |
// alert(data.serial_number); | |
$(target).parent().prev().find('.btn-convert-to-trade').remove(); | |
$("#serial_n_"+code).val(data.serial_number); | |
$("#fetching_"+code).hide(); | |
$("#info_key_"+code).hide(); | |
$("#serial_"+code).fadeIn(); | |
}, | |
error: function (xhr, ajaxOptions, thrownError){ | |
alert(data); | |
end_steam_req(code); | |
}, | |
}); | |
} | |
function fn_permalink(code, steam_url, target) { | |
'use strict'; | |
/* | |
if (globalAjaxSemaphore === true) { | |
return; | |
} | |
if (!confirm("Are you sure you want to create a permalink? You won't be able to discover the serial on your profile!")) { | |
return; | |
} | |
*/ | |
$.ajax({ | |
url: '/steam/permalink/create', | |
data: { | |
code: code, | |
cache: false, | |
}, | |
type: "GET", | |
beforeSend: function (jqXHR, settings) { | |
$("#permbutton_"+code).hide(); | |
$("#fetchlink_"+code).hide(); | |
$("#info_key_"+code).hide(); | |
$("#linking_"+code).fadeIn(); | |
start_steam_req(code); | |
}, | |
success: function(data,textStatus) { | |
end_steam_req(code); | |
$("#linking_"+code).hide(); | |
$("#info_key_"+code).hide(); | |
$("#container_permalink_"+code).html(data); | |
$("#container_permalink_"+code).fadeIn(); | |
$("#trade-"+code).remove(); | |
}, | |
error: function (xhr, ajaxOptions, thrownError) { | |
end_steam_req(code); | |
}, | |
}); | |
} | |
function addJS_Node (text, s_URL) { | |
var scriptNode = document.createElement ('script'); | |
scriptNode.type = "text/javascript"; | |
if (text) scriptNode.textContent = text; | |
if (s_URL) scriptNode.src = s_URL; | |
var targ = document.getElementsByTagName('head')[0] || document.body || document.documentElement; | |
targ.appendChild (scriptNode); | |
} | |
addJS_Node ( fn_fetchserial.toString() ); | |
addJS_Node ( fn_permalink.toString() ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment