1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| (function () { if (location.hostname !== 'store.steampowered.com') { alert('Run this code on the Steam Store!'); 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 = [0000000];
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); } }); }
}());
|