Skip to content

Instantly share code, notes, and snippets.

@L3n1n
Last active May 26, 2022 00:41
Show Gist options
  • Save L3n1n/f287ce9e2cf08a191b23074a81f238d5 to your computer and use it in GitHub Desktop.
Save L3n1n/f287ce9e2cf08a191b23074a81f238d5 to your computer and use it in GitHub Desktop.
Steam Summer Sale 2021 Event Badge
// ==UserScript==
// @name Steam Summer Sale 2021 Event Badge
// @namespace https://gist.github.com/L3n1n
// @version 1.04
// @description Steam Summer Sale 2021 Event Badge
// @author L3n1n
// @match *://store.steampowered.com/forgeyourfate*
// @updateURL https://gist.githubusercontent.com/L3n1n/f287ce9e2cf08a191b23074a81f238d5/raw/SteamSummerSale2021EventBadge.user.js
// @downloadURL https://gist.githubusercontent.com/L3n1n/f287ce9e2cf08a191b23074a81f238d5/raw/SteamSummerSale2021EventBadge.user.js
// ==/UserScript==
(function(){
jQuery('.page_content_ctn .responsive_store_nav_ctn_spacer').after('<div style="margin-bottom: 15px; text-align: center;" id="AutoBadge"></div>');
jQuery('#AutoBadge').append('<span class="btnv6_lightblue_blue btn_medium" data-id="1"><span>Детектив-призрак</span></span>');
jQuery('#AutoBadge').append('<span style="margin-left: 15px;" class="btnv6_lightblue_blue btn_medium" data-id="2"><span>Исследователь-новатор</span></span>');
jQuery('#AutoBadge').append('<span style="margin-left: 15px;" class="btnv6_lightblue_blue btn_medium" data-id="3"><span>Учёная горилла</span></span>');
jQuery('#AutoBadge').append('<span style="margin-left: 15px;" class="btnv6_lightblue_blue btn_medium" data-id="4"><span>Профессор паранормальных дел</span></span>');
jQuery('#AutoBadge').append('<span style="margin-left: 15px;" class="btnv6_lightblue_blue btn_medium" data-id="5"><span>Мститель в маске</span></span>');
jQuery('#AutoBadge .btn_medium').on('click',function(){
var id = jQuery(this).attr('data-id');
getBadge(id);
jQuery(this).find('span').text('Wait...');
});
})();
function getBadge(id){
if ( ! id ) return false;
jQuery('#AutoBadge .btn_medium[data-id=' + id + '] span').text('Loading...');
console.log(id);
var choices;
if ( id == 1 ) {
choices = [2,2,2,2,2,2,2,2,2,2,2,2,2,2];
} else if ( id == 2 ) {
choices = [2,1,2,1,2,1,1,1,1,1,1,1,2,1];
} else if ( id == 3 ) {
choices = [2,1,2,1,2,1,2,1,2,1,2,1,2,1];
} else if ( id == 4 ) {
choices = [1,1,1,1,2,1,2,2,2,2,2,2,2,2];
} else if ( id == 5 ) {
choices = [1,1,1,1,1,1,1,1,1,1,1,1,1,1];
}
if ( choices ) {
for (let i = 1; i <= 14; i++) {
jQuery.post("https://store.steampowered.com/promotion/ajaxclaimstickerforgenre", { genre: i, choice: choices[i-1], sessionid: g_sessionID }, (res) => console.log("genre " + i + ":", res))
}
}
setTimeout(function(){
window.location.reload();
}, 500);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment