// Based on Origin version bySteamDb.info
(function() {
if (location.hostname !== 'store.steampowered.com') {
alert('Run this code on theSteamStore!');
return;
} else if (typeof jQuery !== 'function') {
ShowAlertDialog('Fail', 'This page has no jQuery, try homepage.');
return;
} else if (document.getElementById('header_notification_area') === null) {
ShowAlertDialog('Fail', 'You have to be logged in.');
return;
}
var freePackages = [158055];
var loaded = 0,
total = freePackages.length,
modal = ShowBlockingWaitDialog('Executing...', 'Please wait until all requests finish.');
for (var i = 0; i < total; i++) {
jQuery.post(
'//store.steampowered.com/checkout/addfreelicense', {
action: 'add_to_cart',
sessionid: g_sessionID,
subid: freePackages[i]
},
function(data) {
loaded++;
modal.Dismiss();
if (loaded === total) {
ShowAlertDialog('All done!', 'Enjoy.');
} else {
modal = ShowBlockingWaitDialog('Executing...', 'Loaded ' + loaded + '/' + total);
}
}
).fail(function() {
loaded++;
modal.Dismiss();
if (loaded === total) {
ShowAlertDialog('All done!', 'Enjoy.');
} else {
modal = ShowBlockingWaitDialog('Executing...', 'Loaded ' + loaded + '/' + total);
}
});
}
}());
(function() {
if (location.hostname !== 'store.steampowered.com') {
alert('Run this code on theSteamStore!');
return;
} else if (typeof jQuery !== 'function') {
ShowAlertDialog('Fail', 'This page has no jQuery, try homepage.');
return;
} else if (document.getElementById('header_notification_area') === null) {
ShowAlertDialog('Fail', 'You have to be logged in.');
return;
}
var freePackages = [158055];
var loaded = 0,
total = freePackages.length,
modal = ShowBlockingWaitDialog('Executing...', 'Please wait until all requests finish.');
for (var i = 0; i < total; i++) {
jQuery.post(
'//store.steampowered.com/checkout/addfreelicense', {
action: 'add_to_cart',
sessionid: g_sessionID,
subid: freePackages[i]
},
function(data) {
loaded++;
modal.Dismiss();
if (loaded === total) {
ShowAlertDialog('All done!', 'Enjoy.');
} else {
modal = ShowBlockingWaitDialog('Executing...', 'Loaded ' + loaded + '/' + total);
}
}
).fail(function() {
loaded++;
modal.Dismiss();
if (loaded === total) {
ShowAlertDialog('All done!', 'Enjoy.');
} else {
modal = ShowBlockingWaitDialog('Executing...', 'Loaded ' + loaded + '/' + total);
}
});
}
}());