// https://github.com/steamnerds/userscripts
// Execute while having the inventory you want to unstack all items for open.
// Might have to scroll trough the inventory pages before it will work.
// If many stacked items, might have to run it a few times before all are unstacked (not sure why, maybe rate limits, since I have no pauses at all)
// EDIT: Added a pause between API calls :P
/*jshint esversion: 8 */
(() => {
if (!/^https:\/\/steamcommunity\.com\/(id\/[\w-_]{1,64}|profiles\/\d{17})\/inventory/.test(location.href)) {
console.error("You need to run this script on your inventory page");
return false;
}
var [appid, context, webapikey, sleep, invAssets] = [location.hash.substr(1).replace(/\D/g, ''), '', '', '', ''];
appid = appid != '' ? appid : '753';
ShowPromptDialog("Please enter the appid", "", "Continue", "Abort", '', appid).done((a) => {
appid = a;
let text = 'Here are the options for this app (usually only the number 2):
';
for (var contextnr in g_rgAppContextData[appid].rgContexts) {
if (g_rgAppContextData[appid].rgContexts.hasOwnProperty(contextnr)) {
text += contextnr + ': ' + g_rgAppContextData[appid].rgContexts[contextnr].name + ' (' + g_rgAppContextData[appid].rgContexts[contextnr].asset_count + ')
';
}
}
text += '
';
ShowPromptDialog("Please enter the correct context number", text, "Continue", "Abort", '', '2').done((b) => {
context = b;
ShowPromptDialog("Please enter your Steam WebAPIkey", 'Enter the key listed here: https://steamcommunity.com/dev/apikey
', "Continue", "Abort", '', '').done((c) => {
webapikey = c;
ShowPromptDialog("Time to sleep between api calls (in ms)", "", "Run", "Abort", '', '1000').done((d) => {
sleep = d;
invAssets = g_rgAppContextData[appid].rgContexts[context].inventory.m_rgAssets;
splitItems();
});
});
});
});
document.location.href = document.location.href.split('#')[0] + "#" + appid;
//g_ActiveInventory.GoToPage(g_ActiveInventory.m_cPages);
async function splitItems() {
ShowAlertDialog("Splitting items", '