Created
September 30, 2014 13:10
-
-
Save anonymous/7b26ededc9bc273a5f68 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 Hide empty Steam inventories | |
// @namespace https://www.reddit.com/user/zillazillaaaa/ | |
// @description Hide those empty inventories in your profile. | |
// @author zillazillaaaa | |
// @include /https?\:\/\/steamcommunity\.com\/(id|profiles)\/[\d\w]+\/inventory\/.*/ | |
// @version 1.0 | |
// @icon https://steamcommunity.com/favicon.ico | |
// @grant none | |
// ==/UserScript== | |
(function($) { | |
$(function() { | |
var manual_hide = []; // Appid, specify the inventories you want to hide no matter they are empty or not. | |
var tab_count = 0; | |
$('div.games_list_tabs > a[id^="inventory_link_"]') | |
.each(function() { | |
var separator = $(this).next('div[class^="games_list_tab_"]'); | |
$(this).removeClass('first_tab fourth_tab'); | |
if (($.inArray(parseInt($(this).prop('href').match(/\d+/)[0]), manual_hide) >= 0) || | |
(parseInt($(this).children('span.games_list_tab_number').html().replace(/,/g, '').match(/\d+/)[0]) == 0)) { | |
$(this).removeClass().hide(); | |
separator.removeClass().hide(); | |
} else { | |
tab_count++; | |
} | |
tab_count == 1 && $(this).addClass('first_tab'); | |
tab_count == 4 && $(this).addClass('fourth_tab'); | |
separator.removeClass().addClass( | |
((tab_count > 0) && (tab_count%4 == 0)) ? 'games_list_tab_row_separator' : 'games_list_tab_separator' | |
); | |
}); | |
}); | |
})($J); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment